Main Page   Class Hierarchy   Compound List   File List   Compound Members  

Menu Class Reference

Class for a menu in a game. More...

#include <menu.h>

Inheritance diagram for Menu:

Inheritance graph
[legend]
List of all members.

Public Methods

 Menu ()
 Constructor. More...

virtual ~Menu ()
 Destructor.

void addOption (string const &option)
 Add an option. More...

vector< string > const & getOptions () const
 Get the options. More...

virtual void moveUp ()
 Select the previous item of the menu. More...

virtual void moveDown ()
 Select the next item of the menu. More...

virtual unsigned int getSelectedIndex () const
 Get the index selected item. More...

virtual string const & getSelectedItem () const
 Get the selected item. More...


Protected Attributes

vector< string > options
 Vector of options.

unsigned int selectedItem
 Index of the selected item.


Detailed Description

Class for a menu in a game.

It holds a list of strings representing options and handles the selected item. You have to call the addOption method in order to fill the menu with options.


Constructor & Destructor Documentation

Menu::Menu  
 

Constructor.

Just put the selectedItem to 0 (the first item).


Member Function Documentation

void Menu::addOption string const &    option
 

Add an option.

Add a copy of the string to the list of options of this menu.

Parameters:
option  the string we are adding

vector< string > const & Menu::getOptions   const
 

Get the options.

Get the list of options of this menu.

Returns:
the list of string that represents the options

unsigned int Menu::getSelectedIndex   const [virtual]
 

Get the index selected item.

This does not check if the options has no items.

Returns:
the index of the selected item in the list of options.

Reimplemented in InfoMenu.

string const & Menu::getSelectedItem   const [virtual]
 

Get the selected item.

This does not check if the options has no items.

Returns:
the selected string representing the item.

Reimplemented in InfoMenu.

void Menu::moveDown   [virtual]
 

Select the next item of the menu.

Move the selected item index down.

Reimplemented in InfoMenu.

void Menu::moveUp   [virtual]
 

Select the previous item of the menu.

Move the selected item index up.

Reimplemented in InfoMenu.


The documentation for this class was generated from the following files:
Generated on Thu Jun 6 17:22:22 2002 for Perihelion by doxygen1.2.15