nsnake
Classic snake game for the terminal
Public Member Functions | List of all members
MenuAlphabetic Class Reference

Menu on which its items are always sorted alphabetically. More...

#include <MenuAlphabetic.hpp>

Inheritance diagram for MenuAlphabetic:
Inheritance graph
[legend]
Collaboration diagram for MenuAlphabetic:
Collaboration graph
[legend]

Public Member Functions

 MenuAlphabetic (int x, int y, int width, int height)
 
void add (MenuItem *item)
 
void handleInput ()
 
void goRandom ()
 Selects a random item right AFTER the first blank one. More...
 
- Public Member Functions inherited from Menu
 Menu (int x, int y, int width, int height)
 Creates a menu at #x and #y with #width and #height. More...
 
void add (MenuItem *item)
 
void addBlank ()
 
void removeByID (int id)
 Removes the menu item with #id.
 
void removeByLabel (std::string label)
 Removes the menu item with #label. More...
 
void draw (Window *window)
 Draws the whole Menu on #window.
 
void handleInput ()
 Makes the menu react to input, as seen on the global InputManager. More...
 
void goNext ()
 Makes the menu select the next item. More...
 
void goPrevious ()
 Makes the menu select the previous item. More...
 
void goFirst ()
 
void goLast ()
 
void goRandom ()
 
bool willQuit ()
 Tells if the user selected an item that quits the menu.
 
std::string currentLabel ()
 Returns the label of the currently selected item.
 
int currentID ()
 Returns the user-specified id of the selected item.
 
bool getBool (int id)
 Returns the bool internal value of item that has #id. More...
 
int getInt (int id)
 Returns the integer value of the item that has #id. More...
 
std::string getString (int id)
 Returns the string value of the item that has #id. More...
 
void reset ()
 Makes the menu able to be selected again. More...
 

Additional Inherited Members

- Public Attributes inherited from Menu
std::vector< MenuItem * > item
 Container of all the options inside the menu.
 
MenuItemcurrent
 Current item selected. More...
 
- Protected Attributes inherited from Menu
unsigned int currentIndex
 Index of the currently selected item.
 
int x
 
int y
 
int width
 
int height
 
bool selected
 Tells if the user selected an item (pressed Enter).
 
MenuItemselectedItem
 Specifies which item the user pressed Enter on.
 

Detailed Description

Menu on which its items are always sorted alphabetically.

It has special navigation keys: by pressing a letter it will jump straight to the first occurrence of it.

Definition at line 11 of file MenuAlphabetic.hpp.

Member Function Documentation

void MenuAlphabetic::goRandom ( )

Selects a random item right AFTER the first blank one.

Definition at line 85 of file MenuAlphabetic.cpp.


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