33#ifndef _GENERIC_GUI_OBJECT_H
34#define _GENERIC_GUI_OBJECT_H
39#include <util/coExport.h>
51class GenericGuiObject;
59 std::map<std::string, GenericGuiObject *>
parents;
70 GuiParam(std::string parentName, std::string name)
71 : parentName_(parentName)
93 std::string parentName_;
100 GuiParamBool(std::string parentName, std::string name,
bool defaultValue);
113 bool c = (value != value_);
117 tuiToggleButton->setState(value);
121 void setValueFromGui(
const char *value)
123 value_ = (strcmp(value,
"0") != 0);
125 std::string getValueAsString()
127 return value_ ?
"1" :
"0";
129 std::string getDefaultValueAsString()
131 return defaultValue_ ?
"1" :
"0";
134 bool value_, defaultValue_;
135 virtual void tabletEvent(coTUIElement *tUIItem);
136 coTUIToggleButton *tuiToggleButton;
142 GuiParamInt(std::string parentName, std::string name,
int defaultValue);
155 bool c = (value != value_);
159 tuiEdit->setValue(value);
163 void setValueFromGui(
const char *value)
165 value_ = atoi(value);
167 std::string getValueAsString()
169 std::stringstream sstr;
173 std::string getDefaultValueAsString()
175 std::stringstream sstr;
176 sstr << defaultValue_;
180 int value_, defaultValue_;
181 virtual void tabletEvent(coTUIElement *tUIItem);
182 coTUIEditIntField *tuiEdit;
183 coTUILabel *tuiLabel;
189 GuiParamFloat(std::string parentName, std::string name,
float defaultValue);
202 bool c = (value != value_);
209 void setValueFromGui(
const char *value)
211 value_ = atof(value);
213 std::string getValueAsString()
215 std::stringstream sstr;
219 std::string getDefaultValueAsString()
221 std::stringstream sstr;
222 sstr << defaultValue_;
226 float value_, defaultValue_;
227 virtual void tabletEvent(coTUIElement *tUIItem);
228 coTUIEditFloatField *tuiEdit;
229 coTUILabel *tuiLabel;
235 GuiParamString(std::string parentName, std::string name, std::string defaultValue);
248 bool c = (value != value_);
255 void setValueFromGui(
const char *value)
257 value_ = std::string(value);
259 std::string getValueAsString()
263 std::string getDefaultValueAsString()
265 return defaultValue_;
268 std::string value_, defaultValue_;
269 virtual void tabletEvent(coTUIElement *tUIItem);
270 coTUIEditField *tuiEdit;
271 coTUILabel *tuiLabel;
277 GuiParamVec3(std::string parentName, std::string name, osg::Vec3 defaultValue)
279 , value_(defaultValue)
280 , defaultValue_(defaultValue)
296 bool c = (value != value_);
303 void setValueFromGui(
const char *value)
305 std::stringstream sstr(value);
307 for (
int i = 0; i < 3; ++i)
309 getline(sstr, s,
'/');
310 value_[i] = atof(s.c_str());
313 std::string getValueAsString()
315 std::stringstream sstr;
316 sstr << value_[0] <<
"/" << value_[1] <<
"/" << value_[2];
319 std::string getDefaultValueAsString()
321 std::stringstream sstr;
322 sstr << defaultValue_[0] <<
"/" << defaultValue_[1] <<
"/" << defaultValue_[2];
326 osg::Vec3 value_, defaultValue_;
332 GuiParamMatrix(std::string parentName, std::string name, osg::Matrix defaultValue)
334 , value_(defaultValue)
335 , defaultValue_(defaultValue)
351 bool c = (value != value_);
358 void setValueFromGui(
const char *value)
360 std::stringstream sstr(value);
362 for (
int i = 0; i < 4; ++i)
363 for (
int j = 0; j < 4; ++j)
365 getline(sstr, s,
'/');
366 value_(i, j) = atof(s.c_str());
369 std::string getValueAsString()
371 std::stringstream sstr;
372 sstr << value_(0, 0) <<
"/" << value_(0, 1) <<
"/" << value_(0, 2) <<
"/" << value_(0, 3) <<
"/" << value_(1, 0) <<
"/" << value_(1, 1) <<
"/" << value_(1, 2) <<
"/" << value_(1, 3) <<
"/" << value_(2, 0) <<
"/" << value_(2, 1) <<
"/" << value_(2, 2) <<
"/" << value_(2, 3) <<
"/" << value_(3, 0) <<
"/" << value_(3, 1) <<
"/" << value_(3, 2) <<
"/" << value_(3, 3);
375 std::string getDefaultValueAsString()
377 std::stringstream sstr;
378 sstr << defaultValue_(0, 0) <<
"/" << defaultValue_(0, 1) <<
"/" << defaultValue_(0, 2) <<
"/" << defaultValue_(0, 3) <<
"/" << defaultValue_(1, 0) <<
"/" << defaultValue_(1, 1) <<
"/" << defaultValue_(1, 2) <<
"/" << defaultValue_(1, 3) <<
"/" << defaultValue_(2, 0) <<
"/" << defaultValue_(2, 1) <<
"/" << defaultValue_(2, 2) <<
"/" << defaultValue_(2, 3) <<
"/" << defaultValue_(3, 0) <<
"/" << defaultValue_(3, 1) <<
"/" << defaultValue_(3, 2) <<
"/" << defaultValue_(3, 3);
382 osg::Matrix value_, defaultValue_;
405 return (ParamPos - 1);
414 std::string genericObjectName_;
415 std::map<std::string, GuiParam *> guiParams_;
Tablet user interface proxy classes.
Definition: ARToolKit.h:33
Definition: coTabletUI.h:672
Action listener for events triggered by any coTUIElement.
Definition: coTUIListener.h:61
Definition: GenericGuiObject.h:53
GuiTuiMapper()
Definition: GenericGuiObject.h:55
~GuiTuiMapper()
Definition: GenericGuiObject.h:56
int getParentID(std::string &name)
static GuiTuiMapper * instance()
std::map< std::string, GenericGuiObject * > parents
Definition: GenericGuiObject.h:59
Definition: GenericGuiObject.h:66
virtual std::string getDefaultValueAsString()=0
virtual ~GuiParam()
Definition: GenericGuiObject.h:76
GuiParam(std::string parentName, std::string name)
Definition: GenericGuiObject.h:70
virtual void setValueFromGui(const char *value)=0
virtual std::string getValueAsString()=0
GenericGuiObject * e
Definition: GenericGuiObject.h:90
std::string getName()
Definition: GenericGuiObject.h:78
Definition: GenericGuiObject.h:98
GuiParamBool(std::string parentName, std::string name, bool defaultValue)
int getType()
Definition: GenericGuiObject.h:103
bool getValue()
Definition: GenericGuiObject.h:107
void setValue(bool value)
Definition: GenericGuiObject.h:111
Definition: GenericGuiObject.h:140
void setValue(int value)
Definition: GenericGuiObject.h:153
int getValue()
Definition: GenericGuiObject.h:149
GuiParamInt(std::string parentName, std::string name, int defaultValue)
int getType()
Definition: GenericGuiObject.h:145
Definition: GenericGuiObject.h:187
float getValue()
Definition: GenericGuiObject.h:196
GuiParamFloat(std::string parentName, std::string name, float defaultValue)
int getType()
Definition: GenericGuiObject.h:192
void setValue(float value)
Definition: GenericGuiObject.h:200
Definition: GenericGuiObject.h:233
int getType()
Definition: GenericGuiObject.h:238
void setValue(std::string value)
Definition: GenericGuiObject.h:246
std::string getValue()
Definition: GenericGuiObject.h:242
GuiParamString(std::string parentName, std::string name, std::string defaultValue)
Definition: GenericGuiObject.h:275
osg::Vec3 getValue()
Definition: GenericGuiObject.h:290
~GuiParamVec3()
Definition: GenericGuiObject.h:284
int getType()
Definition: GenericGuiObject.h:286
GuiParamVec3(std::string parentName, std::string name, osg::Vec3 defaultValue)
Definition: GenericGuiObject.h:277
void setValue(osg::Vec3 value)
Definition: GenericGuiObject.h:294
Definition: GenericGuiObject.h:330
int getType()
Definition: GenericGuiObject.h:341
~GuiParamMatrix()
Definition: GenericGuiObject.h:339
osg::Matrix getValue()
Definition: GenericGuiObject.h:345
GuiParamMatrix(std::string parentName, std::string name, osg::Matrix defaultValue)
Definition: GenericGuiObject.h:332
void setValue(osg::Matrix value)
Definition: GenericGuiObject.h:349
Definition: GenericGuiObject.h:386
int getNextPos()
Definition: GenericGuiObject.h:402
GuiParamVec3 * addGuiParamVec3(std::string paramName, osg::Vec3 defaultValue)
virtual ~GenericGuiObject()
GuiParamMatrix * addGuiParamMatrix(std::string paramName, osg::Matrix defaultValue)
GuiParamBool * addNextPresStepAllowed(bool defaultValue)
GuiParamFloat * addGuiParamFloat(std::string paramName, float defaultValue)
GuiParamString * addGuiParamString(std::string paramName, std::string defaultValue)
coTUITab * tab
Definition: GenericGuiObject.h:401
GuiParamInt * addGuiParamInt(std::string paramName, int defaultValue)
void guiToRenderMsg(const char *msg)
GuiParamBool * addGuiParamBool(std::string paramName, bool defaultValue)
virtual void guiParamChanged(GuiParam *guiParam)
Definition: GenericGuiObject.h:407
GenericGuiObject(std::string genericObjectName)