Widget Class Reference

This class is the super-class of all widgets. More...

#include <Widget.h>

Inherits MenuObject, and Loader< Widget >.

Inherited by Background, Bar, Button, Checkbox, and Radiobox.

Collaboration diagram for Widget:

List of all members.


Public Member Functions

virtual ~Widget ()
void registerCallbacks (RegistryAnimation animate, RegistryAnimation unanimate, RegistryCallBack callback)
virtual void pressed ()=0
virtual void released ()=0

Protected Types

typedef void(* RegistryAnimation )(MenuObject *obj, const char *symbol)
typedef void(* RegistryCallBack )(const char *name, const char *value)

Protected Member Functions

 Widget (XMLNode *xml)

Protected Attributes

RegistryAnimation callAnimate
RegistryAnimation callUnAnimate
RegistryCallBack callCallBack

Detailed Description

This class is the super-class of all widgets.

The Widget class is the super-class of all widgets. The class itself is abstract and so the sub-classes (widgets) have to implement the missing methods.

The widgets themselves are placed into separate libraries, which will be loaded at runtime. So new widgets can be added to the 3dMenu-library without recompiling a single line. The location of the library containing the widgets and the class-names of the widgets, which should be loaded, must be defined in an XML-file. The creation of a widget is done by the inherited static method createObject(XMLNode *xml), which searches for the library and creates the demanded widget.

The abstract Widget -class is a sub-class of the MenuObject -class and provides all the usefull stuff like creating a SceneGraph -Object and removing it from the global scene, if the object has been deleted.

Widgets may use parts of the core-package like the Registry. But including the Registry leads to troubles, because the core-package and the external library, which stores the widget, whould contain the Registry.

So three method-pointers are used to avoid these problem, which are initialized with the method void registerCallbacks(RegistryAnimation animate, RegistryAnimation unanimate, RegistryCallBack callback ).

Attention:

Because the widgets are created by library calls, simply deleting the widgets with delete may lead to crashes. Therefore the static method deleteObject(Widget *w) must be used for removing widgets.

Date:
23rd of March 2007
Author:
Thomas Weberndorfer
Updates:

  • removed all OSG-depending parts into the SceneGraph -class (26th of April 2007)
  • moved loading mechanism into the seperate class-file Loader (3rd of May 2007)
  • added pointers to the static methods of the Registry (6th May 2007)

Member Typedef Documentation

typedef void( * Widget::RegistryAnimation)(MenuObject *obj, const char *symbol) [protected]

This is the type-definition for method-pointers with the type of Registry::callAnimate and Registry::callUnAnimate.

typedef void( * Widget::RegistryCallBack)(const char *name, const char *value) [protected]

This is the type-definition for method-pointers with the type of Registry::callCallBack.


Constructor & Destructor Documentation

Widget::Widget ( XMLNode xml  )  [protected]

The constructor is used to load the XMLNode -data for setting up the transformation, name, library-path, classname, etc. of the widget. Therefore the XMLNode -object has to focus on the correct XML-node in the XML-file.

This constructor is protected, because only the inherited factory-method Widget* createObject(XMLNode *xml) is allowed to call it.

Parameters:
xml Use an XMLNode -object, which focuses on the correct node.

virtual Widget::~Widget (  )  [inline, virtual]

The destructor has nothing to do ...


Member Function Documentation

virtual void Widget::pressed (  )  [pure virtual]

This method will be call, when a witget has been pressed by the user.

Implemented in Background, Bar, Button, Checkbox, and Radiobox.

void Widget::registerCallbacks ( RegistryAnimation  animate,
RegistryAnimation  unanimate,
RegistryCallBack  callback 
) [inline]

This method initializes the method-pointers to the static methods of the Registry -class.

Parameters:
animate pointer to Registry::callAnimate
unanimate pointer to Registry::callUnAnimate
callback pointer to Registry::callCallBack

virtual void Widget::released (  )  [pure virtual]

This method will be call, when a witget has been released by the user.

Implemented in Background, Bar, Button, Checkbox, and Radiobox.


Member Data Documentation

Use this method pointer instead of Registry::callAnimate!

Use this method pointer instead of Registry::callCallBack!

Use this method pointer instead of Registry::callUnAnimate!


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

Generated on Wed Oct 20 16:12:02 2010 for inVRs by doxygen 1.5.8