Main Page   Namespace List   Class Hierarchy   Alphabetical List   Data Structures   File List   Namespace Members   Data Fields   Globals  

ExManagerMenu Class Reference

#include <ExManagerMenu.h>

Inheritance diagram for ExManagerMenu:

ExManagerObject< ExCMenu > ExManager

Public Methods

void Reset (void)
void Init (void)
void Draw (void)
bool Load (std::string FileName)
bool Add (std::string FileName)
bool Add (ExCMenu object)
ExCAction InputCommand (ExCCommand Command)
ExCAction InputAction (ExCAction Action)

Static Public Methods

ExManagerMenu * CreateSingleton (void)

Private Methods

 ExManagerMenu (void)
 ~ExManagerMenu (void)

Static Private Attributes

bool m_flag = false
ExManagerMenu * m_instance = NULL

Constructor & Destructor Documentation

ExManagerMenu void    [private]
 

Definition at line 43 of file ExManagerMenu.cpp.

00044 {
00045 }

~ExManagerMenu void    [private]
 

Definition at line 47 of file ExManagerMenu.cpp.

00048 {
00049 }


Member Function Documentation

bool Add ExCMenu    object
 

Reimplemented from ExManagerObject< ExCMenu >.

Definition at line 110 of file ExManagerMenu.cpp.

References ExManagerObject::Add(), Add(), and Guard.

00111 {
00112 Guard(ExManagerMenu::Add(ExCMenu object))
00113         return ExManagerObject<ExCMenu>::Add(object);
00114 UnGuard
00115 }

bool Add std::string    FileName
 

Reimplemented from ExManagerObject< ExCMenu >.

Definition at line 118 of file ExManagerMenu.cpp.

References Add(), ExManager::Consol, Guard, and ExCMenu::LoadFile().

Referenced by Add(), Init(), and Load().

00119 {
00120 Guard(ExManagerMenu::Add(std::string FileName))
00121         try
00122         {
00123                 ExCMenu object;
00124                 object.LoadFile(FileName);
00125                 Add(object);
00126         }
00127         catch(ExCExpFileNotFound)
00128         {
00129                 *Consol<<"ExManagerObject::ExCeption =>"<<FileName<<" File not found"<<std::endl;
00130         }
00131         catch(ExCExpFileReadError)
00132         {
00133                 *Consol<<"ExManagerObject::ExCeption =>"<<FileName<<" Read file error"<<std::endl;
00134         }
00135         catch(...)
00136         {
00137                 *Consol<<"ExManagerObject::ExCeption =>"<<FileName<<" Unknow exception"<<std::endl;
00138         }
00139         return false;
00140 UnGuard
00141 }

ExManagerMenu * CreateSingleton void    [static]
 

Definition at line 29 of file ExManagerMenu.cpp.

References CreateSingleton(), Guard, m_flag, and m_instance.

Referenced by CreateSingleton(), and main().

00029                                                  {
00030 Guard(ExManagerMenu* ExManagerMenu::CreateSingleton(void))
00031         if(!m_flag)
00032         {
00033                 m_flag = true; // We are creating the error log now, so set flag to true
00034                 m_instance = new ExManagerMenu; // Create the error log
00035         }else
00036         {
00037                 std::cout<<"Error singleton already created"<<std::endl;
00038         }
00039         return m_instance; 
00040 UnGuard
00041 }

void Draw void   
 

Reimplemented from ExManagerObject< ExCMenu >.

Definition at line 93 of file ExManagerMenu.cpp.

References ExCMenu::Draw(), Draw(), ExManagerObject< ExCMenu >::GetCurrentObject(), ExManager::GetStatus(), and Guard.

Referenced by Draw(), and ExManagerOutput::DrawScene().

00094 {
00095 Guard(void ExManagerMenu::Draw(void))
00096         if(!GetStatus())return;
00097         glDisable(GL_LIGHTING);
00098         if(GetCurrentObject()!=NULL)GetCurrentObject()->Draw();
00099         glEnable(GL_LIGHTING);
00100 UnGuard
00101 }

void Init void    [virtual]
 

Reimplemented from ExManagerObject< ExCMenu >.

Definition at line 51 of file ExManagerMenu.cpp.

References Add(), Guard, ExManagerObject::Init(), Init(), ExCMenu::LoadFile(), ExManager::SetAskForCommand(), ExManager::SetAskForExclusifCommand(), ExManagerObject< ExCMenu >::SetCurrentObject(), ExCObject::SetName(), and ExManager::SetStatus().

Referenced by Init(), InitManager(), and Reset().

00052 {
00053 Guard(void ExManagerMenu::Init(void))
00054         ExManagerObject<ExCMenu>::Init();
00055 
00056         SetStatus(true);
00057         SetAskForCommand(true);
00058         SetAskForExclusifCommand(true);
00059                 
00060         ExCMenu object;
00061         object.LoadFile("start.men");
00062         object.SetName("StartMenu");
00063         ExManagerMenu::Add(object);
00064         SetCurrentObject("StartMenu");
00065         
00066         ExCMenu object2;
00067         object2.LoadFile("credit.men");
00068         object2.SetName("CreditMenu");
00069         ExManagerMenu::Add(object2);
00070 
00071         ExCMenu object3;
00072         object3.LoadFile("option.men");
00073         object3.SetName("OptionMenu");
00074         ExManagerMenu::Add(object3);
00075 
00076         ExCMenu object4;
00077         object4.LoadFile("commandmenu.men");
00078         object4.SetName("CommandMenu");
00079         ExManagerMenu::Add(object4);
00080         
00081 UnGuard
00082 }

ExCAction InputAction ExCAction    Action [virtual]
 

Reimplemented from ExManager.

Definition at line 166 of file ExManagerMenu.cpp.

References DISABLE_MENU, ENABLE_DISABLE_MENU, ENABLE_MENU, ExManager::GetStatus(), Guard, InputAction(), ExCAction::m_Action, ExCAction::m_Param, SET_CURRENT_MENU, ExManager::SetAskForCommand(), ExManager::SetAskForExclusifCommand(), ExManagerObject< ExCMenu >::SetCurrentObject(), and ExManager::SetStatus().

Referenced by InputAction(), and ExManagerCommand::ProcesExCAction().

00167 {
00168 Guard(ExManagerMenu::InputAction(ExCAction Action))
00169         switch(Action.m_Action)
00170         {
00171         case ENABLE_MENU:
00172                 SetStatus(true);
00173                 SetAskForCommand(true);
00174                 SetAskForExclusifCommand(true);
00175                 break;
00176         case DISABLE_MENU:
00177                 SetStatus(false);
00178                 SetAskForCommand(false);
00179                 SetAskForExclusifCommand(false);
00180                 break;
00181         case ENABLE_DISABLE_MENU:
00182                 if(GetStatus())InputAction(DISABLE_MENU);
00183                 else InputAction(ENABLE_MENU); 
00184                 break;
00185         case SET_CURRENT_MENU:
00186                 std::cout<<Action.m_Param<<std::endl;
00187                 SetCurrentObject(Action.m_Param);
00188                 break;
00189         }
00190         return  NOTHING;
00191 UnGuard
00192 }

ExCAction InputCommand ExCCommand    Command [virtual]
 

Reimplemented from ExManager.

Definition at line 143 of file ExManagerMenu.cpp.

References DISABLE_MENU, ExCMenu::GetCurrentItemAction(), ExManagerObject< ExCMenu >::GetCurrentObject(), Guard, InputCommand(), ExCCommand::m_Command, ExCMenu::NextItem(), and ExCMenu::PreviousItem().

Referenced by InputCommand(), and ExManagerCommand::InputCommand().

00144 {
00145 Guard(ExManagerMenu::InputCommand(ExCCommand Command))
00146         if(GetCurrentObject()==NULL)return NOTHING;
00147         switch(Command.m_Command)
00148         {
00149         case KEYBOARD_DOWN_ARROW_UP:
00150                 GetCurrentObject()->PreviousItem();
00151                 break;
00152         case KEYBOARD_DOWN_ARROW_DOWN:
00153                 GetCurrentObject()->NextItem();
00154                 break;
00155         case KEYBOARD_DOWN_ENTER:
00156                 return GetCurrentObject()->GetCurrentItemAction();
00157                 break;
00158         case KEYBOARD_DOWN_ESC:
00159                 return DISABLE_MENU;
00160                 break;
00161         }
00162         return  NOTHING;
00163 UnGuard
00164 }

bool Load std::string    FileName
 

Reimplemented from ExManagerObject< ExCMenu >.

Definition at line 103 of file ExManagerMenu.cpp.

References Add(), Guard, and Load().

Referenced by Load().

00104 {
00105 Guard(ExManagerMenu::Load(std::string FileName))
00106         return  Add(FileName);
00107 UnGuard
00108 }

void Reset void    [virtual]
 

Reimplemented from ExManagerObject< ExCMenu >.

Definition at line 84 of file ExManagerMenu.cpp.

References Guard, Init(), ExManagerObject::Reset(), Reset(), and ExManagerObject< ExCMenu >::SetCurrentObject().

Referenced by ExManagerCommand::ProcesExCAction(), and Reset().

00085 {
00086 Guard(void ExManagerMenu::Reset(void))
00087         ExManagerObject<ExCMenu>::Reset();
00088         Init();
00089         SetCurrentObject("StartMenu0");
00090 UnGuard
00091 }


Field Documentation

bool m_flag = false [static, private]
 

Definition at line 26 of file ExManagerMenu.cpp.

Referenced by CreateSingleton().

ExManagerMenu * m_instance = NULL [static, private]
 

Definition at line 27 of file ExManagerMenu.cpp.

Referenced by CreateSingleton().


The documentation for this class was generated from the following files:
Generated on Tue Dec 10 18:20:41 2002 for ExNihilo by doxygen1.3-rc1