Skyward boardcore
Loading...
Searching...
No Matches
Boardcore::OptionView Class Reference

View used to display an option list, so the user can select one by clicking on it. More...

#include <OptionView.h>

Inheritance diagram for Boardcore::OptionView:
Collaboration diagram for Boardcore::OptionView:

Public Types

using OnOptionChosenListener = std::function<void(unsigned int id)>
 
- Public Types inherited from Boardcore::View
using OnInteractionListener = std::function<void(View*, Interaction)>
 

Public Member Functions

 OptionView (std::string name, std::map< uint8_t, std::string > options, uint8_t defaultOption=0, uint8_t numCols=4)
 
virtual ~OptionView ()
 
void setBounds (Bounds bounds) override
 Sets the bounds in which the view will be drawn.
 
void addOnOptionChosenListener (OnOptionChosenListener listener)
 Adds a callback to be called each time an option is selected by the user.
 
std::vector< View * > getChilds () override
 Returns the list of childs.
 
void draw (mxgui::DrawingContext &dc) override
 Draw the view in its bounds.
 
- Public Member Functions inherited from Boardcore::View
 View ()
 
virtual ~View ()
 
Bounds getBounds ()
 
void invalidate ()
 Signal that what has been previously drawn is now invalid and has to be redrawn.
 
void invalidateTree ()
 Invalidate the view tree which has this view as a root.
 
virtual void setBackgroundColor (mxgui::Color color)
 
virtual mxgui::Color getBackgroundColor ()
 
void setSelectedColor (mxgui::Color color)
 
void setSelectable (bool selectable)
 
bool isSelectable ()
 
void setSelected (bool selected)
 
bool isSelected ()
 
void addOnInteractionListener (OnInteractionListener listener)
 
virtual void performInteraction (Interaction action)
 

Additional Inherited Members

- Protected Member Functions inherited from Boardcore::View
bool isInvalidated ()
 

Detailed Description

View used to display an option list, so the user can select one by clicking on it.

Definition at line 38 of file OptionView.h.

Member Typedef Documentation

◆ OnOptionChosenListener

using Boardcore::OptionView::OnOptionChosenListener = std::function<void(unsigned int id)>

Definition at line 41 of file OptionView.h.

Constructor & Destructor Documentation

◆ OptionView()

Boardcore::OptionView::OptionView ( std::string name,
std::map< uint8_t, std::string > options,
uint8_t defaultOption = 0,
uint8_t numCols = 4 )
inline

Definition at line 43 of file OptionView.h.

◆ ~OptionView()

virtual Boardcore::OptionView::~OptionView ( )
inlinevirtual

Definition at line 76 of file OptionView.h.

Member Function Documentation

◆ addOnOptionChosenListener()

void Boardcore::OptionView::addOnOptionChosenListener ( OnOptionChosenListener listener)
inline

Adds a callback to be called each time an option is selected by the user.

Definition at line 104 of file OptionView.h.

◆ draw()

void Boardcore::OptionView::draw ( mxgui::DrawingContext & dc)
inlineoverridevirtual

Draw the view in its bounds.

Parameters
dcReference to a drawingcontext

Reimplemented from Boardcore::View.

Definition at line 118 of file OptionView.h.

◆ getChilds()

std::vector< View * > Boardcore::OptionView::getChilds ( )
inlineoverridevirtual

Returns the list of childs.

Returns
std::vector<View*>

Reimplemented from Boardcore::View.

Definition at line 109 of file OptionView.h.

◆ setBounds()

void Boardcore::OptionView::setBounds ( Bounds bounds)
inlineoverridevirtual

Sets the bounds in which the view will be drawn.

Reimplemented from Boardcore::View.

Definition at line 84 of file OptionView.h.


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