|
TachyonUI 1.1.0
High-performance UI for building tools.
|
The layouts a document can be given: the app's built-in ones, then the ones the user saved, and which one each file type opens with. More...
#include <gui_controls/gui_layout_presets.h>
Public Member Functions | |
| void | AddBuiltIn (std::string name, std::string tree) |
| Adds one of the app's own layouts, after the other built-in ones; one of the same name is replaced. | |
| bool | Save (std::string name, std::string tree) |
| Saves a user layout, after the others; one of the same name is replaced. | |
| bool | Remove (std::string_view name) |
| Deletes a user layout, and the file types that opened with it. | |
| const LayoutPreset * | Find (std::string_view name) const |
| The layout of that name; null when there's none. | |
| const std::vector< LayoutPreset > & | All () const |
| All of them: the built-in ones, then the saved ones, each in the order added. | |
| void | SetForFileType (std::string_view extension, std::string name) |
| Files of that type (".mat", any case) open with the layout of that name; an empty name stops them. | |
| std::string_view | NameForFileType (std::string_view extension) const |
| The name of the layout files of that type open with; empty when none is set. | |
| const LayoutPreset * | ForFileType (std::string_view extension) const |
| The layout files of that type open with; null when none is set, or it's gone. | |
| const std::vector< std::pair< std::string, std::string > > & | FileTypes () const |
| Each file type with a layout, as (extension, layout name), in the order set. | |
| std::string | ToJson () const |
| The saved layouts and the file types as JSON text; the built-in ones aren't in it. | |
| bool | FromJson (std::string_view json) |
| Takes the saved layouts and the file types from ToJson's text, in place of the ones there are; the built-in ones stay, and saved ones of their names are skipped. | |
The layouts a document can be given: the app's built-in ones, then the ones the user saved, and which one each file type opens with.
presets.AddBuiltIn("Default", app.SaveDockLayout(defaultLayout));
presets.Save("My layout", app.SaveDockLayout(document.layout));
presets.SetForFileType(".mat", "My layout");
if (const LayoutPreset* preset = presets.ForFileType(document.extension))
app.ApplyDockLayout(document.layout, preset->tree, makePanel);
GUIApplication::PersistLayoutPresets keeps the saved ones and the file types.
| void tachyon::LayoutPresets::AddBuiltIn | ( | std::string | name, |
| std::string | tree ) |
Adds one of the app's own layouts, after the other built-in ones; one of the same name is replaced.
| bool tachyon::LayoutPresets::Save | ( | std::string | name, |
| std::string | tree ) |
Saves a user layout, after the others; one of the same name is replaced.
False for an empty name or a built-in one's.
| bool tachyon::LayoutPresets::Remove | ( | std::string_view | name | ) |
Deletes a user layout, and the file types that opened with it.
False when there's none of that name, or it's built in.
| const LayoutPreset * tachyon::LayoutPresets::Find | ( | std::string_view | name | ) | const |
The layout of that name; null when there's none.
|
inline |
All of them: the built-in ones, then the saved ones, each in the order added.
| void tachyon::LayoutPresets::SetForFileType | ( | std::string_view | extension, |
| std::string | name ) |
Files of that type (".mat", any case) open with the layout of that name; an empty name stops them.
| std::string_view tachyon::LayoutPresets::NameForFileType | ( | std::string_view | extension | ) | const |
The name of the layout files of that type open with; empty when none is set.
| const LayoutPreset * tachyon::LayoutPresets::ForFileType | ( | std::string_view | extension | ) | const |
The layout files of that type open with; null when none is set, or it's gone.
|
inline |
Each file type with a layout, as (extension, layout name), in the order set.
| std::string tachyon::LayoutPresets::ToJson | ( | ) | const |
The saved layouts and the file types as JSON text; the built-in ones aren't in it.
| bool tachyon::LayoutPresets::FromJson | ( | std::string_view | json | ) |
Takes the saved layouts and the file types from ToJson's text, in place of the ones there are; the built-in ones stay, and saved ones of their names are skipped.
False (nothing changes) when the text isn't a JSON object.