Changeset 2586 in orxonox.OLD for orxonox/trunk/gui
- Timestamp:
- Oct 16, 2004, 6:47:41 PM (20 years ago)
- Location:
- orxonox/trunk/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/gui/orxonox_gui.cc
r2584 r2586 100 100 /* WIDGET */ 101 101 102 void Widget::init() 103 { 104 return; 105 } 106 102 107 void Widget::connectSignal (char* event, gint (*signal)(GtkWidget*, GdkEvent*, void *)) 103 108 { … … 133 138 void Widget::walkThrough (void (*function)(Widget*)) 134 139 { 140 /** 141 * Moves Through all the Widgets downwards from this and executes the function on them. 142 * function must be of type void and takes a Widget* as an Input. 143 */ 135 144 function(this); 136 145 switch (this->is_option) … … 152 161 { 153 162 /** 154 * This is For listing all the Options witch are located beneath this Widget.163 * This is for listing the option of "widget" 155 164 */ 156 165 if (widget->is_option >= 1) … … 161 170 { 162 171 /** 163 * This is For listing all the Options witch are located beneath this Widget.172 * This is for setting the option of "widget" 164 173 */ 165 174 if (widget->is_option >= 1) … … 168 177 169 178 /* CONTAINERS*/ 170 179 void Container::init (void) 180 { 181 return; 182 } 171 183 void Container::fill (Widget *lowerWidget) 172 184 { 173 185 /** 174 * fill any given Container with a lowerwidet186 * fills any given Container with a lowerwidet 175 187 */ 176 188 if (this->down == NULL) … … 192 204 * Creating a Window 193 205 */ 206 this->init(); 207 } 208 209 Window::Window (char* windowName) 210 { 211 /** 212 * Creating a Window with passing a name 213 */ 214 this->init(); 215 this->setTitle (windowName); 216 } 217 218 Window::~Window () 219 { 220 /** 221 * Destoying a Window (very BAD implemented) 222 */ 223 gtk_widget_hide (widget); 224 225 } 226 227 void Window::init() 228 { 229 /** 230 *initializes a new Window 231 */ 194 232 is_option = -1; 195 233 next = NULL; … … 197 235 widget = gtk_window_new (GTK_WINDOW_TOPLEVEL); 198 236 gtk_window_set_policy (GTK_WINDOW(widget), TRUE, TRUE, TRUE); 199 gtk_container_set_border_width (GTK_CONTAINER (widget), 3);200 }201 202 Window::Window (char* windowName)203 {204 /**205 * Creating a Window with passing a name206 */207 is_option = -1;208 next = NULL;209 down = NULL;210 widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);211 gtk_window_set_policy (GTK_WINDOW (widget), TRUE, TRUE, TRUE);212 gtk_container_set_border_width (GTK_CONTAINER (widget), 3);213 237 #if !defined(__WIN32__) 214 238 gtk_window_set_decorated (GTK_WINDOW (widget), FALSE); 215 239 #endif 216 this->setTitle (windowName); 217 } 218 219 Window::~Window () 220 { 221 /** 222 * Destoying a Window (very BAD implemented) 223 */ 224 gtk_widget_hide (widget); 225 240 gtk_container_set_border_width (GTK_CONTAINER (widget), 3); 226 241 } 227 242 … … 263 278 * Creates a new Frame without a name 264 279 */ 280 this->init(); 281 } 282 Frame::Frame (char* title) 283 { 284 /** 285 * Creates a new Frame with name title 286 */ 287 this->init(); 288 this->setTitle(title); 289 } 290 Frame::~Frame () 291 { 292 /** 293 * Destroys given Frame (not implemented yet) 294 */ 295 } 296 297 void Frame::init() 298 { 265 299 is_option = -1; 266 300 next = NULL; … … 269 303 gtk_container_set_border_width (GTK_CONTAINER (widget), 3); 270 304 } 271 Frame::Frame (char* title)272 {273 /**274 * Creates a new Frame with name title275 */276 is_option = -1;277 next = NULL;278 down = NULL;279 widget = gtk_frame_new (title);280 gtk_container_set_border_width (GTK_CONTAINER (widget), 3);281 }282 Frame::~Frame ()283 {284 /**285 * Destroys given Frame (not implemented yet)286 */287 }288 305 289 306 void Frame::setTitle (char* title) … … 297 314 // EVENTBOX // 298 315 EventBox::EventBox () 316 { 317 this->init(); 318 } 319 320 EventBox::EventBox (char* title) 321 { 322 /** 323 * Creates a new EventBox with name title 324 */ 325 this->init(); 326 this->setTitle(title); 327 328 } 329 void EventBox::init(void) 299 330 { 300 331 is_option = -1; … … 303 334 widget = gtk_event_box_new (); 304 335 gtk_container_set_border_width (GTK_CONTAINER (widget), 3); 305 } 306 307 EventBox::EventBox (char* title) 308 { 309 /** 310 * Creates a new EventBox with name title 311 */ 312 is_option = -1; 313 next = NULL; 314 down = NULL; 315 widget = gtk_event_box_new (); 316 gtk_container_set_border_width (GTK_CONTAINER (widget), 3); 317 318 } 336 337 } 338 339 319 340 void EventBox::setTitle (char* title) 320 341 { … … 336 357 * Creates a new horizontal Box 337 358 */ 338 is_option = -2; 339 next = NULL; 340 down = NULL; 341 widget = gtk_hbox_new(FALSE, 0); 359 this->init('h'); 342 360 } 343 361 Box::Box (char boxtype) … … 346 364 * Creates a new Box if boxtype is 'v' it will be vertically, if 'h' it will be horizontally 347 365 */ 366 this->init(boxtype); 367 } 368 Box::~Box () 369 { 370 /** 371 * Destroys given Frame (not implemented yet) 372 */ 373 } 374 375 void Box::init(char boxtype) 376 { 348 377 is_option = -2; 349 378 next = NULL; … … 359 388 } 360 389 361 Box::~Box ()362 {363 /**364 * Destroys given Frame (not implemented yet)365 */366 }367 390 368 391 void Box::fill (Widget *lowerWidget) … … 394 417 widget = gtk_image_new_from_file (imagename); 395 418 } 419 void Image::init() 420 { 421 422 } 396 423 397 424 398 425 /* OPTION */ 399 426 void Option::init() 427 { 428 return; 429 } 400 430 void Option::setFlagName (char* flagname, int defaultvalue) 401 431 { … … 423 453 * Creates a new Button with name buttonname 424 454 */ 455 this->init(); 456 this->setTitle(buttonname); 457 } 458 459 void Button::init(void) 460 { 425 461 is_option = 0; 426 462 value = 0; 427 463 next = NULL; 428 option_name = buttonname;464 option_name =""; 429 465 flag_name = ""; 430 466 flag_name_short = ""; 431 467 default_value = 0; 432 widget = gtk_button_new_with_label (buttonname); 468 widget = gtk_button_new_with_label (""); 469 } 470 471 void Button::setTitle (char *title) 472 { 473 option_name = title; 474 gtk_button_set_label (GTK_BUTTON(widget), title); 433 475 } 434 476 … … 443 485 * Creates a new CheckButton with name buttonname 444 486 */ 487 this->init(); 488 this->setTitle(buttonname); 489 490 this->connectSignal ("clicked", this->OptionChange); 491 } 492 CheckButton::~CheckButton() 493 { 494 } 495 496 void CheckButton::init(void) 497 { 445 498 is_option = 1; 446 499 value = 0; 447 500 next = NULL; 448 option_name = buttonname;501 option_name = ""; 449 502 flag_name = ""; 450 503 flag_name_short = ""; 451 504 default_value = 0; 452 widget = gtk_check_button_new_with_label (buttonname); 453 454 this->connectSignal ("clicked", this->OptionChange); 505 widget = gtk_check_button_new_with_label (""); 506 } 507 void CheckButton::setTitle(char* title) 508 { 509 option_name = title; 510 gtk_button_set_label(GTK_BUTTON(widget), title); 455 511 } 456 512 … … 476 532 * Creates a new Slider with name slidername a beginning value of start and an end value of end. 477 533 */ 534 this->init(start, end); 535 this->setValue(start); 536 this->setTitle(slidername); 537 this->connectSignal ("value_changed", this->OptionChange); 538 } 539 540 Slider::~Slider() 541 { 542 } 543 544 void Slider::init(int start, int end) 545 { 478 546 is_option = 2; 479 547 value = 0; 480 548 next = NULL; 481 option_name = slidername;549 option_name = ""; 482 550 flag_name = ""; 483 551 flag_name_short = ""; 484 552 default_value = 0; 485 553 widget = gtk_hscale_new_with_range (start, end, 5); 486 value = start; 487 488 this->connectSignal ("value_changed", this->OptionChange); 554 } 555 void Slider::setTitle(char* title) 556 { 557 option_name = title; 558 } 559 void Slider::setValue(int value) 560 { 561 this->value = value; 489 562 } 490 563 … … 534 607 } 535 608 609 void Menu::init(void) 610 { 611 } 612 536 613 gint Menu::OptionChange (GtkWidget *widget, Widget* menu) 537 614 { … … 551 628 Label:: Label () 552 629 { 630 this->init(); 631 } 632 633 Label:: Label (char* text) 634 { 635 is_option = 0; 636 next = NULL; 637 widget = gtk_label_new (text); 638 gtk_label_set_line_wrap (GTK_LABEL(widget), TRUE); 639 } 640 641 Label::~Label () 642 {} 643 644 void Label::init(void) 645 { 553 646 is_option = 0; 554 647 next = NULL; … … 557 650 gtk_label_set_line_wrap (GTK_LABEL(widget), TRUE); 558 651 } 559 560 Label:: Label (char* text)561 {562 is_option = 0;563 next = NULL;564 widget = gtk_label_new (text);565 gtk_label_set_line_wrap (GTK_LABEL(widget), TRUE);566 }567 568 Label::~Label ()569 {}570 652 571 653 void Label::setText (char * text) -
orxonox/trunk/gui/orxonox_gui.h
r2584 r2586 29 29 class Widget 30 30 { 31 private: 31 32 public: 32 33 Widget* next; 33 34 GtkWidget* widget; 35 virtual void init(void); 34 36 int is_option; 35 37 36 //virtual void create ();37 // void addWidget ();38 38 void connectSignal (char* event, gint (*signal)(GtkWidget*, GdkEvent*, void *)); 39 39 void connectSignal (char* event, gint (*signal)(GtkWidget*, Widget *)); … … 57 57 58 58 public: 59 void init(void); 59 60 Widget* down; 60 61 void setBorderWidth (int borderwidth); … … 69 70 Window (void); 70 71 ~Window (); 72 void init (); 71 73 72 74 void setTitle (char* title); … … 81 83 Frame (void); 82 84 ~Frame (); 85 void init(void); 83 86 84 87 void setTitle (char* title); … … 91 94 EventBox (void); 92 95 ~EventBox (); 93 96 void init(void); 97 94 98 void setTitle (char* title); 95 99 }; … … 101 105 Box (char boxtype); 102 106 ~Box (void); 107 void init(char boxtype); 103 108 104 109 Widget* down; … … 112 117 Image (char* imgaename); 113 118 ~Image (); 119 void init(void); 114 120 }; 115 121 … … 118 124 public: 119 125 //virtual gint OptionChange (GtkWidget *widget, GdkEvent *event, gpointer data); 120 126 void init(void); 127 121 128 int value; 122 129 char* option_name; … … 135 142 Button (char* buttonname); 136 143 ~Button (void); 144 void init(void); 145 146 void setTitle(char* title); 137 147 138 148 void redraw(); … … 145 155 ~CheckButton (void); 146 156 static gint OptionChange (GtkWidget* widget, Widget* checkbutton); 157 158 void init(void); 159 void setTitle(char* title); 160 147 161 void redraw (); 148 162 }; … … 153 167 Slider (char* slidername,int start, int end); 154 168 ~Slider (); 169 void init(int start, int end); 170 171 void setTitle(char* title); 172 void setValue(int value); 173 155 174 static gint OptionChange (GtkWidget* widget, Widget* slider); 156 175 void redraw(); … … 162 181 Menu (char* menuname, ...); 163 182 ~Menu (); 183 void init(void); /// HAS TO BE IMPLEMENTED!! most difficult :-) 164 184 165 185 static gint OptionChange (GtkWidget* widget, Widget* menu); … … 173 193 Label (char* text); 174 194 ~Label (); 195 void init(void); 175 196 176 197 void setText (char * text);
Note: See TracChangeset
for help on using the changeset viewer.