Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

MenuOptions Class Reference

Inheritance diagram for MenuOptions:

Inheritance graph
[legend]
Collaboration diagram for MenuOptions:

Collaboration graph
[legend]

Detailed Description

Options menu which allow to set lang and tune volume.

Definition at line 16 of file MenuOptions.h.

Public Member Functions

 MenuOptions ()
virtual ~MenuOptions ()
virtual const char * getName () const
virtual bool allowBg () const
void mouseButton (const MouseStroke &stroke)
 Start level under pressed button.
virtual void drawOn (SDL_Surface *screen)
void receiveString (const StringMsg *msg)
 Handle incoming message.

Protected Member Functions

virtual void own_initState ()
 Display menu.
virtual void own_updateState ()
 Update statusbar.
virtual void own_pauseState ()
virtual void own_resumeState ()
 Display options menu.
virtual void own_cleanState ()


Constructor & Destructor Documentation

MenuOptions::MenuOptions  ) 
 

Definition at line 32 of file MenuOptions.cpp.

00033 {
00034     m_container = NULL;
00035     m_statusBar = NULL;
00036     m_needRefresh = false;
00037     registerDrawable(this);
00038     prepareMenu();
00039 
00040     takeHandler(new OptionsInput(this));
00041 }

MenuOptions::~MenuOptions  )  [virtual]
 

Definition at line 43 of file MenuOptions.cpp.

00044 {
00045     delete m_container;
00046 }


Member Function Documentation

virtual bool MenuOptions::allowBg  )  const [inline, virtual]
 

Reimplemented from GameState.

Definition at line 40 of file MenuOptions.h.

00040 { return true; }

void MenuOptions::drawOn SDL_Surface *  screen  )  [virtual]
 

Implements Drawable.

Definition at line 224 of file MenuOptions.cpp.

00225 {
00226     SDL_Color gray = {0xf0, 0xf0, 0xf0, 128};
00227     SurfaceTool::alphaFill(screen, NULL, gray);
00228 }

virtual const char* MenuOptions::getName  )  const [inline, virtual]
 

Implements INamed.

Definition at line 39 of file MenuOptions.h.

00039 { return "state_options"; };

void MenuOptions::mouseButton const MouseStroke stroke  ) 
 

Start level under pressed button.

Start pedometer when level is solved already.

Definition at line 218 of file MenuOptions.cpp.

00219 {
00220     m_container->mouseButton(stroke);
00221 }

virtual void MenuOptions::own_cleanState  )  [inline, protected, virtual]
 

Implements GameState.

Definition at line 35 of file MenuOptions.h.

00035 {}

void MenuOptions::own_initState  )  [protected, virtual]
 

Display menu.

Implements GameState.

Definition at line 52 of file MenuOptions.cpp.

00053 {
00054     registerWatcher("lang");
00055     own_resumeState();
00056 }

virtual void MenuOptions::own_pauseState  )  [inline, protected, virtual]
 

Implements GameState.

Definition at line 33 of file MenuOptions.h.

00033 {}

void MenuOptions::own_resumeState  )  [protected, virtual]
 

Display options menu.

Menu will be centred on screen.

Implements GameState.

Definition at line 63 of file MenuOptions.cpp.

00064 {
00065     int contentW = m_container->getW();
00066     int contentH = m_container->getH();
00067     OptionAgent *options = OptionAgent::agent();
00068     int screenW = options->getAsInt("screen_width");
00069     int screenH = options->getAsInt("screen_height");
00070 
00071     m_container->setShift(
00072             V2((screenW - contentW) / 2, (screenH - contentH) / 2));
00073 }

void MenuOptions::own_updateState  )  [protected, virtual]
 

Update statusbar.

Implements GameState.

Definition at line 79 of file MenuOptions.cpp.

00080 {
00081     if (m_needRefresh) {
00082         m_needRefresh = false;
00083         prepareMenu();
00084         own_resumeState();
00085     }
00086     std::string tooltip = m_container->getTip(getInput()->getMouseLoc());
00087     m_statusBar->setLabel(tooltip);
00088 }

void MenuOptions::receiveString const StringMsg msg  )  [virtual]
 

Handle incoming message.

Messages:

  • param_changed(lang) ... refresh menu

Exceptions:
UnknownMsgException 

Reimplemented from BaseListener.

Definition at line 238 of file MenuOptions.cpp.

00239 {
00240     if (msg->equalsName("param_changed")) {
00241         std::string param = msg->getValue();
00242         if ("lang" == param) {
00243             m_needRefresh = true;
00244         }
00245         else {
00246             throw UnknownMsgException(msg);
00247         }
00248     }
00249     else {
00250         throw UnknownMsgException(msg);
00251     }
00252 }


The documentation for this class was generated from the following files:
Generated on Wed Jun 1 09:55:53 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2