Changeset 2707 in orxonox.OLD for orxonox/branches/buerli/gui/orxonox_gui.cc
- Timestamp:
- Nov 3, 2004, 12:29:03 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/buerli/gui/orxonox_gui.cc
r2595 r2707 32 32 #include "orxonox_gui_flags.h" 33 33 #include "orxonox_gui_banner.h" 34 #include "orxonox_gui_keys.h" 34 35 35 36 Window* orxonoxGUI; … … 39 40 OrxonoxGuiFlags* flags; 40 41 OrxonoxGuiBanner* banner; 42 OrxonoxGuiKeys* keys; 41 43 42 44 int main( int argc, char *argv[] ) … … 49 51 50 52 /** 51 *Initializes the Gui53 \brief Initializes the Gui 52 54 */ 53 55 OrxonoxGui::OrxonoxGui (int argc, char *argv[]) … … 56 58 gtk_rc_parse( "rc" ); 57 59 58 orxonoxGUI = new Window( "Graphical Orxonox Launcher");60 orxonoxGUI = new Window( "Grafical OrxOnoX loader, "PACKAGE_VERSION ); 59 61 orxonoxGUI->connectSignal ("destroy", orxonoxGUI->orxonox_gui_quit); 60 62 orxonoxGUI->connectSignal ("delete_event", orxonoxGUI->orxonox_gui_quit); … … 75 77 76 78 optionBox->fill (avBox); 77 79 80 keys = new OrxonoxGuiKeys (); 81 optionBox->fill (keys->getWidget ()); 82 78 83 exec = new OrxonoxGuiExec (orxonoxGUI); 79 84 optionBox->fill (exec->getWidget ()); … … 99 104 100 105 /* WIDGET */ 101 /** 102 * Initializes a widget. 103 * Nothing to do here. 104 */ 106 107 /** 108 \brief deletes any given Widget 109 This is still pretty crappy. 110 */ 111 Widget::~Widget() 112 { 113 // cout << "hiding: " <<this->label <<"\n"; 114 this->hide(); 115 // cout << "check if Packer: "<<this->label <<"\n"; 116 if (this->is_option < 0) 117 { 118 // cout << "get Down "<<this->label <<"\n"; 119 static_cast<Packer*>(this)->down->~Widget(); 120 } 121 // cout << "next != NULL?: " <<this->label <<"\n"; 122 if (this->next != NULL) 123 this->next->~Widget(); 124 cout << "delete Widget: " <<this->label <<"\n"; 125 // delete widget; 126 } 127 128 /** 129 \brief Initializes a widget. 130 Initializes the next Pointer and the other Widget-specific Defaults. 131 */ 105 132 void Widget::init() 106 133 { 134 next = NULL; 135 label = ""; 107 136 return; 108 137 } 109 138 110 /** 111 * Connect any signal to any given Sub-widget 112 */ 139 /** 140 \brief makes the widget visible. 141 */ 142 void Widget::show() 143 { 144 gtk_widget_show (this->widget); 145 } 146 147 /** 148 \brief hides the widget. 149 */ 150 void Widget::hide() 151 { 152 gtk_widget_hide (this->widget); 153 } 154 155 /** 156 \brief Sets the resolution of a specific widget to the given size. 157 \param width the width of the widget to set. 158 \param height the height of the widget to set. 159 */ 160 void Widget::setSize(int width, int height) 161 { 162 gtk_widget_set_usize (this->widget, width, height); 163 } 164 165 /** 166 \brief Connect any signal to any given Sub-widget 167 */ 113 168 void Widget::connectSignal (char* event, gint (*signal)(GtkWidget*, GdkEvent*, void *)) 114 169 { … … 117 172 118 173 /** 119 *Connect a signal with additionally passing the whole Object120 174 \brief Connect a signal with additionally passing the whole Object 175 */ 121 176 void Widget::connectSignal (char* event, gint (*signal)( GtkWidget*, Widget *)) 122 177 { … … 125 180 126 181 /** 127 *Connect a signal with additionally passing a whole external Object128 182 \brief Connect a signal with additionally passing a whole external Object 183 */ 129 184 void Widget::connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEvent*, void *)) 130 185 { … … 132 187 } 133 188 134 135 /** 136 * Function to Shows a specific widget. 137 */ 138 void Widget::show() 139 { 140 gtk_widget_show (this->widget); 141 } 142 143 /** 144 * Moves through all the Widgets downwards from this and executes the function on them. 145 \param function must be of type void and takes a Widget* as an Input. 146 147 */ 189 /** 190 \brief Moves through all the Widgets downwards from this and executes the function on them. 191 \param function must be of type void and takes a Widget* as an Input. 192 */ 148 193 void Widget::walkThrough (void (*function)(Widget*)) 149 194 { 150 195 function(this); 151 switch (this->is_option)196 if (this->is_option < 0) 152 197 { 153 case -1: 154 static_cast<Container*>(this)->down->walkThrough (function); 155 break; 156 case -2: 157 static_cast<Box*>(this)->down->walkThrough (function); 158 break; 198 static_cast<Packer*>(this)->down->walkThrough (function); 159 199 } 160 200 … … 163 203 } 164 204 165 166 /** 167 * This is for listing the option of "widget" 168 \param widget specifies the widget that should be listed 205 /** 206 \brief This is for listing the option of "widget" 207 \param widget specifies the widget that should be listed 169 208 */ 170 209 void Widget::listOptions (Widget* widget) 171 210 { 172 211 if (widget->is_option >= 1) 173 cout << static_cast<Option*>(widget)-> option_name<<" is : " << static_cast<Option*>(widget)->value <<endl;174 } 175 176 /** 177 *This is for setting the option of "widget"178 \param widget specifies the widget that should be set.212 cout << static_cast<Option*>(widget)->label <<" is : " << static_cast<Option*>(widget)->value <<endl; 213 } 214 215 /** 216 \brief This is for setting the option of "widget" 217 \param widget specifies the widget that should be set. 179 218 */ 180 219 void Widget::setOptions (Widget* widget) … … 184 223 } 185 224 186 /* CONTAINERS*/ 187 188 /** 189 * Initializes a Container. 190 * nothing to do here 191 */ 225 //void deleteWidget(Widget* lastWidget) 226 227 228 /* PACKERS */ 229 230 /** 231 \brief Initializes a Packer. 232 Sets the down-pinter to NULL and other PackerSpecific-values to their defaults. 233 */ 234 void Packer::init (void) 235 { 236 down = NULL; 237 this->setGroupName (""); 238 239 240 static_cast<Widget*>(this)->init(); 241 return; 242 } 243 244 /** 245 \brief Sets the group name under which all the lower widgets of this will be saved. 246 \param name The name of the group. 247 */ 248 void Packer::setGroupName (char* name) 249 { 250 groupName = name; 251 } 252 253 /** 254 \brief Retrieves the group name under which all the lower widgets of this will be saved. 255 \returns name The name of the group. 256 */ 257 char* Packer::getGroupName (void) 258 { 259 return groupName; 260 } 261 262 /* CONTAINERS */ 263 264 /** 265 \brief Initializes a Container. 266 sets the Container-Specific defaults. 267 */ 192 268 void Container::init (void) 193 269 { 270 is_option = -1; 271 272 static_cast<Packer*>(this)->init(); 273 194 274 return; 195 275 } 196 276 197 277 /** 198 *Fills a Container with lowerWidget.199 *It does this by filling up the down pointer only if down points to NULL.200 \param lowerWidget the Widget that should be filled into the Container.278 \briefFills a Container with lowerWidget. 279 It does this by filling up the down pointer only if down points to NULL. 280 \param lowerWidget the Widget that should be filled into the Container. 201 281 */ 202 282 void Container::fill (Widget *lowerWidget) … … 215 295 /* WINDOW */ 216 296 217 218 *Creating a new Window without a Name219 297 /** 298 \brief Creating a new Window without a Name 299 */ 220 300 Window::Window (void) 221 301 { … … 224 304 225 305 /** 226 *Creating a Window with a name227 \param windowName the name the window should get.228 306 \brief Creating a Window with a name 307 \param windowName the name the window should get. 308 */ 229 309 Window::Window (char* windowName) 230 310 { … … 234 314 235 315 /** 236 * Destoying a Window (very BAD implemented). 237 * For now it just hides the window. 238 */ 239 Window::~Window () 240 { 241 gtk_widget_hide (widget); 242 } 243 244 /** 245 *initializes a new Window 246 */ 316 \brief initializes a new Window 317 */ 247 318 void Window::init() 248 319 { 249 is_option = -1; 250 next = NULL; 251 down = NULL; 320 isOpen = true; 321 322 static_cast<Container*>(this)->init(); 323 252 324 widget = gtk_window_new (GTK_WINDOW_TOPLEVEL); 253 325 gtk_window_set_policy (GTK_WINDOW(widget), TRUE, TRUE, TRUE); … … 259 331 260 332 /** 261 *Shows all Widgets that are included within this->widget.262 333 \brief Shows all Widgets that are included within this->widget. 334 */ 263 335 void Window::showall () 264 336 { 337 isOpen = true; 265 338 gtk_widget_show_all (widget); 266 339 } 267 340 268 341 /** 269 *Set The Window-title to title270 \param title title the Window should get.342 \brief Set The Window-title to title 343 \param title title the Window should get. 271 344 */ 272 345 void Window::setTitle (char* title) 273 346 { 347 label=title; 274 348 gtk_window_set_title (GTK_WINDOW (widget), title); 275 349 } … … 295 369 296 370 /** 297 *Creates a new Frame without a name298 371 \brief Creates a new Frame without a name 372 */ 299 373 Frame::Frame (void) 300 374 { … … 303 377 304 378 /** 305 *Creates a new Frame with name title306 379 \brief Creates a new Frame with name title 380 */ 307 381 Frame::Frame (char* title) 308 382 { … … 311 385 } 312 386 313 /** 314 * Destroys given Frame (not implemented yet) 315 */ 316 Frame::~Frame () 317 { 318 } 319 320 /** 321 * Initializes a new Frame with default settings 322 */ 387 /** 388 \brief Initializes a new Frame with default settings 389 */ 323 390 void Frame::init() 324 391 { 325 is_option = -1; 326 next = NULL; 327 down = NULL; 392 static_cast<Container*>(this)->init(); 393 328 394 widget = gtk_frame_new (""); 329 395 gtk_container_set_border_width (GTK_CONTAINER (widget), 3); … … 331 397 332 398 /** 333 *Sets the Frames name to title334 \param title The title the Frame should get.335 399 \brief Sets the Frames name to title 400 \param title The title the Frame should get. 401 */ 336 402 void Frame::setTitle (char* title) 337 403 { 404 label = title; 338 405 gtk_frame_set_label (GTK_FRAME (widget), title); 339 406 } … … 342 409 343 410 /** 344 *Creates a new EventBox with default settings.345 411 \brief Creates a new EventBox with default settings. 412 */ 346 413 EventBox::EventBox () 347 414 { … … 349 416 } 350 417 /** 351 *Creates a new EventBox with name title352 \param title title the Eventbox should get (only data-structure-internal)418 \brief Creates a new EventBox with name title 419 \param title title the Eventbox should get (only data-structure-internal) 353 420 */ 354 421 EventBox::EventBox (char* title) … … 360 427 361 428 /** 362 *Initializes a new EventBox363 429 \brief Initializes a new EventBox 430 */ 364 431 void EventBox::init(void) 365 432 { 366 433 is_option = -1; 367 next = NULL; 368 down = NULL; 434 435 static_cast<Container*>(this)->init(); 436 369 437 widget = gtk_event_box_new (); 370 438 gtk_container_set_border_width (GTK_CONTAINER (widget), 3); … … 373 441 374 442 /** 375 *Sets the Title of the EventBox (not implemented)376 \param title Name the EventBox should get (only datastructure-internal).443 \brief Sets the Title of the EventBox (not implemented) 444 \param title Name the EventBox should get (only datastructure-internal). 377 445 */ 378 446 void EventBox::setTitle (char* title) 379 447 { 380 381 } 382 383 /** 384 * Destructs an EventBox (not Implemented) 385 */ 386 EventBox::~EventBox () 387 { 388 } 389 448 label = title; 449 } 390 450 391 451 /* BOX */ 392 452 393 453 /** 394 *Creates a new horizontal Box395 454 \brief Creates a new horizontal Box 455 */ 396 456 Box::Box (void) 397 457 { … … 400 460 401 461 /** 402 *Creates a new Box of type boxtype403 \param boxtype if 'v' the Box will be vertically, if 'h' the Box will be horizontally404 462 \brief Creates a new Box of type boxtype 463 \param boxtype if 'v' the Box will be vertically, if 'h' the Box will be horizontally 464 */ 405 465 Box::Box (char boxtype) 406 466 { … … 409 469 410 470 /** 411 * Destroys given Box (not implemented yet) 412 */ 413 Box::~Box () 414 { 415 } 416 417 /** 418 * Initializes a new Box with type boxtype 419 \param boxtype see Box(char boxtype) 471 \brief Initializes a new Box with type boxtype 472 \param boxtype see Box(char boxtype) 420 473 */ 421 474 void Box::init(char boxtype) 422 475 { 423 476 is_option = -2; 424 next = NULL; 425 down = NULL;477 478 static_cast<Packer*>(this)->init(); 426 479 if (boxtype == 'v') 427 480 { … … 435 488 436 489 /** 437 *Fills a box with a given Widget.438 *It does this by apending the first one to its down-pointer and all its following ones to the preceding next-pointer. The last one will receive a NULL pointer as Next439 \param lowerWidget the next Widget that should be appendet to this Box440 490 \brief Fills a box with a given Widget. 491 It does this by apending the first one to its down-pointer and all its following ones to the preceding next-pointer. The last one will receive a NULL pointer as Next 492 \param lowerWidget the next Widget that should be appendet to this Box 493 */ 441 494 void Box::fill (Widget *lowerWidget) 442 495 { 443 /**444 * Fill a Box with its lowerwidgets445 */446 496 gtk_box_pack_start (GTK_BOX (this->widget), lowerWidget->widget, TRUE, TRUE, 0); 447 497 if (this->down == NULL) … … 462 512 463 513 /** 464 *Creates a new Image465 \param imagename the location of the Image on the Hard Disc514 \brief Creates a new Image 515 \param imagename the location of the Image on the Hard Disc 466 516 */ 467 517 Image::Image (char* imagename) … … 469 519 this->init(); 470 520 widget = gtk_image_new_from_file (imagename); 471 } 472 473 /** 474 * Initializes a new Image 475 */ 521 label = imagename; 522 } 523 524 /** 525 \brief Initializes a new Image 526 */ 476 527 void Image::init() 477 528 { 478 529 is_option = 0; 479 next = NULL; 530 531 static_cast<Widget*>(this)->init(); 480 532 } 481 533 … … 484 536 485 537 /** 486 * Initializes a new Option: nothing to do here 487 */ 538 \brief Initializes a new Option. 539 sets all Option-Specific-Values to their defaults. 540 */ 488 541 void Option::init() 489 542 { 543 value = 0; 544 flag_name = ""; 545 flag_name_short = ""; 546 default_value = 0; 547 548 static_cast<Widget*>(this)->init(); 549 490 550 return; 491 551 } 492 552 493 553 /** 494 *This sets The FlagName of an Option and defines its default Values495 !! Options will be saved if flagname is different from "" !!496 \param flagname the Name that will be displayed in the output497 \param defaultvalue the default Value for this Option (see definition of defaultvalue554 \brief This sets The FlagName of an Option and defines its default Values 555 !! Options will be saved if flagname is different from "" !! 556 \param flagname the Name that will be displayed in the output 557 \param defaultvalue the default Value for this Option (see definition of defaultvalue 498 558 */ 499 559 void Option::setFlagName (char* flagname, int defaultvalue) … … 501 561 flag_name = flagname; 502 562 default_value = defaultvalue; 503 cout << "Set Flagname of " << option_name<< " to " << flagname << endl;504 } 505 506 /** 507 *see Option::setFlagName (char* flagname, int defaultvalue)508 \param flagname the Name that will be displayed in the output509 \param defaultvalue the default Value for this Option (see definition of defaultvalue510 \param flagnameshort a short flagname to be displayed in the output563 cout << "Set Flagname of " << label << " to " << flagname << endl; 564 } 565 566 /** 567 \brief see Option::setFlagName (char* flagname, int defaultvalue) 568 \param flagname the Name that will be displayed in the output 569 \param defaultvalue the default Value for this Option (see definition of defaultvalue 570 \param flagnameshort a short flagname to be displayed in the output 511 571 */ 512 572 void Option::setFlagName (char* flagname, char* flagnameshort, int defaultvalue) … … 515 575 flag_name_short = flagnameshort; 516 576 default_value = defaultvalue; 517 cout << "Set Flagname of " << option_name<< " to " << flagname << endl;577 cout << "Set Flagname of " << label << " to " << flagname << endl; 518 578 } 519 579 … … 522 582 523 583 /** 524 *Creates a new Button with a buttonname525 \param buttonname sets the Name of the Button584 \brief Creates a new Button with a buttonname 585 \param buttonname sets the Name of the Button 526 586 */ 527 587 Button::Button(char* buttonname) … … 532 592 533 593 /** 534 *Initializes a new Button535 594 \brief Initializes a new Button 595 */ 536 596 void Button::init(void) 537 597 { 538 598 is_option = 0; 539 value = 0; 540 next = NULL; 541 option_name =""; 542 flag_name = ""; 543 flag_name_short = ""; 544 default_value = 0; 599 600 static_cast<Option*>(this)->init(); 601 545 602 widget = gtk_button_new_with_label (""); 546 603 } 547 604 548 605 /** 549 *Sets a new name to the Button550 \param title The name the Button should get606 \brief Sets a new name to the Button 607 \param title The name the Button should get 551 608 */ 552 609 void Button::setTitle (char *title) 553 610 { 554 option_name= title;611 label = title; 555 612 gtk_button_set_label (GTK_BUTTON(widget), title); 556 613 } 557 614 558 615 /** 559 *redraws the Button560 *not implemented yet561 616 \brief redraws the Button 617 not implemented yet 618 */ 562 619 void Button::redraw () 563 620 { … … 567 624 568 625 /** 569 *Creates a new CheckButton with an ame570 \param buttonname The name the CheckButton should display.571 626 \brief Creates a new CheckButton with an ame 627 \param buttonname The name the CheckButton should display. 628 */ 572 629 CheckButton::CheckButton (char* buttonname) 573 630 { … … 578 635 } 579 636 580 /** 581 * Destructs a CheckButton (not Implemented yet). 582 */ 583 CheckButton::~CheckButton() 584 { 585 } 586 587 /** 588 * Initiali a new CheckButton with default settings 589 */ 637 /** 638 \brief Initialize a new CheckButton with default settings 639 */ 590 640 void CheckButton::init(void) 591 641 { 592 642 is_option = 1; 593 value = 0; 594 next = NULL; 595 option_name = ""; 596 flag_name = ""; 597 flag_name_short = ""; 598 default_value = 0; 643 644 static_cast<Option*>(this)->init(); 645 599 646 widget = gtk_check_button_new_with_label (""); 600 647 } 601 648 602 649 /** 603 *Sets a new Title to a CheckButton604 \param title The new Name the CheckButton should display.650 \brief Sets a new Title to a CheckButton 651 \param title The new Name the CheckButton should display. 605 652 */ 606 653 void CheckButton::setTitle(char* title) 607 654 { 608 option_name= title;655 label = title; 609 656 gtk_button_set_label(GTK_BUTTON(widget), title); 610 657 } … … 612 659 613 660 /** 614 *Signal OptionChange writes the Value from the CheckButton to its Object-Database.615 \param widget The widget(CheckButton) that has a changed Value616 \param checkbutton the CheckButton-Object that should receive the change.617 661 \brief Signal OptionChange writes the Value from the CheckButton to its Object-Database. 662 \param widget The widget(CheckButton) that has a changed Value 663 \param checkbutton the CheckButton-Object that should receive the change. 664 */ 618 665 gint CheckButton::OptionChange (GtkWidget *widget, Widget* checkbutton) 619 666 { 620 667 static_cast<CheckButton*>(checkbutton)->value = (int)gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON ((CheckButton*)checkbutton->widget)); 621 668 flags->setTextFromFlags(orxonoxGUI); 622 cout << static_cast<CheckButton*>(checkbutton)-> option_name<< " set to: " << static_cast<CheckButton*>(checkbutton)->value << endl;623 } 624 625 /** 626 *Redraws the CheckButton (if option has changed).627 *Example: if new settings are loaded the Button must be redrawn for the GUI to display that Change628 669 cout << static_cast<CheckButton*>(checkbutton)->label << " set to: " << static_cast<CheckButton*>(checkbutton)->value << endl; 670 } 671 672 /** 673 \brief Redraws the CheckButton (if option has changed). 674 Example: if new settings are loaded the Button must be redrawn for the GUI to display that Change 675 */ 629 676 void CheckButton::redraw () 630 677 { … … 635 682 636 683 /** 637 *Creates a new Slider638 \param slidername The data-structure-name of the slider.639 \param start The minimal Value of the slider.640 \param end The maximal Value of the slider.684 \brief Creates a new Slider 685 \param slidername The data-structure-name of the slider. 686 \param start The minimal Value of the slider. 687 \param end The maximal Value of the slider. 641 688 */ 642 689 Slider::Slider (char* slidername, int start, int end) … … 649 696 650 697 /** 651 * Destructs a Slider (not implemented yet) 652 */ 653 Slider::~Slider() 654 { 655 } 656 657 /** 658 * Initializes a Slider with start and end Values 659 * params: see Slider::Slider (char* slidername, int start, int end) 660 */ 698 \brief Initializes a Slider with start and end Values 699 params: see Slider::Slider (char* slidername, int start, int end) 700 */ 661 701 void Slider::init(int start, int end) 662 702 { 663 703 is_option = 2; 664 value = 0; 665 next = NULL; 666 option_name = ""; 667 flag_name = ""; 668 flag_name_short = ""; 669 default_value = 0; 704 705 static_cast<Option*>(this)->init(); 706 670 707 widget = gtk_hscale_new_with_range (start, end, 5); 671 708 } 672 709 673 710 /** 674 *Sets a new Title to the Slider675 \param title The new Name of the slider711 \brief Sets a new Title to the Slider 712 \param title The new Name of the slider 676 713 */ 677 714 void Slider::setTitle(char* title) 678 715 { 679 option_name= title;680 } 681 682 /** 683 *Setting a new value to the Slider.684 *Maybe you also require a Slider::redraw() for this to display685 716 label = title; 717 } 718 719 /** 720 \brief Setting a new value to the Slider. 721 Maybe you also require a Slider::redraw() for this to display 722 */ 686 723 void Slider::setValue(int value) 687 724 { … … 690 727 691 728 /** 692 *Signal OptionChange writes the Value from the Slider to its Object-Database.693 \param widget The widget(Slider) that has a changed Value694 \param slider the Slider-Object that should receive the change.695 729 \brief Signal OptionChange writes the Value from the Slider to its Object-Database. 730 \param widget The widget(Slider) that has a changed Value 731 \param slider the Slider-Object that should receive the change. 732 */ 696 733 gint Slider::OptionChange (GtkWidget *widget, Widget* slider) 697 734 { 698 735 static_cast<Slider*>(slider)->value = (int)gtk_range_get_value (GTK_RANGE ((Slider*)slider->widget)); 699 736 flags->setTextFromFlags(orxonoxGUI); 700 cout << static_cast<Slider*>(slider)-> option_name<< " set to: "<< static_cast<Slider*>(slider)->value << endl;701 } 702 703 /** 704 *Redraws the widget705 *Example: see void CheckButton::redraw ()706 737 cout << static_cast<Slider*>(slider)->label << " set to: "<< static_cast<Slider*>(slider)->value << endl; 738 } 739 740 /** 741 \brief Redraws the widget 742 Example: see void CheckButton::redraw () 743 */ 707 744 void Slider::redraw () 708 745 { … … 713 750 714 751 /** 715 *Creates a Menu-Item-list out of multiple input.716 *!! Consider, that the last input argument has to be "lastItem" for this to work!!717 \param menuname The Database-Name of this Menu718 \param ... items to be added to this Menu. !! Consider, that the last input argument has to be "lastItem" for this to work!!719 752 \brief Creates a Menu-Item-list out of multiple input. 753 !! Consider, that the last input argument has to be "lastItem" for this to work!! 754 \param menuname The Database-Name of this Menu 755 \param ... items to be added to this Menu. !! Consider, that the last input argument has to be "lastItem" for this to work!! 756 */ 720 757 Menu::Menu (char* menuname, ...) 721 758 { … … 737 774 738 775 /** 739 *Initializes a new Menu with no items740 776 \brief Initializes a new Menu with no items 777 */ 741 778 void Menu::init(void) 742 779 { 743 780 is_option = 2; 744 value = 0; 745 next = NULL; 746 flag_name = ""; 747 flag_name_short = ""; 748 default_value = 0; 781 782 static_cast<Option*>(this)->init(); 783 749 784 widget = gtk_option_menu_new (); 750 785 menu = gtk_menu_new (); … … 758 793 void Menu::setTitle(char* title) 759 794 { 760 option_name= title;761 } 762 763 /** 764 *appends a new Item to the Menu-List.765 \param itemName the itemName to be appendet.795 label = title; 796 } 797 798 /** 799 \brief appends a new Item to the Menu-List. 800 \param itemName the itemName to be appendet. 766 801 */ 767 802 void Menu::addItem (char* itemName) … … 772 807 773 808 /** 774 * Signal OptionChange writes the Value from the Menu to its Object-Database. 775 \param widget The widget(Menu) that has a changed Value 776 \param menu the Menu-Object that should receive the change. 777 */gint Menu::OptionChange (GtkWidget *widget, Widget* menu) 809 \brief Signal OptionChange writes the Value from the Menu to its Object-Database. 810 \param widget The widget(Menu) that has a changed Value 811 \param menu the Menu-Object that should receive the change. 812 */ 813 gint Menu::OptionChange (GtkWidget *widget, Widget* menu) 778 814 { 779 815 static_cast<Menu*>(menu)->value = (int)gtk_option_menu_get_history (GTK_OPTION_MENU (menu->widget)); 780 816 flags->setTextFromFlags(orxonoxGUI); 781 cout << static_cast<Menu*>(menu)-> option_name<< " changed to : " << static_cast<Menu*>(menu)->value << endl;782 } 783 784 /** 785 *Redraws the widget786 *Example: see void CheckButton::redraw ()817 cout << static_cast<Menu*>(menu)->label << " changed to : " << static_cast<Menu*>(menu)->value << endl; 818 } 819 820 /** 821 \brief Redraws the widget 822 Example: see void CheckButton::redraw () 787 823 */ 788 824 void Menu::redraw () … … 792 828 793 829 /** 794 *Creates a new default Label with no Text.795 *You migth consider adding Label::setTitle with this.796 830 \brief Creates a new default Label with no Text. 831 You migth consider adding Label::setTitle with this. 832 */ 797 833 Label:: Label () 798 834 { … … 801 837 802 838 /** 803 *Creates a new Label with a Text.804 \param text The text to be displayed.839 \brief Creates a new Label with a Text. 840 \param text The text to be displayed. 805 841 */ 806 842 Label:: Label (char* text) 807 843 { 844 this->init(); 845 this->setText(text); 846 } 847 848 /** 849 \brief initializes a new Label 850 */ 851 void Label::init(void) 852 { 808 853 is_option = 0; 809 next = NULL; 810 widget = gtk_label_new (text); 854 855 static_cast<Widget*>(this)->init(); 856 857 widget = gtk_label_new (""); 811 858 gtk_label_set_line_wrap (GTK_LABEL(widget), TRUE); 812 859 } 813 860 814 /** 815 * Destructs a Label 816 */ 817 Label::~Label () 818 {} 819 820 /** 821 * initializes a new Label 822 */ 823 void Label::init(void) 824 { 825 is_option = 0; 826 next = NULL; 827 widget = gtk_label_new (""); 828 gtk_widget_set_usize (widget, 260, 60); 829 gtk_label_set_line_wrap (GTK_LABEL(widget), TRUE); 830 } 831 832 /** 833 * Sets a new Text to a Label. 834 \param text The text to be inserted into the Label. 835 */ 861 /** 862 \brief Sets a new Text to a Label. 863 \param text The text to be inserted into the Label. 864 */ 836 865 void Label::setText (char * text) 837 866 { 867 label = text; 838 868 gtk_label_set_text (GTK_LABEL (this->widget), text); 839 869 } 840 870 841 871 /** 842 *get the Text of a Label843 \return The Text the Label holds.872 \brief get the Text of a Label 873 \return The Text the Label holds. 844 874 */ 845 875 char* Label::getText ()
Note: See TracChangeset
for help on using the changeset viewer.