Lumiera
0.pre.03
»edit your freedom«
|
#include "stage/workspace/ui-style.hpp"
Manage global concerns regarding a coherent user interface.
Offers access to some global UI resources, and establishes further global services to create workspace windows, to bind menu / command actions and to enter the top-level model parts.
Definition at line 63 of file ui-style.hpp.
Public Member Functions | |
UiStyle () | |
Set up a coherent theming and styling for the application. More... | |
void | prepareStyleContext (timeline::TimelineWidget const &) |
Use the existing TimelineWidget's GTK-WidgetPath to establish a systematic CSS styling context, which can be used for theming and styling of Lumiera's custom UI elements within the timeline display. More... | |
void | setTheme (string const &stylesheetName) |
Sets the theme to use for the Lumiera GUI. More... | |
Static Public Member Functions | |
static Cairo::RefPtr< Cairo::SolidPattern > | readStyleColourProperty (Gtk::Widget &widget, const gchar *property_name, guint16 red, guint16 green, guint16 blue) |
A utility function which reads a colour style from the GTK Style. More... | |
Static Public Attributes | |
static Gtk::IconSize | GiantIconSize = Gtk::ICON_SIZE_INVALID |
The registered icon size for giant 48x48 px icons. More... | |
static Gtk::IconSize | MenuIconSize = Gtk::ICON_SIZE_INVALID |
The registered icon size for giant 16x16 px icons. More... | |
Private Member Functions | |
bool | addNonThemeIconSource (Glib::RefPtr< Gtk::IconSet > const &icon_set, cuString &base_dir, cuString &icon_name, Gtk::IconSize size, bool wildcard) |
Loads an icon from a non theme set. More... | |
bool | addStockIcon (Glib::RefPtr< Gtk::IconSet > const &icon_set, cuString &icon_name, Gtk::IconSize size, bool wildcard) |
Loads an icon, searching standard icon locations, and adds it to an icon set. More... | |
bool | addStockIconFromPath (string path, Glib::RefPtr< Gtk::IconSet > const &icon_set, Gtk::IconSize size, bool wildcard) |
Loads an icon from a specific path and adds it to an icon set. More... | |
bool | addStockIconSet (Glib::RefPtr< Gtk::IconFactory > const &factory, Literal iconName, Literal id, Literal label) |
Adds an icon (in different sizes) to the icon factory. More... | |
bool | addThemeIconSource (Glib::RefPtr< Gtk::IconSet > const &icon_set, cuString &icon_name, Gtk::IconSize size, bool wildcard) |
Loads an icon from a the icon theme. More... | |
void | registerAppIconSizes () |
void | registerStockItems () |
Registers application stock items: icons and labels associated with IDs. | |
Private Member Functions inherited from NonCopyable | |
NonCopyable (NonCopyable const &)=delete | |
NonCopyable & | operator= (NonCopyable const &)=delete |
Private Attributes | |
string | iconSearchPath_ |
string | resourceSerachPath_ |
StyleAdvice | styleAdviceTrackBody_ |
StyleAdvice | styleAdviceTrackRuler_ |
UiStyle | ( | ) |
Set up a coherent theming and styling for the application.
Based on the Gtk::UIManager, the UiStyle service allows to access some style related resources, but mostly its task is to configure the GTK toolkit appropriately during startup.
Initialise the theme and style related global properties of the UI. Register the icon configuration and sizes and lookup all standard icons – either from the default theme of via the given Lumiera icon search paths, typically from setup.ini
.
Definition at line 59 of file ui-style.cpp.
References Config::get(), UiStyle::registerStockItems(), and UiStyle::setTheme().
void setTheme | ( | string const & | stylesheetName | ) |
Sets the theme to use for the Lumiera GUI.
stylesheetName | GTK CSS stylesheet to load from the resourceSearchPath_ |
error::Config | if this stylesheet can't be resolved on the searchpath |
Definition at line 77 of file ui-style.cpp.
References cStr(), and lib::resolveModulePath().
Referenced by UiStyle::UiStyle().
void prepareStyleContext | ( | timeline::TimelineWidget const & | timeline | ) |
Use the existing TimelineWidget's GTK-WidgetPath to establish a systematic CSS styling context, which can be used for theming and styling of Lumiera's custom UI elements within the timeline display.
Especially, this allows us to anchor those custom elements at a dedicated point in the hierarchy, the way it is visible for CSS selectors. Thus, either standard CSS rules and inheritance take effect on our custom elements, or the GTK stylesheet may add dedicated style rules for elements within the timeline display, most notably the system of nested scopes in the track fork and the display of clips and overlays.
Especially the following selector path can be used
paned.timeline__page > timeline__body > fork.timeline__fork
lumiera.css
)gtk_widget_path_append_for_widget()
in in GTK 3.x, gtkwidget.c, line 16413 Definition at line 117 of file ui-style.cpp.
|
static |
A utility function which reads a colour style from the GTK Style.
widget | The widget to load the style out of. |
property_name | The name of the style property to load. |
red | The fallback red intensity. |
green | The fallback green intensity. |
blue | The fallback blue intensity. |
Definition at line 149 of file ui-style.cpp.
|
private |
Adds an icon (in different sizes) to the icon factory.
factory | The factory to add the icon to. |
icon_name | The file name of the icon to add. |
id | The id name of the icon. |
label | The user readable icon name for this icon. |
true
if the icon was successfully loaded, returns false
otherwise. Definition at line 224 of file ui-style.cpp.
References UiStyle::addStockIcon(), UiStyle::GiantIconSize, and UiStyle::MenuIconSize.
Referenced by UiStyle::registerStockItems().
|
private |
Loads an icon, searching standard icon locations, and adds it to an icon set.
icon_set | The icon set to add the icon to. |
icon_name | The file name of the icon to load. |
size | The size of the icon to load. |
wildcard | true if this icon is to be wildcarded. |
true
if the icon was loaded successfully. Definition at line 257 of file ui-style.cpp.
References UiStyle::addNonThemeIconSource(), and UiStyle::addThemeIconSource().
Referenced by UiStyle::addStockIconSet().
|
private |
Loads an icon from a the icon theme.
icon_set | The icon set to add the icon to. |
icon_name | The name of the icon to load. |
size | The size of the icon to load. |
wildcard | true if this icon is to be wildcarded. |
true
if the icon was loaded successfully. Definition at line 281 of file ui-style.cpp.
References UiStyle::addStockIconFromPath().
Referenced by UiStyle::addStockIcon().
|
private |
Loads an icon from a non theme set.
icon_set | The icon set to add the icon to. |
base_dir | The root icons directory to load from. |
icon_name | The file name of the icon to load. |
size | The size of the icon to load. |
wildcard | true if this icon is to be wildcarded. |
true
if the icon was loaded successfully. Definition at line 307 of file ui-style.cpp.
References UiStyle::addStockIconFromPath().
Referenced by UiStyle::addStockIcon().
|
private |
Loads an icon from a specific path and adds it to an icon set.
path | The path to load from. |
icon_set | The icon set to add the icon to. |
size | The size of the icon to load. |
wildcard | true if this icon is to be wildcarded. |
true
if the icon was loaded successfully. Definition at line 327 of file ui-style.cpp.
Referenced by UiStyle::addNonThemeIconSource(), and UiStyle::addThemeIconSource().
|
static |
The registered icon size for giant 48x48 px icons.
Definition at line 80 of file ui-style.hpp.
Referenced by UiStyle::addStockIconSet().
|
static |
The registered icon size for giant 16x16 px icons.
Definition at line 86 of file ui-style.hpp.
Referenced by UiStyle::addStockIconSet().