Changeset 2605 in orxonox.OLD for orxonox/trunk/gui/orxonox_gui.cc
- Timestamp:
- Oct 19, 2004, 10:39:44 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/gui/orxonox_gui.cc
r2595 r2605 99 99 100 100 /* WIDGET */ 101 102 /** 103 \brief deletes any given Widget 104 This is still pretty crappy. 105 */ 106 Widget::~Widget() 107 { 108 // cout << "hiding: " <<this->label <<"\n"; 109 this->hide(); 110 // cout << "check if Packer: "<<this->label <<"\n"; 111 if (this->is_option < 0) 112 { 113 // cout << "get Down "<<this->label <<"\n"; 114 static_cast<Packer*>(this)->down->~Widget(); 115 } 116 // cout << "next != NULL?: " <<this->label <<"\n"; 117 if (this->next != NULL) 118 this->next->~Widget(); 119 cout << "delete Widget: " <<this->label <<"\n"; 120 // delete widget; 121 } 122 101 123 /** 102 124 * Initializes a widget. … … 108 130 } 109 131 132 /** 133 * makes the widget visible. 134 */ 135 void Widget::show() 136 { 137 gtk_widget_show (this->widget); 138 } 139 140 /** 141 * hides the widget. 142 */ 143 void Widget::hide() 144 { 145 gtk_widget_hide (this->widget); 146 } 147 148 /** 149 \brief Sets the resolution of a specific widget to the given size. 150 \param width the width of the widget to set. 151 \param height the height of the widget to set. 152 */ 153 void Widget::setSize(int width, int height) 154 { 155 gtk_widget_set_usize (this->widget, width, height); 156 } 157 110 158 /** 111 159 * Connect any signal to any given Sub-widget … … 130 178 { 131 179 g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), extObj); 132 }133 134 135 /**136 * Function to Shows a specific widget.137 */138 void Widget::show()139 {140 gtk_widget_show (this->widget);141 180 } 142 181 … … 149 188 { 150 189 function(this); 151 switch (this->is_option)190 if (this->is_option < 0) 152 191 { 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; 192 static_cast<Packer*>(this)->down->walkThrough (function); 159 193 } 160 194 … … 163 197 } 164 198 165 166 199 /** 167 200 * This is for listing the option of "widget" … … 171 204 { 172 205 if (widget->is_option >= 1) 173 cout << static_cast<Option*>(widget)-> option_name<<" is : " << static_cast<Option*>(widget)->value <<endl;206 cout << static_cast<Option*>(widget)->label <<" is : " << static_cast<Option*>(widget)->value <<endl; 174 207 } 175 208 … … 184 217 } 185 218 186 /* CONTAINERS*/ 219 //void deleteWidget(Widget* lastWidget) 220 221 222 /* PACKERS */ 223 224 /** 225 * Initializes a Packer. 226 * nothing to do here 227 */ 228 void Packer::init (void) 229 { 230 return; 231 } 232 233 /* CONTAINERS */ 187 234 188 235 /** … … 234 281 235 282 /** 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 283 *initializes a new Window 246 284 */ 247 285 void Window::init() 248 286 { 287 isOpen = true; 249 288 is_option = -1; 289 label = ""; 250 290 next = NULL; 251 291 down = NULL; … … 263 303 void Window::showall () 264 304 { 305 isOpen = true; 265 306 gtk_widget_show_all (widget); 266 307 } … … 272 313 void Window::setTitle (char* title) 273 314 { 315 label=title; 274 316 gtk_window_set_title (GTK_WINDOW (widget), title); 275 317 } … … 311 353 } 312 354 313 /**314 * Destroys given Frame (not implemented yet)315 */316 Frame::~Frame ()317 {318 }319 320 355 /** 321 356 * Initializes a new Frame with default settings … … 324 359 { 325 360 is_option = -1; 361 label = ""; 326 362 next = NULL; 327 363 down = NULL; … … 336 372 void Frame::setTitle (char* title) 337 373 { 374 label = title; 338 375 gtk_frame_set_label (GTK_FRAME (widget), title); 339 376 } … … 365 402 { 366 403 is_option = -1; 404 label = "eventBox"; 367 405 next = NULL; 368 406 down = NULL; … … 378 416 void EventBox::setTitle (char* title) 379 417 { 380 381 } 382 383 /** 384 * Destructs an EventBox (not Implemented) 385 */ 386 EventBox::~EventBox () 387 { 388 } 389 418 label = title; 419 } 390 420 391 421 /* BOX */ … … 409 439 410 440 /** 411 * Destroys given Box (not implemented yet)412 */413 Box::~Box ()414 {415 }416 417 /**418 441 * Initializes a new Box with type boxtype 419 442 \param boxtype see Box(char boxtype) … … 422 445 { 423 446 is_option = -2; 447 label = "box"; 424 448 next = NULL; 425 449 down = NULL; … … 469 493 this->init(); 470 494 widget = gtk_image_new_from_file (imagename); 495 label = imagename; 471 496 } 472 497 … … 477 502 { 478 503 is_option = 0; 504 label = ""; 479 505 next = NULL; 480 506 } … … 501 527 flag_name = flagname; 502 528 default_value = defaultvalue; 503 cout << "Set Flagname of " << option_name<< " to " << flagname << endl;529 cout << "Set Flagname of " << label << " to " << flagname << endl; 504 530 } 505 531 … … 515 541 flag_name_short = flagnameshort; 516 542 default_value = defaultvalue; 517 cout << "Set Flagname of " << option_name<< " to " << flagname << endl;543 cout << "Set Flagname of " << label << " to " << flagname << endl; 518 544 } 519 545 … … 539 565 value = 0; 540 566 next = NULL; 541 option_name="";567 label =""; 542 568 flag_name = ""; 543 569 flag_name_short = ""; … … 552 578 void Button::setTitle (char *title) 553 579 { 554 option_name= title;580 label = title; 555 581 gtk_button_set_label (GTK_BUTTON(widget), title); 556 582 } … … 578 604 } 579 605 580 /**581 * Destructs a CheckButton (not Implemented yet).582 */583 CheckButton::~CheckButton()584 {585 }586 587 606 /** 588 607 * Initiali a new CheckButton with default settings … … 593 612 value = 0; 594 613 next = NULL; 595 option_name= "";614 label = ""; 596 615 flag_name = ""; 597 616 flag_name_short = ""; … … 606 625 void CheckButton::setTitle(char* title) 607 626 { 608 option_name= title;627 label = title; 609 628 gtk_button_set_label(GTK_BUTTON(widget), title); 610 629 } … … 620 639 static_cast<CheckButton*>(checkbutton)->value = (int)gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON ((CheckButton*)checkbutton->widget)); 621 640 flags->setTextFromFlags(orxonoxGUI); 622 cout << static_cast<CheckButton*>(checkbutton)-> option_name<< " set to: " << static_cast<CheckButton*>(checkbutton)->value << endl;641 cout << static_cast<CheckButton*>(checkbutton)->label << " set to: " << static_cast<CheckButton*>(checkbutton)->value << endl; 623 642 } 624 643 … … 649 668 650 669 /** 651 * Destructs a Slider (not implemented yet)652 */653 Slider::~Slider()654 {655 }656 657 /**658 670 * Initializes a Slider with start and end Values 659 671 * params: see Slider::Slider (char* slidername, int start, int end) … … 664 676 value = 0; 665 677 next = NULL; 666 option_name= "";678 label = ""; 667 679 flag_name = ""; 668 680 flag_name_short = ""; … … 677 689 void Slider::setTitle(char* title) 678 690 { 679 option_name= title;691 label = title; 680 692 } 681 693 … … 698 710 static_cast<Slider*>(slider)->value = (int)gtk_range_get_value (GTK_RANGE ((Slider*)slider->widget)); 699 711 flags->setTextFromFlags(orxonoxGUI); 700 cout << static_cast<Slider*>(slider)-> option_name<< " set to: "<< static_cast<Slider*>(slider)->value << endl;712 cout << static_cast<Slider*>(slider)->label << " set to: "<< static_cast<Slider*>(slider)->value << endl; 701 713 } 702 714 … … 758 770 void Menu::setTitle(char* title) 759 771 { 760 option_name= title;772 label = title; 761 773 } 762 774 … … 779 791 static_cast<Menu*>(menu)->value = (int)gtk_option_menu_get_history (GTK_OPTION_MENU (menu->widget)); 780 792 flags->setTextFromFlags(orxonoxGUI); 781 cout << static_cast<Menu*>(menu)-> option_name<< " changed to : " << static_cast<Menu*>(menu)->value << endl;793 cout << static_cast<Menu*>(menu)->label << " changed to : " << static_cast<Menu*>(menu)->value << endl; 782 794 } 783 795 … … 806 818 Label:: Label (char* text) 807 819 { 820 this->init(); 821 this->setText(text); 822 } 823 824 /** 825 * initializes a new Label 826 */ 827 void Label::init(void) 828 { 808 829 is_option = 0; 809 next = NULL; 810 widget = gtk_label_new (text); 811 gtk_label_set_line_wrap (GTK_LABEL(widget), TRUE); 812 } 813 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; 830 label = ""; 826 831 next = NULL; 827 832 widget = gtk_label_new (""); 828 gtk_widget_set_usize (widget, 260, 60);829 833 gtk_label_set_line_wrap (GTK_LABEL(widget), TRUE); 830 834 } … … 836 840 void Label::setText (char * text) 837 841 { 842 label = text; 838 843 gtk_label_set_text (GTK_LABEL (this->widget), text); 839 844 }
Note: See TracChangeset
for help on using the changeset viewer.