#include <xrb_widgetskin.hpp>
Classes | |
| struct | FontSpecification |
| struct | MarginsSpecification |
Public Types | |
| enum | WidgetBackgroundType { MODAL_WIDGET_BACKGROUND = 0, BUTTON_BACKGROUND, BUTTON_MOUSEOVER_BACKGROUND, BUTTON_PRESSED_BACKGROUND, LINE_EDIT_BACKGROUND, CHECK_BOX_BACKGROUND, RADIO_BUTTON_BACKGROUND, TOOLBAR_BUTTON_BACKGROUND, TOOLBAR_BUTTON_MOUSEOVER_BACKGROUND, TOOLBAR_BUTTON_CHECKED_BACKGROUND, TOOLBAR_BUTTON_PRESSED_BACKGROUND, WIDGET_BACKGROUND_TYPE_COUNT } |
| Enumerates all the different specific backgrounds a WidgetSkin stores. | |
| enum | FontType { DEFAULT_FONT = 0, FONT_TYPE_COUNT } |
| Enumerates all the different specific fonts a WidgetSkin stores. | |
| enum | TextureType { CHECK_BOX_CHECK_TEXTURE = 0, RADIO_BUTTON_CHECK_TEXTURE, TEXTURE_TYPE_COUNT } |
| Enumerates all the different specific textures a WidgetSkin stores. | |
| enum | MarginsType { DEFAULT_FRAME_MARGINS = 0, DEFAULT_CONTENT_MARGINS, LAYOUT_FRAME_MARGINS, LAYOUT_SPACING_MARGINS, MARGINS_TYPE_COUNT } |
| Enumerates all the different specific margin types a WidgetSkin stores. | |
Public Member Functions | |
| WidgetSkin (Screen const *screen) | |
| Constructs a WidgetSkin with a bunch of default values for now. | |
| ~WidgetSkin () | |
| Destructor. | |
| WidgetSkin * | CreateClone () const |
| Creates a newly instanced clone of this WidgetSkin object. | |
| Float | RatioFromScreenCoord (ScreenCoord screen_coord) const |
| Converts a screen coordinate size into a size-ratio-basis ratio, using the Screen object associated with this WidgetSkin. | |
| ScreenCoord | ScreenCoordFromRatio (Float ratio) const |
| Converts a size-ratio-basis ratio into a screen coordinate size, using the Screen object associated with this WidgetSkin. | |
| FloatVector2 | RatiosFromScreenCoords (ScreenCoordVector2 const &screen_coords) const |
| Converts a vector of screen coordinate sizes into a vector of size-ratio-basis ratios, using the Screen object associated with this WidgetSkin. | |
| ScreenCoordVector2 | ScreenCoordsFromRatios (FloatVector2 const &ratios) const |
| Converts a vector of size-ratio-basis ratios into a vector of screen coordinate sizes, using the Screen object associated with this WidgetSkin. | |
| WidgetBackground const * | GetWidgetBackground (WidgetBackgroundType const widget_background_type) const |
| Returns a pointer to the const WidgetBackground object of the requested type. | |
| Resource< Font > const & | GetFont (FontType const font_type) const |
| Returns the const resourced Font object of the requested type. | |
| Resource< GLTexture > const & | GetTexture (TextureType const texture_type) const |
| Returns the const resourced GLTexture object of the requested type. | |
| ScreenCoordVector2 const & | Margins (MarginsType const margins_type) const |
| Returns a screen coordinate vector containing the requested margins type. | |
| void | SetWidgetBackground (WidgetBackgroundType widget_background_type, WidgetBackground const *widget_background) |
| Sets the given type of widget background. | |
| void | SetFont (FontType font_type, Resource< Font > const &font) |
| Sets the given type of font. | |
| void | SetFontFacePath (FontType font_type, std::string const &font_face_path) |
| Sets the given type of font using the given font face. | |
| void | SetFontHeightRatio (FontType font_type, Float font_height_ratio) |
| Sets the screen size-ratio-basis height ratio of the specified font type. | |
| void | SetFontHeight (FontType font_type, ScreenCoord font_height) |
| Sets the pixel height of the specified font type. | |
| void | SetTexture (TextureType texture_type, Resource< GLTexture > const &texture) |
| Sets the given type of texture. | |
| void | SetTexturePath (TextureType texture_type, std::string const &texture_path) |
| Sets the given type of texture. | |
| void | SetMarginRatios (MarginsType margins_type, FloatVector2 const &margin_ratios) |
| Sets the screen size-ratio-basis margin ratios of the specified type. | |
| void | SetMargins (MarginsType margins_type, ScreenCoordVector2 const &margins) |
| Sets the pixel-based margins of the specified type. | |
Protected Member Functions | |
| WidgetSkin () | |
| This is used by CreateClone(). | |
See Widget Skinning for more details.
Definition at line 31 of file xrb_widgetskin.hpp.
| Xrb::WidgetSkin::WidgetSkin | ( | Screen const * | screen | ) |
Constructs a WidgetSkin with a bunch of default values for now.
This constructor needs to be replaced by a static Create() function which specifies some path of a widgetskin property descriptor file and the constructor should be made protected.
Definition at line 19 of file xrb_widgetskin.cpp.
References Xrb::Vector< Float, 2 >::ms_zero, SetFontFacePath(), SetMarginRatios(), and SetTexturePath().
| Xrb::WidgetSkin::~WidgetSkin | ( | ) |
Destructor.
Deletes all the widget backgrounds. The resourced properties will go out of scope and be automatically deleted here.
Definition at line 80 of file xrb_widgetskin.cpp.
References Xrb::Delete().
| Xrb::WidgetSkin::WidgetSkin | ( | ) | [inline, protected] |
This is used by CreateClone().
This should be deprecated once Create is made.
Definition at line 246 of file xrb_widgetskin.hpp.
| WidgetSkin * Xrb::WidgetSkin::CreateClone | ( | ) | const |
Creates a newly instanced clone of this WidgetSkin object.
The contents of this object are cloned as well.
Definition at line 86 of file xrb_widgetskin.cpp.
References Xrb::WidgetBackground::CreateClone(), m_font_specification, m_margins_specification, m_screen, m_texture, and m_widget_background.
| Float Xrb::WidgetSkin::RatioFromScreenCoord | ( | ScreenCoord | screen_coord | ) | const |
Converts a screen coordinate size into a size-ratio-basis ratio, using the Screen object associated with this WidgetSkin.
| screen_coord | The screen coordinate to convert. |
Definition at line 111 of file xrb_widgetskin.cpp.
Referenced by SetFont(), and SetFontHeight().
| ScreenCoord Xrb::WidgetSkin::ScreenCoordFromRatio | ( | Float | ratio | ) | const |
Converts a size-ratio-basis ratio into a screen coordinate size, using the Screen object associated with this WidgetSkin.
| ratio | The ratio to convert. |
Definition at line 118 of file xrb_widgetskin.cpp.
Referenced by SetFontFacePath(), and SetFontHeightRatio().
| FloatVector2 Xrb::WidgetSkin::RatiosFromScreenCoords | ( | ScreenCoordVector2 const & | screen_coords | ) | const |
Converts a vector of screen coordinate sizes into a vector of size-ratio-basis ratios, using the Screen object associated with this WidgetSkin.
| screen_coords | The screen coordinate vector to convert. |
Definition at line 125 of file xrb_widgetskin.cpp.
References Xrb::Vector< T, dimension >::StaticCast().
Referenced by SetMargins().
| ScreenCoordVector2 Xrb::WidgetSkin::ScreenCoordsFromRatios | ( | FloatVector2 const & | ratios | ) | const |
Converts a vector of size-ratio-basis ratios into a vector of screen coordinate sizes, using the Screen object associated with this WidgetSkin.
| ratios | The ratio vector to convert. |
Definition at line 134 of file xrb_widgetskin.cpp.
Referenced by SetMarginRatios().
| WidgetBackground const* Xrb::WidgetSkin::GetWidgetBackground | ( | WidgetBackgroundType const | widget_background_type | ) | const [inline] |
Returns a pointer to the const WidgetBackground object of the requested type.
| widget_background_type | The specific type of background to return. |
Definition at line 135 of file xrb_widgetskin.hpp.
Referenced by Xrb::WidgetSkinHandler::WidgetSkinWidgetBackground().
Returns the const resourced Font object of the requested type.
| font_type | The specific type of font to return. |
Definition at line 144 of file xrb_widgetskin.hpp.
Referenced by Xrb::WidgetSkinHandler::WidgetSkinFont().
| Resource<GLTexture> const& Xrb::WidgetSkin::GetTexture | ( | TextureType const | texture_type | ) | const [inline] |
Returns the const resourced GLTexture object of the requested type.
| texture_type | The specific type of texture to return. |
Definition at line 153 of file xrb_widgetskin.hpp.
Referenced by Xrb::WidgetSkinHandler::WidgetSkinTexture().
| ScreenCoordVector2 const& Xrb::WidgetSkin::Margins | ( | MarginsType const | margins_type | ) | const [inline] |
Returns a screen coordinate vector containing the requested margins type.
| margins_type | The specific type of margins to return. |
Definition at line 163 of file xrb_widgetskin.hpp.
Referenced by Xrb::WidgetSkinHandler::WidgetSkinMargins().
| void Xrb::WidgetSkin::SetWidgetBackground | ( | WidgetBackgroundType | widget_background_type, | |
| WidgetBackground const * | widget_background | |||
| ) |
Sets the given type of widget background.
The background being replaced is deleted, if it exists.
| widget_background_type | The background type to be set. | |
| widget_background | A pointer to the WidgetBackground to use. |
Definition at line 144 of file xrb_widgetskin.cpp.
Referenced by Xrb::WidgetSkinHandler::SetWidgetSkinWidgetBackground().
Sets the given type of font.
| font_type | The font type to be set. | |
| font | The resourced Font object to use. |
Definition at line 153 of file xrb_widgetskin.cpp.
References Xrb::Resource< T >::IsValid(), and RatioFromScreenCoord().
Referenced by Xrb::WidgetSkinHandler::SetWidgetSkinFont().
| void Xrb::WidgetSkin::SetFontFacePath | ( | FontType | font_type, | |
| std::string const & | font_face_path | |||
| ) |
Sets the given type of font using the given font face.
Uses the font pixel height from the previous font.
| font_type | The font type to change. | |
| font_face_path | The path to the font face to use. |
Definition at line 165 of file xrb_widgetskin.cpp.
References Xrb::ResourceLibrary::LoadPath(), Xrb::Singleton::ResourceLibrary(), and ScreenCoordFromRatio().
Referenced by Xrb::WidgetSkinHandler::SetWidgetSkinFontFacePath(), and WidgetSkin().
| void Xrb::WidgetSkin::SetFontHeightRatio | ( | FontType | font_type, | |
| Float | font_height_ratio | |||
| ) |
Sets the screen size-ratio-basis height ratio of the specified font type.
Does not change the given type's existing font face.
| font_type | The font type to be changed. | |
| font_height_ratio | The height ratio to set. |
Definition at line 182 of file xrb_widgetskin.cpp.
References Xrb::ResourceLibrary::LoadPath(), Xrb::Singleton::ResourceLibrary(), and ScreenCoordFromRatio().
Referenced by Xrb::WidgetSkinHandler::SetWidgetSkinFontHeightRatio().
| void Xrb::WidgetSkin::SetFontHeight | ( | FontType | font_type, | |
| ScreenCoord | font_height | |||
| ) |
Sets the pixel height of the specified font type.
Does not change the given type's existing font face.
| font_type | The font type to be changed. | |
| font_height | The pixel height to be set. |
Definition at line 199 of file xrb_widgetskin.cpp.
References Xrb::ResourceLibrary::LoadPath(), RatioFromScreenCoord(), and Xrb::Singleton::ResourceLibrary().
Referenced by Xrb::WidgetSkinHandler::SetWidgetSkinFontHeight().
| void Xrb::WidgetSkin::SetTexture | ( | TextureType | texture_type, | |
| Resource< GLTexture > const & | texture | |||
| ) |
Sets the given type of texture.
| texture_type | The texture type to be set. | |
| texture | The resourced GLTexture object to use. |
Definition at line 216 of file xrb_widgetskin.cpp.
Referenced by Xrb::WidgetSkinHandler::SetWidgetSkinTexture().
| void Xrb::WidgetSkin::SetTexturePath | ( | TextureType | texture_type, | |
| std::string const & | texture_path | |||
| ) |
Sets the given type of texture.
| texture_type | The texture type to be set. | |
| texture | The path of the texture to use. |
Definition at line 224 of file xrb_widgetskin.cpp.
References Xrb::GLTexture::Create(), Xrb::ResourceLibrary::LoadPath(), and Xrb::Singleton::ResourceLibrary().
Referenced by Xrb::WidgetSkinHandler::SetWidgetSkinTexturePath(), and WidgetSkin().
| void Xrb::WidgetSkin::SetMarginRatios | ( | MarginsType | margins_type, | |
| FloatVector2 const & | margin_ratios | |||
| ) |
Sets the screen size-ratio-basis margin ratios of the specified type.
| margins_type | The type of margins to change. | |
| margin_ratios | The margin ratios to be set. |
Definition at line 235 of file xrb_widgetskin.cpp.
References ScreenCoordsFromRatios(), Xrb::Dim::X, and Xrb::Dim::Y.
Referenced by Xrb::WidgetSkinHandler::SetWidgetSkinMarginRatios(), and WidgetSkin().
| void Xrb::WidgetSkin::SetMargins | ( | MarginsType | margins_type, | |
| ScreenCoordVector2 const & | margins | |||
| ) |
Sets the pixel-based margins of the specified type.
| margins_type | The type of margins to change. | |
| margin | The margin sizes to be set. |
Definition at line 247 of file xrb_widgetskin.cpp.
References RatiosFromScreenCoords(), Xrb::Dim::X, and Xrb::Dim::Y.
Referenced by Xrb::WidgetSkinHandler::SetWidgetSkinMargins().
1.5.8