Klamp't  0.9.0
Public Member Functions | Public Attributes | List of all members
Klampt::GenericGUIBase Class Reference

A base class for a GUI frontend. Performs message passing to the backend in the easily serializable AnyCollection format. More...

#include <GenericGUI.h>

Inheritance diagram for Klampt::GenericGUIBase:

Public Member Functions

 GenericGUIBase (GenericBackendBase *backend)
virtual void Run ()
 Default implementation does nothing but startup and shutdown the interface.
virtual bool ProcessMessage (const AnyCollection &msg)
virtual bool SendMessage (const AnyCollection &msg)
 Send a message to the interface.
void AddRule (const AnyCollection &inschema, const AnyCollection &outschema, bool mapWildcardStrings=true)
void AddCommandRule (const AnyCollection &inschema, const string &cmd, const string &args, bool mapWildcardStrings=true)
 Convenience function to map a wildcard rule to a command (emulating RPC)
bool LoadRules (const char *fn)
bool LoadRules (istream &in)
virtual bool OnQuit ()
virtual bool OnCommand (const string &cmd, const string &args)
virtual bool OnNotify (const string &text, const string &msglevel)
virtual bool OnPauseIdle (double secs)
virtual bool OnRefresh ()
virtual bool OnResize (int w, int h)
virtual bool OnDrawText (double x, double y, double z, const std::string &text, int height)
virtual bool OnDrawText (int x, int y, const std::string &text, int height)
bool SendIdle ()
bool SendGLRender ()
bool SendGLViewport (int x, int y, int w, int h)
bool SendCommand (const string &cmd, const string &args)
bool SendCommand (const string &cmd)
template<class T >
bool SendCommand (const string &cmd, const T &arg1)
template<class T1 , class T2 >
bool SendCommand (const string &cmd, const T1 &arg1, const T2 &arg2)
template<class T1 , class T2 , class T3 >
bool SendCommand (const string &cmd, const T1 &arg1, const T2 &arg2, const T3 &arg3)
bool SendButtonPress (const string &widget)
bool SendButtonToggle (const string &widget, int checked)
bool SendWidgetValue (const string &widget, const string &value)
bool SendMouseClick (int button, int state, int mx, int my)
bool SendMouseMove (int mx, int my)
bool SendMouseWheel (int dwheel)
bool SendScroll (int dy)
bool SendKeyDown (const string &key)
bool SendKeyUp (const string &key)
bool SendSpaceball (const Math3D::RigidTransform &T)
bool SendDevice (const string &name, const string &data)

Public Attributes

vector< pair< AnyCollection, AnyCollection > > rules

Detailed Description

A base class for a GUI frontend. Performs message passing to the backend in the easily serializable AnyCollection format.

Along with a GenericBackendBase, implements a GUI program.

Empty hooks for several default GUI functions are provided. Subclasses should implement these hooks.

Currently, only OpenGL is allowed for drawing. Implementations might pass geometry data back and forth from frontend to backend, or a shared canvas object could be passed to the backend on construction.

Member Function Documentation

void Klampt::GenericGUIBase::AddRule ( const AnyCollection &  inschema,
const AnyCollection &  outschema,
bool  mapWildcardStrings = true 

Message mappings: translate one message to another via wildcard-matched rules (see AnyMapping.h for more details). The constants _Any, _0, _1, ..., _10 can be used to capture wildcards.

virtual bool Klampt::GenericGUIBase::ProcessMessage ( const AnyCollection &  msg)

This callback will be called by the interface. The default implementation dispatches to the On[X] callbacks depending on the value of the msg.type item

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