Lysa UI  0.0
Lysa UI —UI components for the Lysa Engine
StyleBase Class Referenceabstract

Detailed Description

Base class of the built-in vector styles.

+ Inheritance diagram for StyleBase:

Classes

struct  MarkSegment
 

Public Member Functions

 ~StyleBase () override = default
 
void draw (const Widget &widget, UIResource &resources, Vector2DRenderer &renderer, bool before) const override
 
void addResource (Widget &widget, const std::string &resources) override
 
void resize (Widget &widget, Rect &rect, UIResource &resources) override
 
virtual std::string containerResource () const
 Resource string of a sunken container (list boxes, tree views, text areas) More...
 
virtual std::string separatorResource () const
 Resource string of a menu separator. More...
 
virtual std::string scrollBarResource () const
 Resource string of a scroll bar. More...
 
virtual std::string gripResource () const
 Resource string of the grip of a scroll bar or of the cursor of a slider. More...
 
virtual std::string checkMarkResource () const
 Resource string of the mark of a check box. More...
 
virtual std::string treeIndentResource () const
 Resource string of one tree view indentation level. More...
 
virtual std::string selectionResource () const
 Resource string of a selection rectangle. More...
 
virtual std::string highlightResource () const
 Resource string of a pointed item rectangle. More...
 
virtual std::string buttonResource () const
 Resource string of a push button. More...
 
virtual std::string listBoxResource () const
 Resource string of a list box. More...
 
virtual std::string sortArrowResource () const
 Resource string of a table sort direction indicator. More...
 
- Public Member Functions inherited from Style
virtual ~Style () = default
 
virtual void setOption (const std::string &name, const std::string &value)
 
std::string getOption (const std::string &name) const
 
const float4 & getTextColor () const
 

Protected Member Functions

virtual float borderSize () const
 
virtual float frameBorderSize () const
 
virtual void drawPanel (const Panel &, StyleResource &, Vector2DRenderer &) const = 0
 
virtual void drawBox (const Widget &, const StyleResource &, Vector2DRenderer &, bool pushable) const = 0
 
virtual void drawLine (const Line &, const StyleResource &, Vector2DRenderer &) const = 0
 
virtual void drawButton (const Button &, StyleResource &, Vector2DRenderer &) const = 0
 
virtual void drawToggleButton (ToggleButton &, StyleResource &, Vector2DRenderer &) const = 0
 
virtual void drawRadioButton (const RadioButton &, const StyleResource &, Vector2DRenderer &) const = 0
 
virtual void drawCheckBox (const CheckBox &, StyleResource &, Vector2DRenderer &) const = 0
 
virtual void drawFrame (Frame &, StyleResource &, Vector2DRenderer &) const = 0
 
virtual void drawProgressBar (const ProgressBar &, const StyleResource &, Vector2DRenderer &) const = 0
 
virtual void drawTabBar (const TabBar &, const StyleResource &, Vector2DRenderer &) const = 0
 
virtual void drawKnob (const Knob &, const StyleResource &, Vector2DRenderer &) const = 0
 
virtual float4 markColor (const Widget &, const StyleResource &) const
 
virtual float4 iconColor (const Icon &, const StyleResource &) const
 
virtual float4 disabledTextColor () const
 
virtual void drawSelection (const Selection &, const StyleResource &, Vector2DRenderer &) const
 
virtual void drawTextEdit (const TextEdit &, Vector2DRenderer &) const
 
void drawTextEditSelection (const TextEdit &, Vector2DRenderer &) const
 
void drawText (const Text &, const StyleResource &, Vector2DRenderer &) const
 
void drawRichTextArea (const RichTextArea &, Vector2DRenderer &) const
 
void drawIconImage (const IconImage &, const StyleResource &, Vector2DRenderer &) const
 
void drawIconSVG (const IconSVG &, const StyleResource &, Vector2DRenderer &) const
 
void drawTreeView (const TreeView &, const StyleResource &, Vector2DRenderer &) const
 
void drawGridLines (const Grid &, Vector2DRenderer &) const
 
void drawColorSlider (const ColorSlider &, const StyleResource &, Vector2DRenderer &) const
 
void drawColorWheel (const ColorWheel &, const StyleResource &, Vector2DRenderer &) const
 
void drawMark (const Widget &, const StyleResource &, Vector2DRenderer &, std::span< const MarkSegment > segments) const
 
void drawMarkIn (const Widget &, const StyleResource &, Vector2DRenderer &, std::span< const MarkSegment > segments, const Rect &area) const
 
void drawArrow (const Arrow &, const StyleResource &, Vector2DRenderer &) const
 
void drawFilledArrow (const Arrow &, const StyleResource &, Vector2DRenderer &, const Rect &area) const
 
void drawProgressBarText (const ProgressBar &, Vector2DRenderer &, const float4 &color) const
 
- Protected Member Functions inherited from Style
virtual void init ()
 
virtual void updateOptions ()
 
virtual void updateColorOptions ()
 
void updateSizeOptions ()
 
float4 extractColor (const std::string &option, float r, float g, float b, float a=1.0f) const
 
float4 extractColor (const std::string &option, const float4 &defaultColor) const
 
float extractSize (const std::string &option, float defaultSize) const
 

Static Protected Member Functions

static Rect progressBarTrack (const ProgressBar &)
 
static float progressBarRatio (const ProgressBar &)
 
static void drawClippedLine (const float2 &start, const float2 &end, const Rect &clip, Vector2DRenderer &)
 
static float4 fade (const float4 &color, const Widget &widget)
 
- Static Protected Member Functions inherited from Style
static float squareWidth (const Widget &widget, float size)
 

Static Protected Attributes

static constexpr float DEFAULT_BORDER {2.0f}
 
static constexpr float DEFAULT_FRAME_BORDER {4.0f}
 

Additional Inherited Members

- Static Public Member Functions inherited from Style
static std::shared_ptr< Style > create (const std::string &name="3D")
 
- Static Public Attributes inherited from Style
static constexpr float DEFAULT_SCROLL_BAR_SIZE {18.0f}
 Default size of the scroll bars. More...
 
static constexpr float DEFAULT_RADIO_BUTTON_SIZE {16.0f}
 Default size of the radio buttons. More...
 
static constexpr float DEFAULT_CHECK_BOX_SIZE {16.0f}
 Default size of the check boxes. More...
 
static constexpr float DEFAULT_TREE_INDENT_SIZE {12.0f}
 Default width of a tree view indentation level. More...
 
static constexpr float DEFAULT_SORT_ARROW_SIZE {8.0f}
 Default width of a table sort direction indicator. More...
 
static constexpr float DEFAULT_KNOB_SIZE {48.0f}
 Default size of the knobs. More...
 
- Protected Attributes inherited from Style
float4 focus {}
 
float4 selected {}
 
float4 highlight {}
 
float4 cursor {}
 
float4 shadowDark {}
 
float4 shadowBright {}
 
float4 fgUp {}
 
float4 fgDown {}
 
float4 button {}
 
float4 treeLines {}
 
float4 gridLines {}
 
float4 textColor {1.0f, 1.0f, 1.0f, 1.0f}
 
float scrollBarSize {DEFAULT_SCROLL_BAR_SIZE}
 
float radioButtonSize {DEFAULT_RADIO_BUTTON_SIZE}
 
float checkBoxSize {DEFAULT_CHECK_BOX_SIZE}
 
float treeIndentSize {DEFAULT_TREE_INDENT_SIZE}
 
float sortArrowSize {DEFAULT_SORT_ARROW_SIZE}
 
float knobSize {DEFAULT_KNOB_SIZE}
 

Constructor & Destructor Documentation

~StyleBase ( )
overridedefault

Member Function Documentation

void addResource ( Widget widget,
const std::string &  resources 
)
overridevirtual

Parses a resource description string.

Parameters
widgetWidget to associate resources with.
resourcesString describing the style resources.

Implements lysa::ui::Style::addResource()

virtual float borderSize ( ) const
inlineprotectedvirtual

Size of the borders inserted by resize() around the content of the bordered widgets.

Expressed in vertical units but applied to both axes, so it eats into the width of a widget far more than into its height : the horizontal unit is compressed by the aspect ratio. Keep it small, an icon button is barely a dozen units wide.

virtual std::string buttonResource ( ) const
virtual

Resource string of a push button.

virtual std::string checkMarkResource ( ) const
virtual

Resource string of the mark of a check box.

Reimplemented in lysa::ui::StyleMaterial::checkMarkResource()

virtual std::string containerResource ( ) const
virtual

Resource string of a sunken container (list boxes, tree views, text areas)

Reimplemented in lysa::ui::StyleMaterial::containerResource()

virtual float4 disabledTextColor ( ) const
inlineprotectedvirtual
void draw ( const Widget widget,
UIResource resources,
Vector2DRenderer &  renderer,
bool  before 
) const
overridevirtual

Draws a widget by dispatching on its Widget::Type.

Parameters
widgetWidget to draw.
resourcesResources used for drawing.
rendererThe 2D renderer.
beforeTrue when called before drawing children, false after.

Implements lysa::ui::Style::draw()

void drawArrow ( const Arrow ,
const StyleResource ,
Vector2DRenderer &   
) const
protected
virtual void drawBox ( const Widget ,
const StyleResource ,
Vector2DRenderer &  ,
bool  pushable 
) const
protectedpure virtual
virtual void drawButton ( const Button ,
StyleResource ,
Vector2DRenderer &   
) const
protectedpure virtual
virtual void drawCheckBox ( const CheckBox ,
StyleResource ,
Vector2DRenderer &   
) const
protectedpure virtual
static void drawClippedLine ( const float2 &  start,
const float2 &  end,
const Rect &  clip,
Vector2DRenderer &   
)
staticprotected
void drawColorSlider ( const ColorSlider ,
const StyleResource ,
Vector2DRenderer &   
) const
protected
void drawColorWheel ( const ColorWheel ,
const StyleResource ,
Vector2DRenderer &   
) const
protected
void drawFilledArrow ( const Arrow ,
const StyleResource ,
Vector2DRenderer &  ,
const Rect &  area 
) const
protected
virtual void drawFrame ( Frame ,
StyleResource ,
Vector2DRenderer &   
) const
protectedpure virtual
void drawGridLines ( const Grid ,
Vector2DRenderer &   
) const
protected
void drawIconImage ( const IconImage ,
const StyleResource ,
Vector2DRenderer &   
) const
protected
void drawIconSVG ( const IconSVG ,
const StyleResource ,
Vector2DRenderer &   
) const
protected
virtual void drawKnob ( const Knob ,
const StyleResource ,
Vector2DRenderer &   
) const
protectedpure virtual
virtual void drawLine ( const Line ,
const StyleResource ,
Vector2DRenderer &   
) const
protectedpure virtual
void drawMark ( const Widget ,
const StyleResource ,
Vector2DRenderer &  ,
std::span< const MarkSegment segments 
) const
protected
void drawMarkIn ( const Widget ,
const StyleResource ,
Vector2DRenderer &  ,
std::span< const MarkSegment segments,
const Rect &  area 
) const
protected
virtual void drawPanel ( const Panel ,
StyleResource ,
Vector2DRenderer &   
) const
protectedpure virtual
virtual void drawProgressBar ( const ProgressBar ,
const StyleResource ,
Vector2DRenderer &   
) const
protectedpure virtual
void drawProgressBarText ( const ProgressBar ,
Vector2DRenderer &  ,
const float4 &  color 
) const
protected
virtual void drawRadioButton ( const RadioButton ,
const StyleResource ,
Vector2DRenderer &   
) const
protectedpure virtual
void drawRichTextArea ( const RichTextArea ,
Vector2DRenderer &   
) const
protected
virtual void drawSelection ( const Selection ,
const StyleResource ,
Vector2DRenderer &   
) const
protectedvirtual
virtual void drawTabBar ( const TabBar ,
const StyleResource ,
Vector2DRenderer &   
) const
protectedpure virtual
void drawText ( const Text ,
const StyleResource ,
Vector2DRenderer &   
) const
protected
virtual void drawTextEdit ( const TextEdit ,
Vector2DRenderer &   
) const
protectedvirtual
void drawTextEditSelection ( const TextEdit ,
Vector2DRenderer &   
) const
protected
virtual void drawToggleButton ( ToggleButton ,
StyleResource ,
Vector2DRenderer &   
) const
protectedpure virtual
void drawTreeView ( const TreeView ,
const StyleResource ,
Vector2DRenderer &   
) const
protected
static float4 fade ( const float4 &  color,
const Widget widget 
)
staticprotected
virtual float frameBorderSize ( ) const
inlineprotectedvirtual
virtual std::string gripResource ( ) const
virtual

Resource string of the grip of a scroll bar or of the cursor of a slider.

Reimplemented in lysa::ui::StyleMaterial::gripResource()

virtual std::string highlightResource ( ) const
virtual

Resource string of a pointed item rectangle.

virtual float4 iconColor ( const Icon ,
const StyleResource  
) const
protectedvirtual
virtual std::string listBoxResource ( ) const
virtual

Resource string of a list box.

Reimplemented in lysa::ui::StyleMaterial::listBoxResource()

virtual float4 markColor ( const Widget ,
const StyleResource  
) const
protectedvirtual
static float progressBarRatio ( const ProgressBar )
staticprotected
static Rect progressBarTrack ( const ProgressBar )
staticprotected
void resize ( Widget widget,
Rect &  rect,
UIResource resources 
)
overridevirtual

Adjusts a widget size to the style borders.

Parameters
widgetThe widget being resized.
rectThe rectangle to adjust.
resourcesThe widget's UI resources.

Implements lysa::ui::Style::resize()

virtual std::string scrollBarResource ( ) const
virtual

Resource string of a scroll bar.

Reimplemented in lysa::ui::StyleMaterial::scrollBarResource()

virtual std::string selectionResource ( ) const
virtual

Resource string of a selection rectangle.

virtual std::string separatorResource ( ) const
virtual

Resource string of a menu separator.

Reimplemented in lysa::ui::StyleMaterial::separatorResource()

virtual std::string sortArrowResource ( ) const
virtual

Resource string of a table sort direction indicator.

virtual std::string treeIndentResource ( ) const
virtual

Resource string of one tree view indentation level.

Member Data Documentation

constexpr float DEFAULT_BORDER {2.0f}
staticprotectedconstexpr
constexpr float DEFAULT_FRAME_BORDER {4.0f}
staticprotectedconstexpr