UI::MenuItem Class Reference

an Item that appears on a menu. More...

#include <MenuItem.h>

Inheritance diagram for UI::MenuItem:

UI::ContinueButton UI::GameStartMenuItem UI::QuitButton UI::SubMenuItem UI::ReplayStartMenuItem List of all members.

Public Types

 S_NORMAL = 0
 Normal appearence when not highlighted.
 S_PRELIGHT = 1
 Highlighted to show that pressing the RT_MENU_SELECT button activates this item.
 S_ACTIVE = 2
 Actually selected.
 S_DISABLED = 3
 Insensitive state, for when the item cannot be picked.
enum  State { S_NORMAL = 0, S_PRELIGHT = 1, S_ACTIVE = 2, S_DISABLED = 3 }
 The appearence of the menu item. More...

Public Member Functions

 MenuItem (std::wstring label)
 Construct with a label.
virtual ~MenuItem ()
virtual void draw ()
 Render the menu item with OpenGL calls.
virtual void activate ()
 called when the item is picked by the user.
void set_state (State state)
 Change the state to display the item in. Defaults to S_NORMAL.
State get_state ()
 Get the state the item will be displayed in.
unsigned int get_min_width ()
 Get the minimium width to make the menu to fit this item in.
void set_width (unsigned int width)
 Make the item this wide.

Protected Attributes

std::wstring label
State state
float tex_coord_y_start
float tex_coord_y_end
unsigned int width

Detailed Description

an Item that appears on a menu.

Definition at line 20 of file MenuItem.h.


Member Enumeration Documentation

enum UI::MenuItem::State

The appearence of the menu item.

The state changes so that the user can tell what is going on based on the appearnce of the menus.

Enumerator:
S_NORMAL  Normal appearence when not highlighted.
S_PRELIGHT  Highlighted to show that pressing the RT_MENU_SELECT button activates this item.
S_ACTIVE  Actually selected.

Only shown when there is a submenu or some other excuse to leave the menu displayed

S_DISABLED  Insensitive state, for when the item cannot be picked.

Definition at line 26 of file MenuItem.h.


Constructor & Destructor Documentation

UI::MenuItem::MenuItem ( std::wstring  label  ) 

Construct with a label.

Parameters:
label The text to display on the menu item.

Definition at line 20 of file MenuItem.cpp.

UI::MenuItem::~MenuItem (  )  [virtual]

Definition at line 26 of file MenuItem.cpp.


Member Function Documentation

void UI::MenuItem::activate (  )  [virtual]

called when the item is picked by the user.

Reimplemented in UI::GameStartMenuItem, UI::ContinueButton, UI::QuitButton, and UI::ReplayStartMenuItem.

Definition at line 82 of file MenuItem.cpp.

void UI::MenuItem::draw (  )  [virtual]

Render the menu item with OpenGL calls.

The item will be drawn from 64 pixels high centred around 0 vertically, and from the 0 to the width set by set_width plus a constant horizontally.

Reimplemented in UI::SubMenuItem.

Definition at line 30 of file MenuItem.cpp.

unsigned int UI::MenuItem::get_min_width (  ) 

Get the minimium width to make the menu to fit this item in.

Definition at line 99 of file MenuItem.cpp.

MenuItem::State UI::MenuItem::get_state (  ) 

Get the state the item will be displayed in.

Definition at line 94 of file MenuItem.cpp.

void UI::MenuItem::set_state ( State  state  ) 

Change the state to display the item in. Defaults to S_NORMAL.

Definition at line 87 of file MenuItem.cpp.

void UI::MenuItem::set_width ( unsigned int  width  ) 

Make the item this wide.

Should be at least the value returned by get_min_width().

Definition at line 105 of file MenuItem.cpp.


Member Data Documentation

std::wstring UI::MenuItem::label [protected]

Definition at line 71 of file MenuItem.h.

State UI::MenuItem::state [protected]

Definition at line 72 of file MenuItem.h.

float UI::MenuItem::tex_coord_y_end [protected]

Definition at line 74 of file MenuItem.h.

float UI::MenuItem::tex_coord_y_start [protected]

Definition at line 73 of file MenuItem.h.

unsigned int UI::MenuItem::width [protected]

Definition at line 75 of file MenuItem.h.


The documentation for this class was generated from the following files:
Get Racer at SourceForge.net. Fast, secure and Free Open Source software downloads

Generated at Mon Sep 6 00:41:19 2010 by Doxygen version 1.4.7 for Racer version svn335.