Changeset 3305 in orxonox.OLD for orxonox/branches/updater/src/gui/orxonox_gui_gtk.cc
- Timestamp:
- Dec 29, 2004, 12:05:29 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/updater/src/gui/orxonox_gui_gtk.cc
r3304 r3305 37 37 extern OrxonoxGuiFlags* flags; 38 38 39 #ifdef HAVE_GTK240 39 /** 41 40 \brief Initializes the Guis GTK-stuff. … … 43 42 \param argv The Argument strings. 44 43 */ 45 bool initGTK(int argc, char *argv[]) 46 { 44 bool initGUI(int argc, char *argv[]) 45 { 46 #ifdef HAVE_GTK2 47 47 #ifdef HAVE_GTHREAD 48 48 PRINTF(3)("Initializing the ThreadSystem of the GUI\n"); … … 52 52 gtk_init (&argc, &argv); 53 53 gtk_rc_parse( "rc" ); 54 } 54 #endif /* HAVE_GTK2 */ 55 } 56 55 57 56 58 /** 57 59 \brief enters the GTK-main-loop 58 60 */ 59 bool mainloopGTK(void) 60 { 61 bool mainloopGUI(void) 62 { 63 #ifdef HAVE_GTK2 61 64 gdk_threads_enter(); 62 65 gtk_main(); 63 66 gdk_threads_leave(); 64 67 delete Window::mainWindow; 65 } 66 #endif /* HAVE_GTK2 */ 68 #endif /* HAVE_GTK2 */ 69 } 67 70 68 71 … … 154 157 Widget* Widget::findWidgetByName(char* name, unsigned int depth) 155 158 { 156 Widget* tmp = NULL;157 159 158 160 if (this->title && !strcmp(this->title, name)) … … 160 162 161 163 if (this->isOption < 0 && static_cast<Packer*>(this)->down) 162 tmp = static_cast<Packer*>(this)->down->findWidgetByName(name, depth+1); 163 if (tmp) 164 return tmp; 165 164 { 165 Widget* tmp = static_cast<Packer*>(this)->down->findWidgetByName(name, depth+1); 166 if (tmp) 167 return tmp; 168 } 166 169 167 170 if (depth>0 && this->next) … … 206 209 207 210 /** 208 \brief This is for listing the option of "widget"211 \brief This is for listing the options of "widget" 209 212 \param widget specifies the widget that should be listed 210 213 */ 211 void Widget::listOptions (Widget* widget)214 void Widget::listOptionsAndGroups (Widget* widget) 212 215 { 213 216 if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName) … … 219 222 } 220 223 224 /** 225 \brief This is for listing the options of "widget" 226 \param widget specifies the widget that should be listed 227 */ 228 void Widget::listOptions (Widget* widget) 229 { 230 if (widget->isOption >= 1 && widget->isOption <= 3) 231 cout << " " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl; 232 else if (widget->isOption == 5) 233 cout << " " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl; 234 } 235 236 /** 237 \brief This is for listing the options of "widget" 238 \param widget specifies the widget that should be listed 239 \param data A Counter, that always knows how many Options have been found yet. 240 */ 241 void Widget::listOptions (Widget* widget, void* data) 242 { 243 244 if (widget->isOption >= 1 && widget->isOption <= 3) 245 { 246 int* count = (int*)data; 247 *count = *count +1; 248 cout << *count << ": " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl; 249 } 250 else if (widget->isOption == 5) 251 { 252 int* count = (int*)data; 253 *count = *count +1; 254 cout << *count << ": " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl; 255 } 256 } 257 258 /** 259 \brief Finds an Option by a given number (the n'th option found away from this Widget) 260 \param number The Count of options to wait (by reference) 261 \param depth The depth of the sarch. if 0 it will not search next pointer 262 263 \todo should return Option* would be much sexier. 264 */ 265 Widget* Widget::findOptionByNumber(int* number, unsigned int depth) 266 { 267 if (isOption > 0) 268 { 269 --*number; 270 if (*number <= 0) 271 { 272 return this; 273 } 274 } 275 if (this->isOption < 0 && static_cast<Packer*>(this)->down) 276 { 277 Widget* tmp = static_cast<Packer*>(this)->down->findOptionByNumber(number, depth+1); 278 if (tmp) 279 return tmp; 280 } 281 if (depth>0 && this->next) 282 return this->next->findOptionByNumber(number, depth); 283 284 return NULL; 285 } 286 287 /** 288 \brief This is for listing the groups of "widget" 289 \param widget specifies the widget that should be listed 290 */ 291 void Widget::listGroups(Widget* widget) 292 { 293 if(widget->isOption < 0 && static_cast<Packer*>(widget)->groupName) 294 cout << "[" << static_cast<Packer*>(widget)->groupName << "]\n"; 295 } 296 297 /** 298 \brief This is for listing the Groups of "widget". It also displays the n'th number found. 299 \param widget specifies the widget that should be listed 300 \param data the Counter, that will show the number (this function will raise it by one if a Group is fount. 301 */ 302 void Widget::listGroups(Widget* widget, void* data) 303 { 304 if(widget->isOption < 0 && static_cast<Packer*>(widget)->groupName) 305 { 306 int* count = (int*)data; 307 *count = *count +1; 308 cout << *count <<": [" << static_cast<Packer*>(widget)->groupName << "]\n"; 309 } 310 } 311 312 /** 313 \brief Finds a Group by a given number (the n'th Group found away from this Widget) 314 \param number The Count of options to wait (by reference) 315 \param depth The depth of the sarch. if 0 it will not search next pointer 316 */ 317 Widget* Widget::findGroupByNumber(int* number, unsigned int depth) 318 { 319 if (isOption < 0 && static_cast<Packer*>(this)->groupName) 320 { 321 --*number; 322 if (*number <= 0) 323 { 324 return this; 325 } 326 } 327 if (this->isOption < 0 && static_cast<Packer*>(this)->down) 328 { 329 Widget* tmp = static_cast<Packer*>(this)->down->findGroupByNumber(number, depth+1); 330 if (tmp) 331 return tmp; 332 } 333 if (depth>0 && this->next) 334 return this->next->findGroupByNumber(number, depth); 335 336 return NULL; 337 } 338 221 339 /** 222 340 \brief This is for setting the option of "widget"
Note: See TracChangeset
for help on using the changeset viewer.