Lumiera  0.pre.03
»edityourfreedom«
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
StyleManager Class Reference

#include "gui/workspace/style-manager.hpp"

Description

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 65 of file style-manager.hpp.

Public Member Functions

 StyleManager ()
 There is one global UiManager instance, which is created by the Application and allows access to the UI-Bus backbone. 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
 The registered icon size for giant 48x48 px icons. More...
 
static Gtk::IconSize MenuIconSize
 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, cuString &icon_name, cuString &id, cuString &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. More...
 
- Private Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (NonCopyable const &)=delete
 
 ~NonCopyable ()=default
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Private Attributes

string iconSearchPath_
 
string resourceSerachPath_
 

Constructor & Destructor Documentation

There is one global UiManager instance, which is created by the Application and allows access to the UI-Bus backbone.

Initialise the theme and style related global properties of the UI.

The UiManager itself is not a ctrl::Controller, and thus not directly connected to the Bus. Rather, supports the top-level windows for creating a consistent interface.

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.

See also
lumiera::Config

Definition at line 67 of file style-manager.cpp.

References Config::get(), and gui::KEY_ICON_PATH.

+ Here is the call graph for this function:

Member Function Documentation

void setTheme ( string const &  stylesheetName)

Sets the theme to use for the Lumiera GUI.

Parameters
stylesheetNameGTK CSS stylesheet to load from the resourceSearchPath_
Exceptions
error::Configif this stylesheet can't be resolved on the searchpath
See also
#init
lumiera::Config

Definition at line 83 of file style-manager.cpp.

References util::cStr(), lib::resolveModulePath(), and StyleManager::resourceSerachPath_.

+ Here is the call graph for this function:

Cairo::RefPtr< Cairo::SolidPattern > readStyleColourProperty ( Gtk::Widget &  widget,
const gchar *  property_name,
guint16  red,
guint16  green,
guint16  blue 
)
static

A utility function which reads a colour style from the GTK Style.

Parameters
widgetThe widget to load the style out of.
property_nameThe name of the style property to load.
redThe fallback red intensity.
greenThe fallback green intensity.
blueThe fallback blue intensity.
Returns
The loaded colour.

Definition at line 105 of file style-manager.cpp.

References NULL, and pattern.

Referenced by TimelineBody::read_styles(), and TimelineRuler::read_styles().

+ Here is the caller graph for this function:

void registerAppIconSizes ( )
private

Definition at line 135 of file style-manager.cpp.

References StyleManager::GiantIconSize, and StyleManager::MenuIconSize.

void registerStockItems ( )
private

Registers application stock items: icons and labels associated with IDs.

Definition at line 149 of file style-manager.cpp.

References _, and StyleManager::addStockIconSet().

+ Here is the call graph for this function:

bool addStockIconSet ( Glib::RefPtr< Gtk::IconFactory > const &  factory,
cuString icon_name,
cuString id,
cuString label 
)
private

Adds an icon (in different sizes) to the icon factory.

Parameters
factoryThe factory to add the icon to.
icon_nameThe file name of the icon to add.
idThe id name of the icon.
labelThe user readable icon name for this icon.
Returns
true if the icon was successfully loaded, returns false otherwise.

Definition at line 174 of file style-manager.cpp.

References StyleManager::addStockIcon(), util::cStr(), StyleManager::GiantIconSize, and StyleManager::MenuIconSize.

Referenced by StyleManager::registerStockItems().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool addStockIcon ( Glib::RefPtr< Gtk::IconSet > const &  icon_set,
cuString icon_name,
Gtk::IconSize  size,
bool  wildcard 
)
private

Loads an icon, searching standard icon locations, and adds it to an icon set.

Parameters
icon_setThe icon set to add the icon to.
icon_nameThe file name of the icon to load.
sizeThe size of the icon to load.
wildcardtrue if this icon is to be wildcarded.
Returns
true if the icon was loaded successfully.

Definition at line 210 of file style-manager.cpp.

References StyleManager::addNonThemeIconSource(), StyleManager::addThemeIconSource(), StyleManager::iconSearchPath_, and SearchPathSplitter::next().

Referenced by StyleManager::addStockIconSet().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool addThemeIconSource ( Glib::RefPtr< Gtk::IconSet > const &  icon_set,
cuString icon_name,
Gtk::IconSize  size,
bool  wildcard 
)
private

Loads an icon from a the icon theme.

Parameters
icon_setThe icon set to add the icon to.
icon_nameThe name of the icon to load.
sizeThe size of the icon to load.
wildcardtrue if this icon is to be wildcarded.
Returns
true if the icon was loaded successfully.

Definition at line 234 of file style-manager.cpp.

References StyleManager::addStockIconFromPath().

Referenced by StyleManager::addStockIcon().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool addNonThemeIconSource ( Glib::RefPtr< Gtk::IconSet > const &  icon_set,
cuString base_dir,
cuString icon_name,
Gtk::IconSize  size,
bool  wildcard 
)
private

Loads an icon from a non theme set.

Parameters
icon_setThe icon set to add the icon to.
base_dirThe root icons directory to load from.
icon_nameThe file name of the icon to load.
sizeThe size of the icon to load.
wildcardtrue if this icon is to be wildcarded.
Returns
true if the icon was loaded successfully.

Definition at line 260 of file style-manager.cpp.

References StyleManager::addStockIconFromPath().

Referenced by StyleManager::addStockIcon().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool addStockIconFromPath ( string  path,
Glib::RefPtr< Gtk::IconSet > const &  icon_set,
Gtk::IconSize  size,
bool  wildcard 
)
private

Loads an icon from a specific path and adds it to an icon set.

Parameters
pathThe path to load from.
icon_setThe icon set to add the icon to.
sizeThe size of the icon to load.
wildcardtrue if this icon is to be wildcarded.
Returns
true if the icon was loaded successfully.

Definition at line 280 of file style-manager.cpp.

References util::cStr(), and BuilderDoxygen::exists().

Referenced by StyleManager::addNonThemeIconSource(), and StyleManager::addThemeIconSource().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

string iconSearchPath_
private

Definition at line 70 of file style-manager.hpp.

Referenced by StyleManager::addStockIcon().

string resourceSerachPath_
private

Definition at line 71 of file style-manager.hpp.

Referenced by StyleManager::setTheme().

IconSize GiantIconSize
static

The registered icon size for giant 48x48 px icons.

Remarks
This value is set to BuiltinIconSize::ICON_SIZE_INVALID until register_giant_icon_size is called.

Definition at line 79 of file style-manager.hpp.

Referenced by StyleManager::addStockIconSet(), and StyleManager::registerAppIconSizes().

IconSize MenuIconSize
static

The registered icon size for giant 16x16 px icons.

Remarks
This value is set to BuiltinIconSize::ICON_SIZE_INVALID until register_app_icon_sizes is called.

Definition at line 85 of file style-manager.hpp.

Referenced by StyleManager::addStockIconSet(), StyleManager::registerAppIconSizes(), Track::updateEnableButton(), and Track::updateLockButton().

+ Inheritance diagram for StyleManager:
+ Collaboration diagram for StyleManager:

The documentation for this class was generated from the following files: