Changeset 3158 in orxonox.OLD for orxonox/trunk/gui/orxonox_gui_gtk.cc
- Timestamp:
- Dec 11, 2004, 11:55:08 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/gui/orxonox_gui_gtk.cc
r3157 r3158 69 69 { 70 70 next = NULL; 71 label = "";71 label = NULL; 72 72 return; 73 73 } … … 331 331 void Window::setTitle (char* title) 332 332 { 333 label=title; 333 if (label) 334 delete label; 335 label = new char[strlen(title)+1]; 336 strcpy(label, title); 334 337 gtk_window_set_title (GTK_WINDOW (widget), title); 335 338 } … … 438 441 void Frame::setTitle (char* title) 439 442 { 440 label = title; 443 if (label) 444 delete label; 445 label = new char[strlen(title)+1]; 446 strcpy(label, title); 441 447 gtk_frame_set_label (GTK_FRAME (widget), title); 442 448 } … … 481 487 void EventBox::setTitle (char* title) 482 488 { 483 label = title; 489 if (label) 490 delete label; 491 label = new char[strlen(title)+1]; 492 strcpy(label, title); 484 493 } 485 494 … … 552 561 Image::Image (char* imagename) 553 562 { 563 if (label) 564 delete label; 565 label = new char[strlen(imagename)+1]; 566 strcpy(label, imagename); 567 554 568 this->init(); 555 569 widget = gtk_image_new_from_file (imagename); 556 label = imagename;557 570 } 558 571 … … 577 590 { 578 591 value = 0; 579 flag _name = "";580 flag _name_short = "";592 flagName = NULL; 593 flagNameShort = NULL; 581 594 saveable = false; 582 default _value = 0;595 defaultValue = 0; 583 596 584 597 static_cast<Widget*>(this)->init(); … … 595 608 void Option::setFlagName (char* flagname, int defaultvalue) 596 609 { 597 flag_name = flagname; 598 default_value = defaultvalue; 610 if (flagName) 611 delete flagName; 612 flagName = new char [strlen(flagname)+1]; 613 strcpy(flagName, flagname); 614 defaultValue = defaultvalue; 599 615 cout << "Set Flagname of " << label << " to " << flagname << endl; 600 616 } … … 608 624 void Option::setFlagName (char* flagname, char* flagnameshort, int defaultvalue) 609 625 { 610 flag_name = flagname; 611 flag_name_short = flagnameshort; 612 default_value = defaultvalue; 626 if (flagName) 627 delete flagName; 628 flagName = new char [strlen(flagname)+1]; 629 strcpy(flagName, flagname); 630 631 if (flagNameShort) 632 delete flagNameShort; 633 flagNameShort = new char [strlen(flagnameshort)+1]; 634 strcpy(flagName, flagnameshort); 635 defaultValue = defaultvalue; 613 636 cout << "Set Flagname of " << label << " to " << flagname << endl; 614 637 } … … 689 712 void CheckButton::setTitle(char* title) 690 713 { 691 label = title; 714 if (label) 715 delete label; 716 label = new char[strlen(title)+1]; 717 strcpy(label, title); 692 718 gtk_button_set_label(GTK_BUTTON(widget), title); 693 719 } … … 754 780 void Slider::setTitle(char* title) 755 781 { 756 label = title; 782 if (label) 783 delete label; 784 label = new char[strlen(title)+1]; 785 strcpy(label, title); 757 786 } 758 787 … … 833 862 void Menu::setTitle(char* title) 834 863 { 835 label = title; 864 if (label) 865 delete label; 866 label = new char[strlen(title)+1]; 867 strcpy(label, title); 836 868 } 837 869 … … 930 962 void Label::setText (char* text) 931 963 { 932 label = text; 964 if (label) 965 delete label; 966 label = new char[strlen(text)+1]; 967 strcpy(label, text); 933 968 gtk_label_set_text (GTK_LABEL (this->widget), text); 934 969 }
Note: See TracChangeset
for help on using the changeset viewer.