nsnake
Classic snake game for the terminal
Loading...
Searching...
No Matches
MenuItemTextlist Class Reference

A list of selectable text. More...

#include <MenuItemTextlist.hpp>

Inheritance diagram for MenuItemTextlist:
Collaboration diagram for MenuItemTextlist:

Public Member Functions

 MenuItemTextlist (std::string label, int id, std::vector< std::string > options, std::string initial)
 
void draw (Window *window, int x, int y, int width, bool hilite)
 Shows this item at #x, #y with #width.
 
void handleInput ()
 Makes the menu item react to input, as seen on the global InputManager.
 
void increase ()
 
void decrease ()
 
void reset ()
 
std::string currentText ()
 
- Public Member Functions inherited from MenuItem
 MenuItem (std::string label, int id)
 Create a MenuItem, with user-defined id.
 

Additional Inherited Members

- Public Types inherited from MenuItem
enum  MenuItemType {
  ITEM , LABEL , CHECKBOX , NUMBERBOX ,
  TEXTBOX , TEXTLIST
}
 All possible item types. More...
 
- 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.
 

Detailed Description

A list of selectable text.

Definition at line 10 of file MenuItemTextlist.hpp.

Constructor & Destructor Documentation

◆ MenuItemTextlist()

MenuItemTextlist::MenuItemTextlist ( std::string label,
int id,
std::vector< std::string > options,
std::string initial )

Definition at line 8 of file MenuItemTextlist.cpp.

◆ ~MenuItemTextlist()

virtual MenuItemTextlist::~MenuItemTextlist ( )
inlinevirtual

Definition at line 15 of file MenuItemTextlist.hpp.

Member Function Documentation

◆ currentText()

std::string MenuItemTextlist::currentText ( )

Definition at line 103 of file MenuItemTextlist.cpp.

◆ decrease()

void MenuItemTextlist::decrease ( )

Definition at line 92 of file MenuItemTextlist.cpp.

◆ draw()

void MenuItemTextlist::draw ( Window * window,
int x,
int y,
int width,
bool hilite )
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 26 of file MenuItemTextlist.cpp.

◆ handleInput()

void MenuItemTextlist::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 66 of file MenuItemTextlist.cpp.

◆ increase()

void MenuItemTextlist::increase ( )

Definition at line 84 of file MenuItemTextlist.cpp.

◆ reset()

void MenuItemTextlist::reset ( )

Definition at line 99 of file MenuItemTextlist.cpp.


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