CAMenu Class Reference

A basic menu screen. More...

#include <camenu.h>

Inheritance diagram for CAMenu:

CAScreen List of all members.

Public Member Functions

 CAMenu (const char *title)
 Constructor.
 ~CAMenu ()
 Destructor.
virtual int run ()
 Runs the menu.
virtual void buildScreen ()
 Builds the menu screen.
void addMenuLabel (const char *label)
 Adds a simple menu label to the menu.
void addMenuInput (const char *label, char *result, int maxLength)
 Adds a menu input to the menu.
void addMenuInput (const char *label, int *result, int maxLength)
 Adds a menu input to the menu.
void addMenuSelect (const char *label, const char *valueList, int *result)
 Adds a menu select to the menu.
void addMenuSelect (const char *label, const char *valueList, bool *result)
 Adds a menu select to the menu.
void calcMenuDimensions ()
 Calculates the max menu text dimesnions.
virtual void on_button_press (CL_InputDevice *device, const CL_Key &key)
 Called on key release.
int getLeft ()
 Returns the left border position.
int getRight ()
 Returns the right border position.
int getTop ()
 Returns the top border position.
int getBottom ()
 Returns the bottom border position.
int getWidth ()
 Returns the width.
int getHeight ()
 Returns the height.
int getItemHeight ()
 Returns the width of one item.
int getHeaderHeight ()
 Returns the height of the menu header.
void setConfigureMenu (bool on)
 Sets wheter this is a configure menu or not.
void setChanged (bool on=true)
 Sets that the user has changed something in the menu.
void setCursor (int pos)
 Sets the cursor position (0 is the top entry).
int getCursor ()
 Returns the current cursor position (o is the top position).
int getSelection ()
 Returns -1 if the menu was cancelled (ESC) otherwise the cursor position.

Protected Attributes

bool changed
 User has changed something.
int left
 Left menu position.
int right
 Left menu position.
int top
 Left menu position.
int bottom
 Left menu position.
int width
 Total width of menu text.
int height
 Total height of menu text.
int itemHeight
 Height of one menu item.
int headerHeight
 Header height.
CAMenuItemitem [CA_MAXMENUITEMS]
 The menu items.
CL_String title
 Menu Title.
int numItems
 Number of used menu items.
int cursor
 Cursor position (0...numLabels).
bool configureMenu
 Is this a configure menu?
CL_Slot slot

Detailed Description

A basic menu screen.

Author:
Andrew Mustun


Member Function Documentation

void CAMenu::addMenuInput ( const char *  label,
char *  result,
int  maxLength 
)

Adds a menu input to the menu.

Menu inputs let the user input any value (string).

Parameters:
label The menu item label.
defaultValue Value shown at startup of the menu.

void CAMenu::addMenuInput ( const char *  label,
int *  result,
int  maxLength 
)

Adds a menu input to the menu.

Menu inputs let the user input any value (int).

Parameters:
label The menu item label.
defaultValue Value shown at startup of the menu.

void CAMenu::addMenuSelect ( const char *  label,
const char *  valueList,
int *  result 
)

Adds a menu select to the menu.

Menu selects let the user choose a value from a given list (string).

Parameters:
label The menu item label.
valueList Possible values to choose from.
result Pointer to an int value which stores the selection result. (0=first value selected)

void CAMenu::addMenuSelect ( const char *  label,
const char *  valueList,
bool *  result 
)

Adds a menu select to the menu.

Menu selects let the user choose a value from a given list (string).

Parameters:
label The menu item label.
valueList Possible values to choose from.
result Pointer to a bool value which stores the selection result. (false=first value selected)

void CAMenu::setConfigureMenu ( bool  on  )  [inline]

Sets wheter this is a configure menu or not.

Configure menus apply settings immediately using the CA_APP->reconfigure() method.


The documentation for this class was generated from the following files:
Generated on Tue Nov 28 06:48:29 2006 by  doxygen 1.5.0