gcn::Gui Class Reference

#include <gui.hpp>

List of all members.


Detailed Description

Gui core class.

Contains a special widget called the top widget. If you want to be able to have more then one Widget in your Gui, the top widget should be a Container.

NOTE: For the Gui to function properly you need to set a Graphics object to use and an Input object to use.

Definition at line 90 of file gui.hpp.

Public Member Functions

 Gui ()
 Constructor.
virtual ~Gui ()
 Destructor.
virtual void setTop (Widget *top)
 Sets the top Widget.
virtual WidgetgetTop () const
 Gets the top Widget.
virtual void setGraphics (Graphics *graphics)
 Sets the Graphics object to use for drawing.
virtual GraphicsgetGraphics () const
 Gets the Graphics object used for drawing.
virtual void setInput (Input *input)
 Sets the Input object to use for input handling.
virtual InputgetInput () const
 Gets the Input object being used for input handling.
virtual void logic ()
 Performs the Gui logic.
virtual void draw ()
 Draws the Gui.
virtual void focusNone ()
 Focus none of the Widgets in the Gui.
virtual void setTabbingEnabled (bool tabbing)
 Toggles the use of the tab key to focus Widgets.
virtual bool isTabbingEnabled ()
 Checks if tabbing is enabled.
virtual void addGlobalKeyListener (KeyListener *keyListener)
 Adds a global KeyListener to the Gui.
virtual void removeGlobalKeyListener (KeyListener *keyListener)
 Remove global KeyListener from the Gui.

Protected Types

typedef std::list< KeyListener * > KeyListenerList
typedef KeyListenerList::iterator KeyListenerListIterator

Protected Attributes

bool mTopHasMouse
bool mTabbing
WidgetmTop
GraphicsmGraphics
InputmInput
FocusHandlermFocusHandler
KeyListenerList mKeyListeners


Member Function Documentation

void gcn::Gui::addGlobalKeyListener ( KeyListener keyListener  )  [virtual]

Adds a global KeyListener to the Gui.

Parameters:
keyListener a KeyListener to add.

Definition at line 325 of file gui.cpp.

References mKeyListeners.

void gcn::Gui::draw (  )  [virtual]

Draws the Gui.

By calling this funcion all draw functions down in the Gui hierarchy will be called.

Definition at line 270 of file gui.cpp.

References gcn::Graphics::_beginDraw(), gcn::Graphics::_endDraw(), gcn::Widget::draw(), gcn::Widget::drawBorder(), gcn::Widget::getBorderSize(), gcn::Widget::getDimension(), gcn::Widget::isVisible(), mGraphics, mTop, gcn::Graphics::popClipArea(), gcn::Graphics::pushClipArea(), and gcn::Rectangle::x.

Graphics * gcn::Gui::getGraphics (  )  const [virtual]

Gets the Graphics object used for drawing.

Returns:
the Graphics object used for drawing. NULL if no Graphics object has been set.

Definition at line 118 of file gui.cpp.

References mGraphics.

Input * gcn::Gui::getInput (  )  const [virtual]

Gets the Input object being used for input handling.

Returns:
the Input object used for handling input. NULL if no Input object has been set.

Definition at line 128 of file gui.cpp.

References mInput.

Widget * gcn::Gui::getTop (  )  const [virtual]

Gets the top Widget.

Returns:
the top widget. NULL if no top widget has been set.

Definition at line 108 of file gui.cpp.

References mTop.

bool gcn::Gui::isTabbingEnabled (  )  [virtual]

Checks if tabbing is enabled.

Returns:
true if tabbing is enabled.

Definition at line 320 of file gui.cpp.

References mTabbing.

void gcn::Gui::logic (  )  [virtual]

Performs the Gui logic.

By calling this function all logic functions down in the Gui heirarchy will be called. What performs in Logic can be just about anything like adjusting a Widgets size or doing some calculations.

NOTE: Logic also deals with user input (Mouse and Keyboard) for Widgets.

Definition at line 133 of file gui.cpp.

References gcn::Widget::_keyInputMessage(), gcn::Widget::_mouseInMessage(), gcn::Widget::_mouseInputMessage(), gcn::Widget::_mouseOutMessage(), gcn::Input::_pollInput(), gcn::FocusHandler::applyChanges(), gcn::Input::dequeueKeyInput(), gcn::Input::dequeueMouseInput(), gcn::FocusHandler::focusNone(), gcn::Widget::getAbsolutePosition(), gcn::Widget::getDimension(), gcn::FocusHandler::getDragged(), gcn::FocusHandler::getFocused(), gcn::Widget::getX(), gcn::Widget::getY(), gcn::Widget::hasMouse(), gcn::Widget::isFocusable(), gcn::Input::isKeyQueueEmpty(), gcn::Input::isMouseQueueEmpty(), gcn::Rectangle::isPointInRect(), gcn::Widget::logic(), mFocusHandler, mInput, mKeyListeners, mTabbing, mTop, gcn::FocusHandler::tabNext(), gcn::FocusHandler::tabPrevious(), gcn::MouseInput::x, and gcn::MouseInput::y.

void gcn::Gui::removeGlobalKeyListener ( KeyListener keyListener  )  [virtual]

Remove global KeyListener from the Gui.

Parameters:
keyListener a KeyListener to remove.
Exceptions:
Exception if the KeyListener hasn't been added.

Definition at line 330 of file gui.cpp.

References mKeyListeners.

void gcn::Gui::setGraphics ( Graphics graphics  )  [virtual]

Sets the Graphics object to use for drawing.

Parameters:
graphics the Graphics object to use for drawing.
See also:
SDLGraphics, OpenGLGraphics, AllegroGraphics

Definition at line 113 of file gui.cpp.

References mGraphics.

void gcn::Gui::setInput ( Input input  )  [virtual]

Sets the Input object to use for input handling.

Parameters:
input the Input object to use for input handling.
See also:
SDLInput, AllegroInput

Definition at line 123 of file gui.cpp.

References mInput.

void gcn::Gui::setTabbingEnabled ( bool  tabbing  )  [virtual]

Toggles the use of the tab key to focus Widgets.

By default, tabbing is enabled.

Parameters:
tabbing set to false if you want to disable tabbing.

Definition at line 315 of file gui.cpp.

References mTabbing.

void gcn::Gui::setTop ( Widget top  )  [virtual]

Sets the top Widget.

Parameters:
top the top Widget.

Definition at line 94 of file gui.cpp.

References gcn::Widget::_setFocusHandler(), mFocusHandler, and mTop.

Referenced by ~Gui().


The documentation for this class was generated from the following files:
Generated on Sat Jul 29 19:38:48 2006 for Guichan by  doxygen 1.4.7