uMenuItem Class Reference

#include <uMenu.h>

Inheritance diagram for uMenuItem:

Inheritance graph
[legend]
Collaboration diagram for uMenuItem:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 uMenuItem (uMenu *M, const tOutput &help)
virtual ~uMenuItem ()
virtual tString Help ()
virtual void Render (REAL, REAL, REAL=1, bool=0)
virtual void RenderBackground ()
virtual void LeftRight (int)
virtual void LeftRightRelease ()
virtual void Enter ()
virtual bool Event (SDL_Event &)
virtual REAL SpaceRight ()
int GetID ()
virtual bool IsSelectable ()

Protected Member Functions

void DisplayText (REAL x, REAL y, const char *text, bool selected, REAL alpha=1, int center=0, int cursor=0, int cursorPos=0, rTextField::ColorMode colorMode=rTextField::COLOR_USE, float maxWidth=2.)
void DisplayTextSpecial (REAL x, REAL y, const char *text, bool selected, REAL alpha=1, int center=0)
void SetColor (bool selected, REAL alpha)
 Sets the color of text output for this menuitem.

Protected Attributes

uMenumenu
tOutput helpText

Private Member Functions

 uMenuItem ()

Private Attributes

int idnum

Friends

class uMenu


Detailed Description

Definition at line 137 of file uMenu.h.


Constructor & Destructor Documentation

uMenuItem::uMenuItem (  )  [inline, private]

Definition at line 141 of file uMenu.h.

00141 {};

uMenuItem::uMenuItem ( uMenu M,
const tOutput help 
) [inline]

Definition at line 151 of file uMenu.h.

References tList< T, MALLOC, REFERENCE >::Add(), idnum, uMenu::items, and menu.

00152             :idnum(-1),menu(M),helpText(help){
00153         menu->items.Add(this,idnum);
00154     }

Here is the call graph for this function:

virtual uMenuItem::~uMenuItem (  )  [inline, virtual]

Definition at line 163 of file uMenu.h.

References idnum, uMenu::items, menu, and tList< T, MALLOC, REFERENCE >::Remove().

00164     {
00165         if (menu && idnum >= 0)
00166             menu->items.Remove(this,idnum);
00167     }

Here is the call graph for this function:


Member Function Documentation

void uMenuItem::DisplayText ( REAL  x,
REAL  y,
const char *  text,
bool  selected,
REAL  alpha = 1,
int  center = 0,
int  cursor = 0,
int  cursorPos = 0,
rTextField::ColorMode  colorMode = rTextField::COLOR_USE,
float  maxWidth = 2. 
) [protected]

Definition at line 550 of file uMenu.cpp.

References rTextField::COLOR_USE, rTextField::GetTextLength(), REAL, SetColor(), sr_fontMenu, and sr_glOut.

Referenced by DisplayTextSpecial(), uMenuItemSelection< bool >::Render(), uMenuItemString::Render(), uMenuItemInt::Render(), ArmageTronPlayer_to_viewport_menuitem::Render(), and ArmageTron_viewport_menuitem::Render().

00553                                                                                                     {
00554 #ifndef DEDICATED
00555     if (sr_glOut){
00556         SetColor( selected, alpha );
00557 
00558         REAL th = text_height;
00559 
00560         REAL availw = 1.9f;
00561         if (center < 0) availw = (.9f-x);
00562         if (center > 0) availw = (x + .9f);
00563         if (availw > maxWidth) availw = maxWidth;
00564 
00565         float usedwidth=rTextField::GetTextLength(tString(text), th, colorMode == rTextField::COLOR_USE);
00566         if (usedwidth > availw)
00567         {
00568             th *= availw/(usedwidth);
00569         }
00570 
00571         ::DisplayText(x,y,th,text,sr_fontMenu,center,c,cp, colorMode);
00572     }
00573 #endif

Here is the call graph for this function:

Here is the caller graph for this function:

void uMenuItem::DisplayTextSpecial ( REAL  x,
REAL  y,
const char *  text,
bool  selected,
REAL  alpha = 1,
int  center = 0 
) [protected]

Definition at line 575 of file uMenu.cpp.

References DisplayText().

Referenced by uMenuItemExit::Render(), uMenuItemAction::Render(), uMenuItemSubmenu::Render(), gMenuItemPlayer::Render(), gMenuItemStatus::Render(), gMenuItemAutoSelect::Render(), gMenuItemSpectate::Render(), gMenuItemNewTeam::Render(), and gMenuItemPlayerTeam::Render().

00578                                                          {
00579     /*
00580      if(selected)
00581        glColor3f(.9,.3,.3);
00582      else
00583        glColor3f(.7,.7,1);
00584 
00585      ::DisplayText(x,y,text_width,text_height,text,center);
00586      */
00587 
00588     DisplayText(x,y,text,selected,alpha,center);

Here is the call graph for this function:

Here is the caller graph for this function:

virtual tString uMenuItem::Help (  )  [inline, virtual]

Reimplemented in SwigDirector_UMenuItemAction, uMenuItemInput, uMenuItemSelection< T >, uMenuItemSelection< tString >, uMenuItemSelection< rScreenSize >, uMenuItemSelection< int >, uMenuItemSelection< Vote >, and uMenuItemSelection< bool >.

Definition at line 169 of file uMenu.h.

References helpText.

00169 {return tString(helpText);}

virtual void uMenuItem::Render ( REAL  ,
REAL  ,
REAL  = 1,
bool  = 0 
) [inline, virtual]

Reimplemented in eMenuItemPassword, SwigDirector_UMenuItemAction, ArmageTron_viewport_menuitem, ArmageTronPlayer_to_viewport_menuitem, gServerMenuItem, gServerStartMenuItem, gMenuItemPlayerTeam, gMenuItemNewTeam, gMenuItemSpectate, gMenuItemAutoSelect, gMenuItemSpacer, gMenuItemStatus, gMenuItemPlayer, uMenuItemInput, uMenuItemExit, uMenuItemSelection< T >, uMenuItemInt, uMenuItemString, uMenuItemStringWithHistory, uMenuItemSubmenu, uMenuItemAction, uMenuItemSelection< tString >, uMenuItemSelection< rScreenSize >, uMenuItemSelection< int >, uMenuItemSelection< Vote >, and uMenuItemSelection< bool >.

Definition at line 172 of file uMenu.h.

Referenced by gBrowserMenuItem::RenderBackground().

00172 {};

Here is the caller graph for this function:

virtual void uMenuItem::RenderBackground (  )  [inline, virtual]

Reimplemented in SwigDirector_UMenuItemAction, ArmageTron_viewport_menuitem, ArmageTronPlayer_to_viewport_menuitem, ArmageTron_color_menuitem, gBrowserMenuItem, and gServerMenuItem.

Definition at line 174 of file uMenu.h.

References uMenu::GenericBackground(), and menu.

Referenced by ArmageTron_color_menuitem::RenderBackground(), ArmageTronPlayer_to_viewport_menuitem::RenderBackground(), and ArmageTron_viewport_menuitem::RenderBackground().

00174                                    {
00175         menu->GenericBackground();
00176     };

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void uMenuItem::LeftRight ( int   )  [inline, virtual]

Reimplemented in SwigDirector_UMenuItemAction, ArmageTronPlayer_to_viewport_menuitem, uMenuItemSelection< T >, uMenuItemToggle, uMenuItemInt, uMenuItemSelection< tString >, uMenuItemSelection< rScreenSize >, uMenuItemSelection< int >, uMenuItemSelection< Vote >, and uMenuItemSelection< bool >.

Definition at line 179 of file uMenu.h.

00179 {}; //lr=-1:left lr=+1: right

virtual void uMenuItem::LeftRightRelease (  )  [inline, virtual]

Reimplemented in SwigDirector_UMenuItemAction.

Definition at line 180 of file uMenu.h.

00180 {};

virtual void uMenuItem::Enter (  )  [inline, virtual]

Reimplemented in eMenuItemKick, SwigDirector_UMenuItemAction, gServerMenuItem, gServerStartMenuItem, gMenuItemEditSubmenu, gMenuItemPlayerTeam, gMenuItemNewTeam, gMenuItemSpectate, gMenuItemAutoSelect, gMenuItemPlayer, uMenuItemInput, uMenuItemExit, uMenuItemToggle, uMenuItemSubmenu, uMenuItemAction, uMenuItemFunction, and uMenuItemFunctionInt.

Definition at line 182 of file uMenu.h.

00182 {}; // if the user presses enter/space on menu

virtual bool uMenuItem::Event ( SDL_Event &   )  [inline, virtual]

Reimplemented in eMenuItemUserName, eMenuItemPassword, eMenuItemChat, SwigDirector_UMenuItemAction, gMemuItemConsole, gBrowserMenuItem, gServerMenuItem, uMenuItemInput, uMenuItemString, and uMenuItemStringWithHistory.

Definition at line 184 of file uMenu.h.

Referenced by gBrowserMenuItem::Event().

00184 {return false;} // if the key c is

Here is the caller graph for this function:

virtual REAL uMenuItem::SpaceRight (  )  [inline, virtual]

Reimplemented in SwigDirector_UMenuItemAction, ArmageTron_viewport_menuitem, ArmageTronPlayer_to_viewport_menuitem, and ArmageTron_color_menuitem.

Definition at line 188 of file uMenu.h.

Referenced by _wrap_UMenuItem_space_right().

00188 {return 0;}

Here is the caller graph for this function:

int uMenuItem::GetID (  )  [inline]

Definition at line 190 of file uMenu.h.

References idnum.

Referenced by _wrap_UMenuItem_get_id(), and gServerMenu::Update().

00190 {return idnum;}

Here is the caller graph for this function:

virtual bool uMenuItem::IsSelectable (  )  [inline, virtual]

Reimplemented in SwigDirector_UMenuItemAction, gMenuItemSpacer, and gMenuItemStatus.

Definition at line 192 of file uMenu.h.

Referenced by _wrap_UMenuItem_is_selectable().

00192 {return true;};

Here is the caller graph for this function:

void uMenuItem::SetColor ( bool  selected,
REAL  alpha 
) [protected]

Sets the color of text output for this menuitem.

Parameters:
selected flag indicating whether the menu item is currently selected
alpha transparency to use

Definition at line 536 of file uMenu.cpp.

References REAL, rTextField::SetBlendColor(), rTextField::SetDefaultColor(), sin(), and tSysTimeFloat().

Referenced by DisplayText(), gServerStartMenuItem::Render(), and gServerMenuItem::Render().

00538 {
00539     //   rTextField::SetBlendColor( tColor(.8+.2*sin(time),.3-.1*sin(time),.3-.1*sin(time),alpha) );
00540     rTextField::SetDefaultColor( tColor(1,1,1,alpha) );
00541 
00542     if (selected)
00543     {
00544         REAL time=tSysTimeFloat()*10;
00545         REAL intensity = 1+.3*sin(time);
00546         rTextField::SetDefaultColor( tColor(.8,.3,.3,alpha) );
00547         rTextField::SetBlendColor( tColor(intensity,intensity,intensity,alpha) );
00548     }

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class uMenu [friend]

Definition at line 138 of file uMenu.h.


Member Data Documentation

int uMenuItem::idnum [private]

Definition at line 140 of file uMenu.h.

Referenced by uMenu::AddItem(), GetID(), uMenu::RemoveItem(), uMenu::ReverseItems(), uMenuItem(), and ~uMenuItem().

uMenu* uMenuItem::menu [protected]

Definition at line 141 of file uMenu.h.

Referenced by uMenuItemExit::Enter(), gMenuItemAutoSelect::Enter(), gMenuItemSpectate::Enter(), gMenuItemNewTeam::Enter(), gMenuItemPlayerTeam::Enter(), gMenuItemEditSubmenu::Enter(), gServerStartMenuItem::Enter(), gServerMenuItem::Enter(), gServerMenuItem::Event(), uMenuItemString::MyMenu(), gServerStartMenuItem::Render(), gServerMenuItem::Render(), RenderBackground(), gBrowserMenuItem::RenderBackground(), uMenuItem(), gServerMenuItem::~gServerMenuItem(), and ~uMenuItem().

tOutput uMenuItem::helpText [protected]

Definition at line 144 of file uMenu.h.

Referenced by uMenuItemSelection< bool >::Help(), Help(), eVoteItem::UpdateMenuItem(), and eVoteItem::~eVoteItem().


The documentation for this class was generated from the following files:
Generated on Sun Mar 16 00:01:02 2008 for Armagetron Advanced by  doxygen 1.5.4