Hasty Badger
Small UI library (a branch of Turbo Badger)
 All Classes Namespaces Functions Variables Enumerations Enumerator Friends Groups Pages
tb::TBSkinElement Class Reference

Skin element. More...

#include <tb_skin.h>

Public Member Functions

int GetMinWidth () const
 Get the minimum width, or SKIN_VALUE_NOT_SPECIFIED if not specified. More...
 
int GetMinHeight () const
 Get the minimum height, or SKIN_VALUE_NOT_SPECIFIED if not specified. More...
 
int GetIntrinsicMinWidth () const
 Get the intrinsic minimum width. More...
 
int GetIntrinsicMinHeight () const
 Get the intrinsic minimum height. More...
 
int GetMaxWidth () const
 Get the maximum width, or SKIN_VALUE_NOT_SPECIFIED if not specified. More...
 
int GetMaxHeight () const
 Get the maximum height, or SKIN_VALUE_NOT_SPECIFIED if not specified. More...
 
int GetPrefWidth () const
 Get the preferred width, or SKIN_VALUE_NOT_SPECIFIED if not specified. More...
 
int GetPrefHeight () const
 Get the preferred height, or SKIN_VALUE_NOT_SPECIFIED if not specified. More...
 
int GetIntrinsicWidth () const
 Get the intrinsic width. More...
 
int GetIntrinsicHeight () const
 Get the intrinsic height. More...
 
void SetBitmapDPI (const TBDimensionConverter &dim_conv, int bitmap_dpi)
 Set the DPI that the bitmap was loaded in. More...
 
bool HasState (SKIN_STATE state, TBSkinConditionContext &context)
 Check if there's a exact or partial match for the given state in either override, child or overlay element list. More...
 
bool HasOverlayElements () const
 Return true if this element has overlay elements. More...
 
void Load (TBNode *n, TBSkin *skin, const TBStr &skin_path)
 
void Write (TBFile *file, TBSkin *skin)
 

Public Attributes

TBID id
 ID of the skin element.
 
TBStr name
 Name of the skin element, f.ex "TBSelectDropdown.arrow".
 
TBStr bitmap_file
 File name of the bitmap (might be empty)
 
TBBitmapFragmentbitmap
 Bitmap fragment containing the graphics, or nullptr.
 
uint8_t cut
 How the bitmap should be sliced using StretchBox.
 
int16_t expand
 How much the skin should expand outside the widgets rect.
 
SKIN_ELEMENT_TYPE type
 Skin element type.
 
bool is_painting
 If the skin is being painted (avoiding eternal recursing)
 
bool is_getting
 If the skin is being got (avoiding eternal recursion)
 
int16_t padding_left
 Left padding for any content in the element.
 
int16_t padding_top
 Top padding for any content in the element.
 
int16_t padding_right
 Right padding for any content in the element.
 
int16_t padding_bottom
 Bottom padding for any content in the element.
 
int16_t width
 Intrinsic width or SKIN_VALUE_NOT_SPECIFIED.
 
int16_t height
 Intrinsic height or SKIN_VALUE_NOT_SPECIFIED.
 
int16_t pref_width
 Preferred width or SKIN_VALUE_NOT_SPECIFIED.
 
int16_t pref_height
 Preferred height or SKIN_VALUE_NOT_SPECIFIED.
 
int16_t min_width
 Minimum width or SKIN_VALUE_NOT_SPECIFIED.
 
int16_t min_height
 Minimum height or SKIN_VALUE_NOT_SPECIFIED.
 
int16_t max_width
 Maximum width or SKIN_VALUE_NOT_SPECIFIED.
 
int16_t max_height
 Maximum height or SKIN_VALUE_NOT_SPECIFIED.
 
int16_t spacing
 Spacing used on layout or SKIN_VALUE_NOT_SPECIFIED.
 
int16_t content_ofs_x
 X offset of the content in the widget.
 
int16_t content_ofs_y
 Y offset of the content in the widget.
 
int16_t img_ofs_x
 X offset for type image. Relative to image position (img_position_x).
 
int16_t img_ofs_y
 Y offset for type image. Relative to image position (img_position_y).
 
int8_t img_position_x
 Horizontal position for type image. More...
 
int8_t img_position_y
 Vertical position for type image. More...
 
int8_t flip_x
 The skin is flipped horizontally.
 
int8_t flip_y
 The skin is flipped vertically.
 
float opacity
 Opacity that should be used for the whole widget (0.f - 1.f).
 
TBColor text_color
 Color of the text in the widget.
 
TBColor bg_color
 Color of the background in the widget.
 
TBColor bitmap_color
 Color to paint the bitmap with. (for now assume text_color if true).
 
int16_t bitmap_dpi
 The DPI of the bitmap that was loaded.
 
TBValue tag
 This value is free to use for anything. It's not used internally.
 
TBSkinElementStateList m_override_elements
 List of override elements (See TBSkin::PaintSkin)
 
TBSkinElementStateList m_strong_override_elements
 List of strong-override elements (See TBSkin::PaintSkin)
 
TBSkinElementStateList m_child_elements
 List of child elements (See TBSkin::PaintSkin)
 
TBSkinElementStateList m_overlay_elements
 List of overlay elements (See TBSkin::PaintSkin)
 

Detailed Description

Skin element.

Contains a bitmap fragment (or nullptr) and info specifying how it should be painted. Also contains padding and other look-specific widget properties.

Member Function Documentation

int tb::TBSkinElement::GetIntrinsicHeight ( ) const

Get the intrinsic height.

If not specified using the "height" attribute, it will be calculated based on the skin properties. If it can't be calculated it will return SKIN_VALUE_NOT_SPECIFIED.

int tb::TBSkinElement::GetIntrinsicMinHeight ( ) const

Get the intrinsic minimum height.

It will be calculated based on the skin properties.

int tb::TBSkinElement::GetIntrinsicMinWidth ( ) const

Get the intrinsic minimum width.

It will be calculated based on the skin properties.

int tb::TBSkinElement::GetIntrinsicWidth ( ) const

Get the intrinsic width.

If not specified using the "width" attribute, it will be calculated based on the skin properties. If it can't be calculated it will return SKIN_VALUE_NOT_SPECIFIED.

int tb::TBSkinElement::GetMaxHeight ( ) const
inline

Get the maximum height, or SKIN_VALUE_NOT_SPECIFIED if not specified.

int tb::TBSkinElement::GetMaxWidth ( ) const
inline

Get the maximum width, or SKIN_VALUE_NOT_SPECIFIED if not specified.

int tb::TBSkinElement::GetMinHeight ( ) const
inline

Get the minimum height, or SKIN_VALUE_NOT_SPECIFIED if not specified.

int tb::TBSkinElement::GetMinWidth ( ) const
inline

Get the minimum width, or SKIN_VALUE_NOT_SPECIFIED if not specified.

int tb::TBSkinElement::GetPrefHeight ( ) const
inline

Get the preferred height, or SKIN_VALUE_NOT_SPECIFIED if not specified.

int tb::TBSkinElement::GetPrefWidth ( ) const
inline

Get the preferred width, or SKIN_VALUE_NOT_SPECIFIED if not specified.

bool tb::TBSkinElement::HasOverlayElements ( ) const
inline

Return true if this element has overlay elements.

bool tb::TBSkinElement::HasState ( SKIN_STATE  state,
TBSkinConditionContext context 
)

Check if there's a exact or partial match for the given state in either override, child or overlay element list.

State elements with state "all" will be ignored.

void tb::TBSkinElement::SetBitmapDPI ( const TBDimensionConverter dim_conv,
int  bitmap_dpi 
)

Set the DPI that the bitmap was loaded in.

This may modify properties to compensate for the bitmap resolution.

Member Data Documentation

int8_t tb::TBSkinElement::img_position_x

Horizontal position for type image.

0-100 (left to right in available space). Default 50.

int8_t tb::TBSkinElement::img_position_y

Vertical position for type image.

0-100 (top to bottom in available space). Default 50.


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