sptk2 logo
SPTK Home Page
Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Protected Member Functions | Static Protected Attributes | Friends | List of all members
sptk::CThemes Class Reference

Widget themes. More...

#include <CThemes.h>

Inheritance diagram for sptk::CThemes:
sptk::CThemeScrollBar

Public Member Functions

 CThemes ()
 
 ~CThemes ()
 

Static Public Member Functions

static void set (std::string themeName)
 
static CIcongetIcon (const String &iconName, CIconSize iconSize)
 Returns a button icon by symbolic name. More...
 
static CPngImagegetIconImage (const String &iconName, CIconSize iconSize)
 Returns a button icon image by symbolic name. More...
 
static void registerIcon (CIcon *icon, CIconSize iconSize)
 Registers a new button icon. More...
 
static void drawFlatBox (int x, int y, int w, int h, Fl_Color clr)
 
static void drawThinUpBox (int x, int y, int w, int h, Fl_Color clr)
 
static void drawUpBox (int x, int y, int w, int h, Fl_Color clr)
 
static void drawThinDownBox (int x, int y, int w, int h, Fl_Color clr)
 
static void drawDownBox (int x, int y, int w, int h, Fl_Color clr)
 
static void drawThinUpFrame (int x, int y, int w, int h, Fl_Color clr)
 
static void drawUpFrame (int x, int y, int w, int h, Fl_Color clr)
 
static void drawThinDownFrame (int x, int y, int w, int h, Fl_Color clr)
 
static void drawDownFrame (int x, int y, int w, int h, Fl_Color clr)
 
static bool drawButton (CThemeButtonType sz, int x, int y, int &w, int &h, bool highlited, bool pressed, bool defaultButton)
 
static bool sizeButton (CThemeButtonType sz, int &w, int &h)
 
static bool sizeProgressBar (int &w, int &h)
 
static int buttonFocusRadius ()
 
static bool drawCheckButton (int x, int y, bool checked, bool highlited)
 
static bool drawRadioButton (int x, int y, bool checked, bool highlited)
 
static bool drawProgressBar (int x, int y, int w, float percent)
 
static bool drawTab (int x, int y, int w, int h, bool active)
 Draws a tab. More...
 
static bool drawTabFrame (int x, int y, int w, int h)
 Draws a tab frame. More...
 
static Strings availableThemes ()
 
static const StringssearchDirectories ()
 Themes root directories. More...
 
static std::string name ()
 Returns theme name.
 
static std::string themeFolder ()
 Returns path to the theme folder.
 
- Static Public Member Functions inherited from sptk::CThemeScrollBar
static void loadGtkScrollbarButtons (xdoc::Document &xml, const String &orientation, CThemeImageCollection &buttonImages)
 Loads GTK theme scrollbar button images from 'style' node. More...
 
static void loadGtkScrollbarTroughs (xdoc::Document &xml)
 Loads GTK theme scrollbar troughs. More...
 
static void loadGtkScrollbarSliders (xdoc::Document &xml)
 Loads GTK theme scrollbar sliders. More...
 
static void loadGtkScrollbars (xdoc::Document &xml)
 Loads GTK theme scrollbar button images from GTK theme. More...
 
static bool sizeScrollBar (int &w, int &h)
 Computes and returns the minimum size of the scroll bar. More...
 
static bool drawScrollBar (int x, int y, int w, int h, float minimum, float maximum, float value, float size, int activeZone, bool active)
 Draws a scroll bar image. More...
 

Static Public Attributes

static CFontsVector screenFonts
 All the available screen fonts.
 
static Tar m_tar
 Theme tar archive. Contains all the theme data.
 
- Static Public Attributes inherited from sptk::CThemeScrollBar
static CScrollBarImages m_scrollBar [2]
 Images for painting a scroll bar (horizontal and vertical) More...
 
static int m_scrollBarTroughBorder
 
static int m_scrollBarSliderWidth
 
static int m_scrollBarStepperSize
 

Static Protected Member Functions

static void loadGtkButton (const xdoc::SNode &imageNode, std::map< CThemeImageState, std::string > &buttonFileNames)
 Loads GTK theme button file name from 'image' node, and stores it into the map. More...
 
static void loadGtkButtonFileNames (xdoc::Document &xml, std::string XPath, std::map< CThemeImageState, std::string > &fileNames, std::string orientation="")
 Loads GTK theme button file names from XPath. More...
 
static void loadGtkButtons (xdoc::Document &xml, const String &styleName, CThemeImageCollection &buttons, const String &function)
 Loads GTK theme button images from 'style' node. More...
 
static void loadGtkTheme (const String &gtkThemeName)
 Loads current Gnome GTK theme. More...
 

Static Protected Attributes

static CIconMap m_icons [4]
 

Friends

class CBaseButton
 

Detailed Description

Widget themes.

Class CThemes is a static loader for the themes. Only one one instance of the class should exist, and it's created automatically. The class allows to load a set of routines to draw the particular elements of the interface, and the images for these routines.

Constructor & Destructor Documentation

◆ CThemes()

sptk::CThemes::CThemes ( )

Default constructor

◆ ~CThemes()

sptk::CThemes::~CThemes ( )

Destructor

Member Function Documentation

◆ availableThemes()

static Strings sptk::CThemes::availableThemes ( )
static

Returns the list of the available themes

◆ buttonFocusRadius()

static int sptk::CThemes::buttonFocusRadius ( )
static

Returns the button focuse corner radius

◆ drawButton()

static bool sptk::CThemes::drawButton ( CThemeButtonType  sz,
int  x,
int  y,
int &  w,
int &  h,
bool  highlited,
bool  pressed,
bool  defaultButton 
)
static

The rountine to draw theme button

Parameters
szCThemeButtonType,
xint, button x-coordinate
yint, button y-coordinate
wint&, button width, may be altered by button to meet the button size requirements
hint&, button height, may be altered by button to meet the button size requirements
highlitedbool, true to draw the highlighted button
pressedbool, true to draw pressed button
defaultButtonbool, true to draw default button

◆ drawCheckButton()

static bool sptk::CThemes::drawCheckButton ( int  x,
int  y,
bool  checked,
bool  highlited 
)
static

Draws a check button image

Returns
false, if theme has no pixmap for the button, or true otherwise
Parameters
xint, x-coordinate of the button
yint, y-coordinate of the button
checkedbool, is button checked?
highlitedbool, is button highlited?

◆ drawDownBox()

static void sptk::CThemes::drawDownBox ( int  x,
int  y,
int  w,
int  h,
Fl_Color  clr 
)
static

The replacement rountine to draw FL_DOWN_BOX

◆ drawDownFrame()

static void sptk::CThemes::drawDownFrame ( int  x,
int  y,
int  w,
int  h,
Fl_Color  clr 
)
static

The replacement rountine to draw FL_DOWN_FRAME

◆ drawFlatBox()

static void sptk::CThemes::drawFlatBox ( int  x,
int  y,
int  w,
int  h,
Fl_Color  clr 
)
static

The replacement rountine to draw FL_FLAT_BOX

◆ drawProgressBar()

static bool sptk::CThemes::drawProgressBar ( int  x,
int  y,
int  w,
float  percent 
)
static

Draws a progress bar image The height of the image is defined by the 'progress0.png' image of the theme. The width of the image is adjusted as required, but it can't be less than returned by sizeProgressBar() method.

Returns
false, if theme has no pixmaps for the progress bar, or true otherwise
Parameters
xint, x-coordinate of the progress bar
yint, y-coordinate of the progress bar
wint, width of the progress bar
percentfloat, percent value of the progress bar

◆ drawRadioButton()

static bool sptk::CThemes::drawRadioButton ( int  x,
int  y,
bool  checked,
bool  highlited 
)
static

Draws a radio button image

Returns
false, if theme has no pixmap for the button, or true otherwise
Parameters
xint, x-coordinate of the button
yint, y-coordinate of the button
checkedbool, is button checked?
highlitedbool, is button highlited?

◆ drawTab()

static bool sptk::CThemes::drawTab ( int  x,
int  y,
int  w,
int  h,
bool  active 
)
static

Draws a tab.

Returns
false, if theme has no pixmaps for the tab, or true otherwise
Parameters
xint, x-coordinate of the scroll bar
yint, y-coordinate of the scroll bar
wint, width of the scroll bar
hint, width of the scroll bar
activebool, true if stab is active

◆ drawTabFrame()

static bool sptk::CThemes::drawTabFrame ( int  x,
int  y,
int  w,
int  h 
)
static

Draws a tab frame.

Draws a bottom frame for the tabs

Returns
false, if theme has no pixmaps for the tab frame, or true otherwise
Parameters
xint, x-coordinate of the scroll bar
yint, y-coordinate of the scroll bar
wint, width of the scroll bar
hint, width of the scroll bar

◆ drawThinDownBox()

static void sptk::CThemes::drawThinDownBox ( int  x,
int  y,
int  w,
int  h,
Fl_Color  clr 
)
static

The replacement rountine to draw FL_THIN_DOWN_BOX

◆ drawThinDownFrame()

static void sptk::CThemes::drawThinDownFrame ( int  x,
int  y,
int  w,
int  h,
Fl_Color  clr 
)
static

The replacement rountine to draw FL_THIN_DOWN_FRAME

◆ drawThinUpBox()

static void sptk::CThemes::drawThinUpBox ( int  x,
int  y,
int  w,
int  h,
Fl_Color  clr 
)
static

The replacement rountine to draw FL_THIN_UP_BOX

◆ drawThinUpFrame()

static void sptk::CThemes::drawThinUpFrame ( int  x,
int  y,
int  w,
int  h,
Fl_Color  clr 
)
static

The replacement rountine to draw FL_THIN_UP_FRAME

◆ drawUpBox()

static void sptk::CThemes::drawUpBox ( int  x,
int  y,
int  w,
int  h,
Fl_Color  clr 
)
static

The replacement rountine to draw FL_UP_BOX

◆ drawUpFrame()

static void sptk::CThemes::drawUpFrame ( int  x,
int  y,
int  w,
int  h,
Fl_Color  clr 
)
static

The replacement rountine to draw FL_UP_FRAME

◆ getIcon()

static CIcon * sptk::CThemes::getIcon ( const String iconName,
CIconSize  iconSize 
)
static

Returns a button icon by symbolic name.

Parameters
iconNamestring, symbolic name for an icons
iconSizeCIconSize, the size of the icon
Returns
pointer to the icon, or NULL if not found

◆ getIconImage()

static CPngImage * sptk::CThemes::getIconImage ( const String iconName,
CIconSize  iconSize 
)
static

Returns a button icon image by symbolic name.

Parameters
iconNamestring, symbolic name for an icons
iconSizeCIconSize, the size of the icon
Returns
pointer to the image, or NULL if not found

◆ loadGtkButton()

static void sptk::CThemes::loadGtkButton ( const xdoc::SNode &  imageNode,
std::map< CThemeImageState, std::string > &  buttonFileNames 
)
staticprotected

Loads GTK theme button file name from 'image' node, and stores it into the map.

Parameters
imageNodexml::Node*, an image node from GTK theme description
buttonFileNamesstd::map<CThemeImageState,std::string>&, file names for buttons

◆ loadGtkButtonFileNames()

static void sptk::CThemes::loadGtkButtonFileNames ( xdoc::Document xml,
std::string  XPath,
std::map< CThemeImageState, std::string > &  fileNames,
std::string  orientation = "" 
)
staticprotected

Loads GTK theme button file names from XPath.

Parameters
xmlxml::Document&, GTK theme converted to XML
XPathstd::string, XPath to button images
fileNamesstd::map<CThemeImageState,std::string>&, file names for buttons
orientationstd::string, optional orientation (used for scrollbar elements)

◆ loadGtkButtons()

static void sptk::CThemes::loadGtkButtons ( xdoc::Document xml,
const String styleName,
CThemeImageCollection buttons,
const String function 
)
staticprotected

Loads GTK theme button images from 'style' node.

Parameters
xmlxml::Document&, GTK theme converted to XML
styleNamestd::string, image style name ("button", "checkbutton", etc)
buttonsCThemeImageCollection&, set of images for the button type
functionstd::string, function ("BOX", CHECK", "OPTION", etc)

◆ loadGtkTheme()

static void sptk::CThemes::loadGtkTheme ( const String gtkThemeName)
staticprotected

Loads current Gnome GTK theme.

The GTK theme name is read from .gconf directory.

Parameters
gtkThemeNamestd::string, GTK2 theme name

◆ registerIcon()

static void sptk::CThemes::registerIcon ( CIcon icon,
CIconSize  iconSize 
)
static

Registers a new button icon.

Parameters
iconCIcon*, pointer to the icon
iconSizeCIconSize, the size of the icon

◆ searchDirectories()

static const Strings & sptk::CThemes::searchDirectories ( )
static

Themes root directories.

On different system it may be a different set of directories. The first available correct combination of theme directory and theme name defines the theme directory

◆ set()

static void sptk::CThemes::set ( std::string  themeName)
static

Loads and sets the theme. The themeName is the directory with the theme images.

◆ sizeButton()

static bool sptk::CThemes::sizeButton ( CThemeButtonType  sz,
int &  w,
int &  h 
)
static

Computes and returns the correct size of the button in the parameters.

Parameters
szCThemeButtonType, the general type of the button.
See also
CThemeButtonType for possible button types.
Parameters
wint&, button width, may be altered by button to meet the button size requirements
hint&, button height, may be altered by button to meet the button size requirements
Returns
false, if theme has no pixmap for the button, or true otherwise

◆ sizeProgressBar()

static bool sptk::CThemes::sizeProgressBar ( int &  w,
int &  h 
)
static

Computes and returns the minimum size of the progress bar

Parameters
wint&, progress bar width, may be altered by progress bar to meet the progress bar size requirements
hint&, progress bar height, may be altered by progress bar to meet the progress bar size requirements
Returns
false, if theme has no pixmap for the progress bar, or true otherwise

Member Data Documentation

◆ m_icons

CIconMap sptk::CThemes::m_icons[4]
staticprotected

Icons for use with buttons (four different sizes available,

See also
CIconSize)

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

Fri Oct 14 2022 09:58:40: SPTK 5.4.1