Klamp't  0.8.1
Public Member Functions | Public Attributes | List of all members
CompositeBackend Class Reference

#include <GenericGUI.h>

Inheritance diagram for CompositeBackend:

Public Member Functions

void Add (std::shared_ptr< GenericBackendBase > &backend)
void SetDefaultBroadcasts ()
void SetBroadcast (const string &msgtype)
virtual bool ProcessMessage (const AnyCollection &msg)
- Public Member Functions inherited from GenericBackendBase
virtual void Start ()
 Default implementation of following do nothing.
virtual void Stop ()
virtual bool SendMessage (const AnyCollection &msg)
 Send a message to the gui.
void MapButtonPress (const string &button, int *var)
void MapButtonToggle (const string &button, int *var)
void MapWidgetValue (const string &button, string *var)
void MapKeyToggle (const string &key, int *var)
virtual bool OnIdle ()
virtual bool OnGLRender ()
virtual bool OnGLViewport (int x, int y, int w, int h)
virtual bool OnCommand (const string &cmd, const string &args)
virtual bool OnButtonPress (const string &button)
virtual bool OnButtonToggle (const string &button, int checked)
virtual bool OnWidgetValue (const string &widget, const string &value)
virtual bool OnMouseClick (int button, int state, int mx, int my)
virtual bool OnMouseMove (int mx, int my)
virtual bool OnMouseWheel (int dwheel)
virtual bool OnScroll (int dy)
virtual bool OnKeyDown (const string &key)
virtual bool OnKeyUp (const string &key)
virtual bool OnSpaceball (const Math3D::RigidTransform &T)
virtual bool OnDevice (const string &name, const string &data)
bool SendQuit ()
bool SendCommand (const string &cmd, const string &args)
bool SendNotify (const string &text, const string &msglevel="")
bool SendError (const string &text)
bool SendWarning (const string &text)
bool SendPauseIdle (double secs=1e300)
bool SendRefresh ()
bool SendResize (int w, int h)
bool SendDrawText (double x, double y, double z, const std::string &text, int height=10)
bool SendDrawText (int x, int y, const std::string &text, int height=10)

Public Attributes

vector< std::shared_ptr< GenericBackendBase > > children
map< string, string > targets
- Public Attributes inherited from GenericBackendBase
map< string, int * > liveButtonPresses
map< string, int * > liveButtonToggles
map< string, string * > liveWidgetValues
map< string, int * > liveKeys

Detailed Description

Composes a bunch of backends together.

On ProcessMessage, the message type is checked for whether it's in the list of targets. If not, the list of children are called in order until one successfully processes the message. If target[type]=="all" then all children are sent the message. If it's an integer, then only that child is sent that message.

This method is bit more modular than manual subclassing but manual subclassing gives more control over which messages get sent where.

Default broadcasts for now include:

Member Function Documentation

virtual bool CompositeBackend::ProcessMessage ( const AnyCollection &  msg)

This callback will be called by the gui. The default implementation dispatches to the On[X] callbacks depending on the msg.type string.

Reimplemented from GenericBackendBase.

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