nsnake
Classic snake game for the terminal
Loading...
Searching...
No Matches
MenuItemLabel Struct Reference

Shows a Menu Item with left and right labels. More...

#include <MenuItemLabel.hpp>

Inheritance diagram for MenuItemLabel:
Collaboration diagram for MenuItemLabel:

Public Member Functions

 MenuItemLabel (std::string label, int id, std::string rightLabel)
 
void draw (Window *window, int x, int y, int width, bool hilite=false)
 Shows this item at #x, #y with #width.
 
void handleInput ()
 Makes the menu item react to input, as seen on the global InputManager.
 
void set (std::string str)
 
- Public Member Functions inherited from MenuItem
 MenuItem (std::string label, int id)
 Create a MenuItem, with user-defined id.
 

Public Attributes

std::string rightLabel
 
- Public Attributes inherited from MenuItem
MenuItemType type
 Specific type of this widget.
 
std::string label
 Text that will be shown on the screen.
 
int id
 User-defined id to identify this item.
 

Additional Inherited Members

- Public Types inherited from MenuItem
enum  MenuItemType {
  ITEM , LABEL , CHECKBOX , NUMBERBOX ,
  TEXTBOX , TEXTLIST
}
 All possible item types. More...
 

Detailed Description

Shows a Menu Item with left and right labels.

Definition at line 7 of file MenuItemLabel.hpp.

Constructor & Destructor Documentation

◆ MenuItemLabel()

MenuItemLabel::MenuItemLabel ( std::string label,
int id,
std::string rightLabel )

Definition at line 4 of file MenuItemLabel.cpp.

◆ ~MenuItemLabel()

virtual MenuItemLabel::~MenuItemLabel ( )
inlinevirtual

Definition at line 10 of file MenuItemLabel.hpp.

Member Function Documentation

◆ draw()

void MenuItemLabel::draw ( Window * window,
int x,
int y,
int width,
bool hilite = false )
virtual

Shows this item at #x, #y with #width.

If this is the current item, send #hilite as true.

Note
Yeah, height is always 1.

Reimplemented from MenuItem.

Definition at line 11 of file MenuItemLabel.cpp.

◆ handleInput()

void MenuItemLabel::handleInput ( )
virtual

Makes the menu item react to input, as seen on the global InputManager.

Each type of MenuItem might react to input differently. A text box might want to show printable characters, a check box might want to check if space bar was pressed, whatever.

When inheriting this, make sure to implement it.

Reimplemented from MenuItem.

Definition at line 25 of file MenuItemLabel.cpp.

◆ set()

void MenuItemLabel::set ( std::string str)

Definition at line 28 of file MenuItemLabel.cpp.

Member Data Documentation

◆ rightLabel

std::string MenuItemLabel::rightLabel

Definition at line 18 of file MenuItemLabel.hpp.


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