i6engine  1.0
i6e::api::GUIWidget Class Reference

Superclass for all GUI widgets. More...

#include <D:/Projekte/i6engine/libs/i6engine-modules/include/i6engine/api/gui/GUIWidget.h>

Public Member Functions

 GUIWidget (const std::string &name)
 
virtual ~GUIWidget ()
 
virtual void update (uint16_t type, gui::GUIUpdateMessageStruct *message)
 Method to process incoming messages. More...
 
virtual void tick ()
 This method is called every Tick, if ticking is enabled for this widget. More...
 
void loadWindowLayout (const std::string &name, const std::string &filename)
 loads a Layout from a .layout file and stores it in _window More...
 
void enableTicking (bool enabled)
 Registers this widget to be ticked. More...
 
void subscribeClickEvent (const boost::function< void(void)> &callback)
 Subscribes to a window event. This function can be used to handle event-subscription-messages. More...
 
bool canDrop () const
 returns whether the widget accepts drops or not More...
 
std::vector< GUIWidget * > getAllMouseoverWidgets () const
 returns a vector containing all windows the mousecursor is currently over More...
 
void setMouseOverCallback (const std::function< std::vector< GUIWidget * >(void)> &func)
 sets mouse over callback More...
 
void setPosition (double x, double y)
 sets position of this widget More...
 
void setSize (double w, double h)
 sets size of this widget More...
 
bool isHit () const
 
bool renderingEndedHandler (const CEGUI::EventArgs &args)
 handler to copy rendered data to a memory buffer More...
 

Public Attributes

std::string _name
 
CEGUI::Window * _window
 
GUIWidget_parent
 
std::vector< GUIWidget * > _childs
 

Detailed Description

Superclass for all GUI widgets.

A GUIWidget is a part of your GUI. Each GUIWidget has an unique name and handles one CEGUI Window. The GUIWidgets are managed by the GUIManager:

  • Each widget is automatically added to the root window.
  • The manager assumes that there is a valid CEGUI-window in the _window variable. So the variable must be filled in the c'tor of subclasses.
  • The constructor of a GUIWidget-subclass should take two Strings. One for the name of the widget and one for the CEGUI-window layout. While this is not mandatory, it makes it easier to register new widget templates.
  • GUIWidgets are created by a Factory. The registerGUIWidgetTemplate function in the GUIFacade allows to register a new widget to the system. If the constructor of a subclass follows the above point, you can use boost::factory to simply register the constructor of the subclass to the System.

Definition at line 65 of file GUIWidget.h.

Constructor & Destructor Documentation

i6e::api::GUIWidget::GUIWidget ( const std::string &  name)
explicit
virtual i6e::api::GUIWidget::~GUIWidget ( )
virtual

Member Function Documentation

bool i6e::api::GUIWidget::canDrop ( ) const
inline

returns whether the widget accepts drops or not

Definition at line 103 of file GUIWidget.h.

void i6e::api::GUIWidget::enableTicking ( bool  enabled)

Registers this widget to be ticked.

Parameters
enabledIf true this widget's tick-method will be called every tick
std::vector<GUIWidget *> i6e::api::GUIWidget::getAllMouseoverWidgets ( ) const
inline

returns a vector containing all windows the mousecursor is currently over

Definition at line 110 of file GUIWidget.h.

bool i6e::api::GUIWidget::isHit ( ) const
void i6e::api::GUIWidget::loadWindowLayout ( const std::string &  name,
const std::string &  filename 
)

loads a Layout from a .layout file and stores it in _window

bool i6e::api::GUIWidget::renderingEndedHandler ( const CEGUI::EventArgs &  args)

handler to copy rendered data to a memory buffer

void i6e::api::GUIWidget::setMouseOverCallback ( const std::function< std::vector< GUIWidget * >(void)> &  func)
inline

sets mouse over callback

Definition at line 117 of file GUIWidget.h.

void i6e::api::GUIWidget::setPosition ( double  x,
double  y 
)

sets position of this widget

void i6e::api::GUIWidget::setSize ( double  w,
double  h 
)

sets size of this widget

void i6e::api::GUIWidget::subscribeClickEvent ( const boost::function< void(void)> &  callback)
inline

Subscribes to a window event. This function can be used to handle event-subscription-messages.

Parameters
callbackThe function to be executed.

Definition at line 96 of file GUIWidget.h.

virtual void i6e::api::GUIWidget::tick ( )
virtual

This method is called every Tick, if ticking is enabled for this widget.

Reimplemented in i6e::modules::GUIPrint, i6e::modules::GUIStatusList, and i6e::modules::GUITooltip.

Member Data Documentation

std::vector<GUIWidget *> i6e::api::GUIWidget::_childs

Definition at line 140 of file GUIWidget.h.

std::string i6e::api::GUIWidget::_name

Definition at line 136 of file GUIWidget.h.

GUIWidget* i6e::api::GUIWidget::_parent

Definition at line 139 of file GUIWidget.h.

CEGUI::Window* i6e::api::GUIWidget::_window

Definition at line 137 of file GUIWidget.h.


The documentation for this class was generated from the following file: