Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

MenuItem Class Reference

#include <MenuItem.h>

Inheritance diagram for MenuItem:

Button Key Menu TextEntry TextSelection BackButton List of all members.

Public Types

enum  Type { MENU, CONTROL, BACK_BUTTON }

Public Member Functions

virtual ~MenuItem ()
virtual void load (ifstream &file)
virtual void save (ofstream &file)
virtual void draw (float x, float y, float zoom)=0
virtual Type getType ()=0
virtual float getWidth (float zoom)=0
virtual float getHeight (float zoom)=0
virtual string & getName ()=0
virtual bool handleKeyEvent (SDL_Event *event)=0

Protected Member Functions

bool findLoadPosition (const string &name, ifstream &file)

Detailed Description

A class defining everything you can do with a menu item, note that at Menu is itself a MenuItem

Definition at line 18 of file MenuItem.h.


Member Enumeration Documentation

enum MenuItem::Type
 

Enumeration values:
MENU  A menu or submenu.
CONTROL  Some sort of control.
BACK_BUTTON  Special control, returns the focus to the parent menu.

Definition at line 21 of file MenuItem.h.


Constructor & Destructor Documentation

virtual MenuItem::~MenuItem  )  [inline, virtual]
 

Destructor

Definition at line 27 of file MenuItem.h.


Member Function Documentation

virtual void MenuItem::draw float  x,
float  y,
float  zoom
[pure virtual]
 

Draws the MenuItem at x,y with a zoom factor of zoom (2 equals double size).

The MenuItem may decide not to apply the scale or to only support some zoom steps, always check getWidth and getHeight if you need the excact size.

Implemented in Button, Key, Menu, TextEntry, and TextSelection.

bool MenuItem::findLoadPosition const string &  name,
ifstream &  file
[protected]
 

Finds a "name=value" pair in the stream, the stream pointer is left so that value can be read directly.

Returns true if the "name=value" pair was found

Definition at line 6 of file MenuItem.cpp.

virtual float MenuItem::getHeight float  zoom  )  [pure virtual]
 

Returns the height of this MenuItem at zoom factor zoom, must be excact

Implemented in Button, Key, Menu, TextEntry, and TextSelection.

virtual string& MenuItem::getName  )  [pure virtual]
 

Returns the name of the MenuItem used when save is called.

The name may not contain a =.

Implemented in Button, Key, Menu, TextEntry, and TextSelection.

virtual Type MenuItem::getType  )  [pure virtual]
 

Returns the Type of this control.

Implemented in BackButton, Button, Key, Menu, TextEntry, and TextSelection.

virtual float MenuItem::getWidth float  zoom  )  [pure virtual]
 

Returns the width of this MenuItem at zoom factor zoom, must be excact

Implemented in Button, Key, Menu, TextEntry, and TextSelection.

virtual bool MenuItem::handleKeyEvent SDL_Event *  event  )  [pure virtual]
 

Called when a key press/release event occurs, return true if the MenuItem has handled the event.

If true is returned the event handling will stop.

Implemented in Button, Key, Menu, TextEntry, and TextSelection.

virtual void MenuItem::load ifstream &  file  )  [inline, virtual]
 

Reads the configuration for the MenuItem from any position within the file

Hint: Use findLoadPosition to find you entry in the file

Reimplemented in Key, Menu, TextEntry, and TextSelection.

Definition at line 33 of file MenuItem.h.

virtual void MenuItem::save ofstream &  file  )  [inline, virtual]
 

Saves the MenuItem at the current position in the file.

Entrys must look like "name=value\n".

Reimplemented in Key, Menu, TextEntry, and TextSelection.

Definition at line 38 of file MenuItem.h.


The documentation for this class was generated from the following files:
Generated on Wed Sep 1 14:46:57 2004 by doxygen 1.3.7