Singleton that manages fonts and styles.
More...
|
GUI_font * | CreateFont (int height, string face, bool proportional, GUI_FONT _id, GUI_COLOR _color, GUI_COLOR _bgcolor, GUI_COLOR _hilightcolor=GUI_COLOR(0, 0, 0), GUI_COLOR _hilightbg=GUI_COLOR(0, 0, 0), FontStyle style=FONT_NORMAL, string styleset="default") |
| Creates a font and adds it to a styleset. More...
|
|
GUI_ElementStyle * | CreateStyle (GUI_STYLE styleId, GUI_STYLE inherit_from=STYLE_DEFAULT, string styleset="default") |
| Creates a new style and adds it to a styleset. More...
|
|
void | createFonts () |
| Creates all the fonts. Currently all of them hardcoded. More...
|
|
void | createStyles () |
| Creates all the styles. Currently all hardcoded. More...
|
|
void | createStyleSet (string name) |
|
Singleton that manages fonts and styles.
Fonts and the Styles are not handled by a GUImanager because a GUImanager exists as one instance per vessel, while this data is global for the entire simulation.
- See also
- FontsAndStyles.h
GUI_font * FontsAndStyles::CreateFont |
( |
int |
height, |
|
|
string |
face, |
|
|
bool |
proportional, |
|
|
GUI_FONT |
_id, |
|
|
GUI_COLOR |
_color, |
|
|
GUI_COLOR |
_bgcolor, |
|
|
GUI_COLOR |
_hilightcolor = GUI_COLOR(0, 0, 0) , |
|
|
GUI_COLOR |
_hilightbg = GUI_COLOR(0, 0, 0) , |
|
|
FontStyle |
style = FONT_NORMAL , |
|
|
string |
styleset = "default" |
|
) |
| |
|
private |
Creates a font and adds it to a styleset.
- Parameters
-
height | The desired font height (size) in pixel |
face | The typeface name of the font (e.g. "Arial") |
proportional | Flag for proportional/fixed pitch font (not sure what that means, it's a sketchpad option) |
_id | identifier for this font |
_color | The text color of the font |
_bgcolor | The color of the background the font is drawn on (as we can't do color key blitting!) |
_hilightcolor | An alternate color in which the font should appear when hilighted. if not defined, no hilight font will be created |
_hilightbg | An alternate background color for the highlighted font. If undefined, the normal background color will be used |
style | font decoration style (bold, italic, underlined etc) |
styleset | The styleset this font is a part of |
- Note
- See orbiter api reference of oapiCreateFont() for more explanation on height, face, proportional and style, as these arguments will be passed unaltered to sketchpad to draw the font.
void FontsAndStyles::createFonts |
( |
| ) |
|
|
private |
Creates all the fonts. Currently all of them hardcoded.
- Todo:
- replace this with a parser
Creates a new style and adds it to a styleset.
Set the style properties after creation.
- Parameters
-
styleId | The identifier of the style |
inherit_from | The created style will inherit all properties from this style. Pass STYLE_NONE if you don't have a style to inherit from |
styleset | The styleset this style should be added to. |
void FontsAndStyles::createStyles |
( |
| ) |
|
|
private |
Creates all the styles. Currently all hardcoded.
- Todo:
- Replace this with a parser
void FontsAndStyles::createStyleSet |
( |
string |
name | ) |
|
|
private |
Creates a new StyleSet
- Parameters
-
name | The name of the styleset. Must be unique! |
void FontsAndStyles::DestroyInstance |
( |
| ) |
|
|
static |
Destroys the instance of the singleton.
This is not ideal, because a singleton should not actually be deleted from the outside. However, since Orbiter doesn't really terminate between sessions, we need to deallocate it none the less. This method should only be called from SimExit()!! Any pointer to a font or a style will point to Nirvana after calling this function!
- Returns
- The desired font
- Parameters
-
fontid | The id identifying the font |
styleset | The styleset the font should be taken from |
- Returns
- The instance of the singleton
- Returns
- The desired style
- Parameters
-
styleId | The identifier of the desired style |
styleset | The styleset the style should be taken from |
The documentation for this class was generated from the following files:
- C:/Orbiter2016/Orbitersdk/IMS2/FontsAndStyles.h
- C:/Orbiter2016/Orbitersdk/IMS2/FontsAndStyles.cpp