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

A base class for GLUI GUIs. More...

#include <GLUIGUI.h>

Inheritance diagram for Klampt::GLUIGUI:
Klampt::GenericGUIBase

Public Member Functions

 GLUIGUI (GenericBackendBase *backend=NULL, int w=800, int h=600)
 
void SetWindowTitle (const char *title)
 
void SetDisplayMode (int mode)
 
virtual bool Initialize ()
 Subclasses: put GL initialization code here.
 
virtual void Handle_Control (int id)
 
virtual void Handle_Display ()
 
virtual void Handle_Reshape (int w, int h)
 
virtual void Handle_Keypress (unsigned char key, int x, int y)
 
virtual void Handle_KeypressUp (unsigned char key, int x, int y)
 
virtual void Handle_Special (int key, int x, int y)
 
virtual void Handle_SpecialUp (int key, int x, int y)
 
virtual void Handle_Click (int button, int state, int x, int y)
 
virtual void Handle_Drag (int x, int y)
 
virtual void Handle_Motion (int x, int y)
 
virtual void Handle_Idle ()
 
int AddControl (GLUI_Control *, const char *name=NULL)
 
virtual void Run ()
 Default implementation does nothing but startup and shutdown the interface.
 
virtual bool OnQuit ()
 
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)
 
- Public Member Functions inherited from Klampt::GenericGUIBase
 GenericGUIBase (GenericBackendBase *backend)
 
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 OnCommand (const string &cmd, const string &args)
 
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

string window_title
 
unsigned int displayMode
 
vector< GLUI_Control * > controls
 
vector< string > controlNames
 
- Public Attributes inherited from Klampt::GenericGUIBase
GenericBackendBasebackend
 
vector< pair< AnyCollection, AnyCollection > > rules
 

Detailed Description

A base class for GLUI GUIs.

GLUI controls should not be setup with hooks and live variables – instead, pass them to AddControl, and this will automatically send status changes to the backend.

To add more complex functionality, you can override the Handle_Control method with the ID returned by AddControl.

Member Function Documentation

int Klampt::GLUIGUI::AddControl ( GLUI_Control *  ,
const char *  name = NULL 
)

Subclasses should call this when adding a new GUI element (No need to create and ID and pass ControlFunc to the element constructor) Returns the GLUI ID of the control

If name = NULL, then the button name is passed directly to the backend. If name = "", then the signal is not sent to the backend (used to bind controls to Handle_Control).

virtual void Klampt::GLUIGUI::Handle_Control ( int  id)
virtual

Subclasses: may override this to translate IDs to messages sent to the backend. Default sends the value of the control to the controlNames as set up via AddControl.


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