Public Member Functions | Private Types | Private Member Functions | Private Attributes

Gui Class Reference

A GUI object. More...

#include <Gui.h>

Inheritance diagram for Gui:
Broadcaster Listener

List of all members.

Public Member Functions

 Gui ()
 ~Gui ()
void add (Control *control)
void remove (Control *control)
void sendToFront (Control *control)
Controlfind (const std::string &controlName) const
StringList getFontList () const
FontgetFont (const std::string &fontName) const
void push (Event *event)
bool update ()
void clear ()
int getMouseX () const
int getMouseY () const
void setFocus (bool focus)

Private Types

typedef std::list< Control * > ControlList
typedef std::map< string, Font * > FontList

Private Member Functions

 Gui (const Gui &)
Guioperator= (const Gui &)
void scanFonts (const std::string &searchPath)
EventtranslateMouse (Event event)
bool controlHasFocus ()
void testForFocus ()
void grabMouseMotion (Event *event)

Private Attributes

SkinManagermSkinManager
SkinmSkin
FontList mFontList
ControlList mControlList
int mMouseX
int mMouseY
int mMouseOldX
int mMouseOldY
int mNumControls
bool mMouseLeftPressed
bool mMouseRightPressed
bool mMouseMiddlePressed
bool mIsActive
StringList mErrorMessages

Detailed Description

A GUI object.

Note:
The GUI does not use bitmap fonts of any sort, only TrueType fonts.

Member Typedef Documentation

typedef std::list<Control*> Gui::ControlList [private]
typedef std::map<string, Font*> Gui::FontList [private]

Constructor & Destructor Documentation

Gui::Gui (  ) 
Gui::~Gui (  ) 
Gui::Gui ( const Gui  )  [private]

Member Function Documentation

void Gui::add ( Control control  ) 

Adds a Control to the Gui.

Parameters:
control A pointer to a Control.
Returns:
NULL on error. Otherwise a pointer to the added Control.

Todo:
This is currently hard-coded but should instead be set via an internal skin descriptor.

void Gui::clear (  ) 

Cleans up all GUI elements and refreshes the GUI in a clean state with no Controls.

bool Gui::controlHasFocus (  )  [private]

Scans through all Control's to check for focus.

Returns:
true if any Controls have focus, otherwise false.
Todo:
I hate the name of this function. We need to come up with a better name.
Control* Gui::find ( const std::string &  controlName  )  const
Font* Gui::getFont ( const std::string &  fontName  )  const
StringList Gui::getFontList (  )  const

Returns a list of Font names currently loaded into the Gui system.

Returns:
Vector of strings containing the names of fonts. If there are no fonts in the system an empty vector is returned.
int Gui::getMouseX (  )  const [inline]
int Gui::getMouseY (  )  const [inline]
void Gui::grabMouseMotion ( Event event  )  [private]

Grabs mouse motion events and sets internal mouse pointer coords.

Gui& Gui::operator= ( const Gui  )  [private]
void Gui::push ( Event event  )  [virtual]

Implements Listener.

void Gui::remove ( Control control  ) 

Removes a Control from the Gui.

Parameters:
control A pointer to a Control.
void Gui::scanFonts ( const std::string &  searchPath  )  [private]
void Gui::sendToFront ( Control control  ) 

Brings the specified Control to the top of the Control stack.

Parameters:
control A pointer to a Control.
Note:
This function does not set focus.
void Gui::setFocus ( bool  focus  ) 

Sets whether or not the GUI has focus.

void Gui::testForFocus (  )  [private]

Tests to see if a mouse click occured within a Control in the Control List and, if yes, sets focus for that Control.

Event * Gui::translateMouse ( Event  event  )  [private]

Translates mouse input into higher-level Event messages.

bool Gui::update (  ) 

Updated the GUI state.

Returns:
Returns false if the GUI received an EVENT_SYS_QUIT message.

Member Data Documentation

Internal list of Child Control's

Stores a message should any errors occur.

List of fonts found in the specified fonts directory.

bool Gui::mIsActive [private]

Flag indicating that the GUI is still in an active state.

bool Gui::mMouseLeftPressed [private]

Flag indicating that the left mouse button is pressed.

bool Gui::mMouseMiddlePressed [private]

Flag indicating that the left mouse button is pressed.

int Gui::mMouseOldX [private]
int Gui::mMouseOldY [private]

Previous mouse coordinates.

bool Gui::mMouseRightPressed [private]

Flag indicating that the left mouse button is pressed.

int Gui::mMouseX [private]
int Gui::mMouseY [private]

Current mouse coordinates.

int Gui::mNumControls [private]

Number of Control objects being managed by the GUI.

Skin* Gui::mSkin [private]

Internal Skin used to render controls.

A pointer to a SkinManager object.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines