Aether
SDL2 based UI Framework for NX
Public Member Functions | List of all members
Aether::ListOption Class Reference

A ListOption is similar to what appears in Horizon's lists. It has a string and value, as well as a function which is called when selected. More...

#include <ListOption.hpp>

Inheritance diagram for Aether::ListOption:
Aether::Element

Public Member Functions

 ListOption (std::string t, std::string v, std::function< void()> f)
 Construct a new List Option object. More...
 
Colour getLineColour ()
 Get the line colour (top rectangle colour) More...
 
void setLineColour (Colour c)
 Set the line colour (top rectangle colour) More...
 
Colour getHintColour ()
 Get the hint colour. More...
 
void setHintColour (Colour c)
 Set the hint colour. More...
 
Colour getValueColour ()
 Get the value colour. More...
 
void setValueColour (Colour c)
 Set the value colour. More...
 
void setColours (Colour l, Colour h, Colour v)
 Set all colours at once: line, hint, value. More...
 
std::string hint ()
 Get the hint string. More...
 
void setHint (std::string s)
 Set the hint string. More...
 
std::string value ()
 Get the value string. More...
 
void setValue (std::string s)
 Set the value string. More...
 
void setFontSize (unsigned int s)
 Set the font size. Also repositions centers. More...
 
unsigned int fontSize ()
 Get the font size. More...
 
void setW (int w)
 Set the width of the list option All elements are repositioned when this is called. More...
 
void setH (int h)
 Set the height of the list option All elements are repositioned when this is called. More...
 
- Public Member Functions inherited from Aether::Element
 Element (int x=0, int y=0, int w=100, int h=100)
 Construct a new Element object. More...
 
int x ()
 Returns x-coordinate of element. More...
 
int y ()
 Returns y-coordinate of element. More...
 
int w ()
 Returns width of element. More...
 
int h ()
 Returns height of element. More...
 
virtual void setX (int x)
 Set x-coordinate of element. More...
 
virtual void setY (int y)
 Set y-coordinate of element. More...
 
virtual void setXY (int x, int y)
 Set co-ordinates of element. More...
 
virtual void setWH (int w, int h)
 Set size of element. More...
 
virtual void setXYWH (int x, int y, int w, int h)
 Setter size and co-ordinates of element. More...
 
Elementparent ()
 Returns the parent element of this element. More...
 
void setParent (Element *p)
 Set the parent element of this element. More...
 
virtual void addElement (Element *e)
 Adds new element a child. More...
 
virtual bool removeElement (Element *e)
 Attempt to delete given child element. More...
 
virtual void removeAllElements ()
 Deletes all children elements.
 
virtual bool returnElement (Element *e)
 Attempt to remove the given child element. More...
 
virtual void returnAllElements ()
 Removes (but does not delete) all children elements.
 
bool isVisible ()
 Check if current element is visible on-screen. More...
 
bool hidden ()
 Check if current element is hidden. More...
 
void setHidden (bool b)
 Set whether element is hidden or not. More...
 
bool selected ()
 Check if current element is selected. More...
 
virtual void setSelected (bool b)
 Set whether element is selected or not. More...
 
bool selectable ()
 Check if current element is selectable. More...
 
void setSelectable (bool b)
 Set whether element is selectable or not. More...
 
bool touchable ()
 Check if current element is touch responsive. More...
 
void setTouchable (bool b)
 Set whether element is touch responsive or not. More...
 
bool highlighted ()
 Check if current element is highlighted. More...
 
void setHighlighted (bool b)
 Set whether element is highlighted or not. More...
 
bool hasHighlighted ()
 Check if current element has highlighted children element. More...
 
void setHasHighlighted (bool b)
 Set whether element has highlighted children element or not. More...
 
bool hasSelectable ()
 Check if current element has selectable children element. More...
 
void setHasSelectable (bool b)
 Set whether element has selectable children element or not. More...
 
bool hasSelected ()
 Check if current element has selected children element. More...
 
void setHasSelected (bool b)
 Set whether element has selected children element or not. More...
 
virtual void setActive ()
 Set element as activated.
 
virtual void setInactive ()
 Set element as in-activated.
 
void setFocused (Element *e)
 Sets current element as unfocused and instead focuses a sub-element. More...
 
void setFocussed (Element *e)
 Sets current element as unfocused and instead focuses a sub-element. More...
 
Elementfocused ()
 Returns the currently focused element. More...
 
Elementfocussed ()
 Returns the currently focused element. More...
 
std::function< void()> onPressFunc ()
 Returns function invoked when the element is pressed. More...
 
void onPress (std::function< void()> f)
 Sets the function to invoked when the element is pressed. More...
 
virtual bool handleEvent (InputEvent *e)
 Attempt to handle a given event. More...
 
virtual void update (unsigned int dt)
 Update is passed time since last frame (for animations) More...
 
virtual void render ()
 Render child elements + highlights.
 
virtual DrawablerenderHighlightBG ()
 Renders the highlight background. More...
 
virtual DrawablerenderHighlight ()
 Renders the highlight border. More...
 
virtual DrawablerenderSelection ()
 Renders the selection overlay. More...
 
virtual ~Element ()
 Destroy the Element object.
 

Additional Inherited Members

- Protected Member Functions inherited from Aether::Element
void renderHighlightTextures ()
 Renders cached highlight textures.
 
void renderSelectionTexture ()
 Renders cached selection texture.
 
void addElementAt (Element *e, size_t i)
 Add element at given index in vector. More...
 
- Protected Attributes inherited from Aether::Element
Elementparent_
 Pointer to parent element, if there is one.
 
std::vector< Element * > children
 Vector of child elements (used to call their methods)
 
Elementfocused_
 Children element which is highlighted/focused (to regain focus on activation)
 
- Static Protected Attributes inherited from Aether::Element
static Colour hiBGColour
 Background colour if element is highlighted.
 
static Colour hiBorderColour
 Border colour if element is highlighted.
 
static Colour selColour
 Selected colour if element is highlighted.
 
static unsigned int hiSize
 Size of highlight border.
 
static DrawablehiBGTex
 Highlight background texture.
 
static DrawablehiBorderTex
 Highlight border texture.
 
static DrawableselTex
 Selection texture.
 
static Rendererrenderer
 
static bool isTouch
 Indicator on whether the touch is "active" (i.e. hide highlighting) or not.
 

Detailed Description

A ListOption is similar to what appears in Horizon's lists. It has a string and value, as well as a function which is called when selected.

Constructor & Destructor Documentation

◆ ListOption()

Aether::ListOption::ListOption ( std::string  t,
std::string  v,
std::function< void()>  f 
)

Construct a new List Option object.

Parameters
thint string
vvalue string
ffunction to invoke when option is selected

Member Function Documentation

◆ fontSize()

unsigned int Aether::ListOption::fontSize ( )

Get the font size.

Returns
font size

◆ getHintColour()

Colour Aether::ListOption::getHintColour ( )

Get the hint colour.

Returns
hint colour

◆ getLineColour()

Colour Aether::ListOption::getLineColour ( )

Get the line colour (top rectangle colour)

Returns
line colour

◆ getValueColour()

Colour Aether::ListOption::getValueColour ( )

Get the value colour.

Returns
value colour

◆ hint()

std::string Aether::ListOption::hint ( )

Get the hint string.

Returns
hint string

◆ setColours()

void Aether::ListOption::setColours ( Colour  l,
Colour  h,
Colour  v 
)

Set all colours at once: line, hint, value.

Parameters
lnew line colour
hnew help colour
vnew value colour

◆ setFontSize()

void Aether::ListOption::setFontSize ( unsigned int  s)

Set the font size. Also repositions centers.

Parameters
snew font size

◆ setH()

void Aether::ListOption::setH ( int  h)
virtual

Set the height of the list option All elements are repositioned when this is called.

Parameters
hnew height

Reimplemented from Aether::Element.

◆ setHint()

void Aether::ListOption::setHint ( std::string  s)

Set the hint string.

Parameters
snew hint string

◆ setHintColour()

void Aether::ListOption::setHintColour ( Colour  c)

Set the hint colour.

Parameters
cnew hint colour

◆ setLineColour()

void Aether::ListOption::setLineColour ( Colour  c)

Set the line colour (top rectangle colour)

Parameters
cnew line colour

◆ setValue()

void Aether::ListOption::setValue ( std::string  s)

Set the value string.

Parameters
snew value string

◆ setValueColour()

void Aether::ListOption::setValueColour ( Colour  c)

Set the value colour.

Parameters
cnew value colour

◆ setW()

void Aether::ListOption::setW ( int  w)
virtual

Set the width of the list option All elements are repositioned when this is called.

Parameters
wnew width

Reimplemented from Aether::Element.

◆ value()

std::string Aether::ListOption::value ( )

Get the value string.

Returns
value string

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