Study Dungeon  1.0.0
A group project for COSC345
Public Member Functions
ConsoleUI::Button Class Reference

The class for the button object. More...

#include <menu.h>

Public Member Functions

 Button (const std::string &label, std::function< void()> action)
 Construct a new Button object. More...
 
void draw (int x, int y, bool selected)
 Draw the button. More...
 
void performAction () const
 Perform the action associated with the button.
 
size_t getWidth () const
 Get the Width of the button. More...
 
const std::string & getLabel () const
 Get the Label of the button. More...
 

Detailed Description

The class for the button object.

Constructor & Destructor Documentation

◆ Button()

ConsoleUI::Button::Button ( const std::string &  label,
std::function< void()>  action 
)

Construct a new Button object.

Parameters
labelthe label on the button
actionthe function to call when the button is activated

Member Function Documentation

◆ draw()

void ConsoleUI::Button::draw ( int  x,
int  y,
bool  selected 
)

Draw the button.

Parameters
xleft most position
ytop most position
selectedis the button selected

◆ getLabel()

const std::string & ConsoleUI::Button::getLabel ( ) const

Get the Label of the button.

Returns
const std::string&

◆ getWidth()

size_t ConsoleUI::Button::getWidth ( ) const

Get the Width of the button.

Returns
size_t

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