Changeset 4319 in orxonox.OLD for orxonox/branches/physics/src
- Timestamp:
- May 27, 2005, 1:11:42 AM (20 years ago)
- Location:
- orxonox/branches/physics/src/lib/gui/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/lib/gui/gui/gui_gtk.cc
r4316 r4319 1249 1249 \param end The maximal Value of the slider. 1250 1250 */ 1251 Slider::Slider(const char* slidername, int start, int end)1252 { 1253 this->optionType = GUI_ INT;1251 Slider::Slider(const char* slidername, float start, float end) 1252 { 1253 this->optionType = GUI_FLOAT; 1254 1254 1255 1255 this->start = start; … … 1278 1278 Maybe you also require a Slider::redraw() for this to display 1279 1279 */ 1280 void Slider::setValue( int value)1281 { 1282 this-> value = value;1280 void Slider::setValue(float value) 1281 { 1282 this->fValue = value; 1283 1283 } 1284 1284 … … 1290 1290 { 1291 1291 #ifdef HAVE_GTK2 1292 gtk_range_set_value(GTK_RANGE(this->widget), this-> value);1292 gtk_range_set_value(GTK_RANGE(this->widget), this->fValue); 1293 1293 #endif /* HAVE_GTK2 */ 1294 1294 } … … 1300 1300 { 1301 1301 #ifdef HAVE_GTK2 1302 this-> value =(int)gtk_range_get_value(GTK_RANGE(this->widget));1302 this->fValue = gtk_range_get_value(GTK_RANGE(this->widget)); 1303 1303 #else /* HAVE_GTK2 */ 1304 1304 char tmpChar[20]; … … 1306 1306 scanf("%s", tmpChar); 1307 1307 1308 if ((this->value = atoi(tmpChar))> this->end) 1309 this->value = this->end; 1310 if (this->value <= this->start) 1311 this->value = this->start; 1312 1313 PRINT(0)("%s set to: %d\n",this->title, this->value); 1314 #endif /* HAVE_GTK2 */ 1315 } 1308 if ((this->fValue = atof(tmpChar))> this->end) 1309 this->fValue = this->end; 1310 if (this->fValue <= this->start) 1311 this->fValue = this->start; 1312 1313 PRINT(0)("%s set to: %d\n",this->title, this->fValue); 1314 #endif /* HAVE_GTK2 */ 1315 } 1316 1317 char* Slider::save(void) 1318 { 1319 char* value = new char [30]; 1320 sprintf (value, "%f", this->fValue); 1321 return value; 1322 } 1323 void Slider::load(char* loadString) 1324 { 1325 this->fValue = atof(loadString); 1326 PRINT(5)("Loading %s: %s %f\n", this->title, loadString, fValue); 1327 this->redraw(); 1328 } 1329 1316 1330 1317 1331 ////////// -
orxonox/branches/physics/src/lib/gui/gui/gui_gtk.h
r4178 r4319 296 296 { 297 297 private: 298 int start; //!< The beginning of the Slider-range. 299 int end; //!< The end of the Slider-range. 300 public: 301 Slider(const char* slidername, int start, int end); 298 float start; //!< The beginning of the Slider-range. 299 float end; //!< The end of the Slider-range. 300 float fValue; //!< a value for the slider 301 public: 302 Slider(const char* slidername, float start, float end); 302 303 virtual ~Slider(void); 303 304 304 void setValue(int value); 305 virtual void redraw(void); 306 virtual void changeOption(void); 305 void setValue(float value); 306 virtual void redraw(void); 307 virtual void changeOption(void); 308 309 virtual char* save(void); 310 virtual void load(char* loadString); 307 311 }; 308 312
Note: See TracChangeset
for help on using the changeset viewer.