- Timestamp:
- May 4, 2005, 11:50:34 PM (20 years ago)
- Location:
- orxonox/branches/guiMerge/src/lib/gui/gui
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui.cc
r4044 r4046 26 26 #include <unistd.h> 27 27 28 #include "orxonox_gui_gtk.h" 28 29 #include "orxonox_gui.h" 29 30 #include "orxonox_gui_video.h" … … 35 36 #include "orxonox_gui_update.h" 36 37 37 Window* orxonoxGUI = NULL; 38 OrxonoxGuiVideo* video= NULL;39 OrxonoxGuiAudio* audio = NULL;40 OrxonoxGuiExec* exec= NULL;41 OrxonoxGuiFlags* flags= NULL;42 43 44 38 // GUI-modules 39 OrxonoxGuiFlags* flags = NULL; 40 OrxonoxGuiVideo* video = NULL; 41 OrxonoxGuiAudio* audio = NULL; 42 OrxonoxGuiExec* exec = NULL; 43 OrxonoxGuiBanner* banner = NULL; 44 OrxonoxGuiKeys* keys = NULL; 45 OrxonoxGuiUpdate* update = NULL; 45 46 46 47 /* ORXONOXGUI */ … … 51 52 OrxonoxGui::OrxonoxGui(int argc, char *argv[]) 52 53 { 54 Window* orxonoxGUI = NULL; 55 53 56 initGUI(argc, argv); 54 57 55 58 orxonoxGUI = new Window( "grafical orxonox loader, "PACKAGE_VERSION); 56 57 Box* windowBox = new Box ('h'); 59 { 60 Box* windowBox = new Box ('h'); 61 { 62 banner = new OrxonoxGuiBanner(); 63 windowBox->fill (banner->getWidget()); 64 65 Box* optionBoxL = new Box('v'); 66 { 67 Box* avBox = new Box('h'); 68 69 video = new OrxonoxGuiVideo(); 70 avBox->fill(video->getWidget()); 71 audio = new OrxonoxGuiAudio(); 72 avBox->fill(audio->getWidget()); 73 74 optionBoxL->fill(avBox); 58 75 59 banner = new OrxonoxGuiBanner(); 60 windowBox->fill (banner->getWidget()); 61 62 Box* optionBoxL = new Box('v'); 63 Box* optionBoxR = new Box('v'); 64 65 Box* avBox = new Box('h'); 66 67 video = new OrxonoxGuiVideo(); 68 avBox->fill(video->getWidget()); 69 audio = new OrxonoxGuiAudio(); 70 avBox->fill(audio->getWidget()); 71 72 optionBoxL->fill(avBox); 73 74 keys = new OrxonoxGuiKeys(); 75 optionBoxL->fill(keys->getWidget()); 76 windowBox->fill(optionBoxL); 77 78 exec = new OrxonoxGuiExec(); 79 optionBoxR->fill(exec->getWidget()); 80 81 flags = new OrxonoxGuiFlags(); 82 83 optionBoxR->fill(flags->getWidget()); 84 85 update = new OrxonoxGuiUpdate(); 86 optionBoxR->fill(update->getWidget()); 87 windowBox->fill(optionBoxR); 88 89 orxonoxGUI->fill(windowBox); 90 76 keys = new OrxonoxGuiKeys(); 77 optionBoxL->fill(keys->getWidget()); 78 windowBox->fill(optionBoxL); 79 } 80 Box* optionBoxR = new Box('v'); 81 { 82 exec = new OrxonoxGuiExec(); 83 optionBoxR->fill(exec->getWidget()); 84 85 flags = new OrxonoxGuiFlags(); 86 87 optionBoxR->fill(flags->getWidget()); 88 89 update = new OrxonoxGuiUpdate(); 90 optionBoxR->fill(update->getWidget()); 91 } 92 windowBox->fill(optionBoxR); 93 } 94 orxonoxGUI->fill(windowBox); 95 } 91 96 // Reading Values from File 92 exec->setConfFile( "~/.orxonox/orxonox.conf");93 exec->readFromFile( orxonoxGUI);97 exec->setConfFile(ORXONOX_GUI_DEFAULT_CONFIG_FILE); 98 exec->readFromFile(Window::mainWindow); 94 99 // Merging changes to the Options from appended flags. 95 100 for (int optCount = 1; optCount < argc; optCount++) 96 101 orxonoxGUI->walkThrough(Widget::flagCheck, argv[optCount], 0); 97 102 98 flags->setTextFromFlags( orxonoxGUI);103 flags->setTextFromFlags(Window::mainWindow); 99 104 orxonoxGUI->showall(); 100 105 … … 103 108 // case update // 104 109 #ifdef HAVE_CURL 105 if (static_cast<Option*>( orxonoxGUI->findWidgetByName("auto update", 0))->value == 1)110 if (static_cast<Option*>(Window::mainWindow->findWidgetByName("auto update", 0))->value == 1) 106 111 { 107 112 update->checkForUpdates(); … … 110 115 111 116 // case start-with-gui. 112 if (!access(exec->getConfigFile(), F_OK) && static_cast<Option*>(orxonoxGUI->findWidgetByName("Always Show this Menu", 0))->value == 0) 117 if (!access(exec->getConfigFile(), F_OK) && 118 static_cast<Option*>(orxonoxGUI->findWidgetByName("Always Show this Menu", 0))->value == 0) 113 119 OrxonoxGuiExec::startOrxonox(NULL, exec); 114 120 else -
orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui.h
r4034 r4046 16 16 using namespace std; 17 17 18 #include "orxonox_gui_gtk.h"18 #include <stdlib.h> 19 19 20 #include <stdlib.h> 20 #define ORXONOX_GUI_DEFAULT_CONFIG_FILE "~/.orxonox/orxonox.conf" 21 22 class OrxonoxGuiElement; 21 23 22 24 //! Class that creates the OrxonoxGui … … 26 28 OrxonoxGui(int argc, char *argv[]); 27 29 ~OrxonoxGui(void); 28 29 30 }; 30 31 -
orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui_audio.cc
r4024 r4046 31 31 OrxonoxGuiAudio::OrxonoxGuiAudio(void) 32 32 { 33 this->audioFrame = new Frame("Audio-Options:"); 34 this->audioBox = new Box('v'); 35 this->audioFrame->setGroupName("audio"); 36 37 this->enableSound = new CheckButton("Disable Sound"); 38 this->enableSound->setFlagName ("no-sound", 0); 39 this->enableSound->saveability(); 40 this->audioBox->fill(this->enableSound); 41 Label* musicVolumeLabel = new Label("Music Volume"); 42 this->audioBox->fill(musicVolumeLabel); 43 this->musicVolume = new Slider("Music Volume", 0, 100); 44 this->musicVolume->setFlagName("music-volume", "m", 80); 45 this->musicVolume->saveability(); 46 this->audioBox->fill (this->musicVolume); 47 Label* effectsVolumeLabel = new Label ("Effects Volume"); 48 this->audioBox->fill (effectsVolumeLabel); 49 this->effectsVolume = new Slider ("Effects Volume", 0, 100); 50 this->effectsVolume->setFlagName ("effects-volume", "e", 80); 51 this->effectsVolume->saveability(); 52 this->audioBox->fill (this->effectsVolume); 33 Frame* audioFrame; //!< The Frame that holds the audio Options. 34 Box* audioBox; //!< The Box that holds the audio Options. 35 CheckButton* enableSound; //!< A Ckeckbutton for enabling Sound. 36 Slider* musicVolume; //!< A Slider for music volume. 37 Slider* effectsVolume; //!< A Slider for effects volume. 53 38 54 this->audioFrame->fill(this->audioBox); 55 this->setMainWidget(this->audioFrame); 39 audioFrame = new Frame("Audio-Options:"); 40 audioFrame->setGroupName("audio"); 41 { 42 audioBox = new Box('v'); 43 { 44 45 enableSound = new CheckButton("Disable Sound"); 46 enableSound->setFlagName ("no-sound", 0); 47 enableSound->saveability(); 48 audioBox->fill(enableSound); 49 Label* musicVolumeLabel = new Label("Music Volume"); 50 audioBox->fill(musicVolumeLabel); 51 musicVolume = new Slider("Music Volume", 0, 100); 52 musicVolume->setFlagName("music-volume", "m", 80); 53 musicVolume->saveability(); 54 audioBox->fill (musicVolume); 55 Label* effectsVolumeLabel = new Label ("Effects Volume"); 56 audioBox->fill (effectsVolumeLabel); 57 effectsVolume = new Slider ("Effects Volume", 0, 100); 58 effectsVolume->setFlagName ("effects-volume", "e", 80); 59 effectsVolume->saveability(); 60 audioBox->fill (effectsVolume); 61 } 62 audioFrame->fill(audioBox); 63 } 64 setMainWidget(audioFrame); 56 65 } 57 66 -
orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui_audio.h
r4024 r4046 7 7 #define _ORXONOX_GUI_AUDIO_H 8 8 9 #include "orxonox_gui.h"10 9 #include "orxonox_gui_element.h" 11 10 -
orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui_banner.cc
r4030 r4046 33 33 OrxonoxGuiBanner::OrxonoxGuiBanner(void) 34 34 { 35 // the banner Frame 36 Frame* bannerFrame; //!< The frame that holds the Banner. 37 Box* bannerBox; //!< The box that holds the Banner. 38 EventBox* bannerEventBox; //!< an Image needs an EventBox to catch klicks. 39 Label* bannerLabel; //!< The Label of the Banner. 40 41 // the logo Window 42 Window* logoWindow; //!< The Window that holds the Orxonox-CrewLogo. 43 EventBox* logoEventBox; //!< The EventBox that holds the Orxonox-CrewLogo. it has to be an eventbox, because Images can not receive clicks. 44 Box* logoBox; //!< The Box that holds the Orxonox-CrewLogo 45 Image* logoImage; //!< The Orxonox-CrewLogo-Image 46 Label* logoLabel; //!< The Label for the Orxonox-CrewLogo 47 Label* orxIsLabel; //!< Some text about us. 48 49 35 50 // Banner Itself // 36 this->bannerEventBox = new EventBox("BannerEventBox");37 this->bannerImage = new Image(banner_xpm);38 this->bannerEventBox->fill(this->bannerImage);51 bannerEventBox = new EventBox("BannerEventBox"); 52 { 53 Image* bannerImage; //!< The Image for the Banner. 39 54 55 bannerImage = new Image(banner_xpm); 56 bannerEventBox->fill(bannerImage); 57 } 40 58 // Banner Window // 41 this->logoWindow = new Window("Logo"); 59 logoWindow = new Window("Logo"); 60 { 42 61 43 62 #ifdef HAVE_GTK2 44 this->bannerEventBox->connectSignal("button_press_event", this->logoWindow, Window::windowOpen);63 bannerEventBox->connectSignal("button_press_event", logoWindow, Window::windowOpen); 45 64 46 this->logoWindow->connectSignal("destroy", this->logoWindow, Window::windowClose);47 this->logoWindow->connectSignal("delete_event", this->logoWindow, Window::windowClose);65 logoWindow->connectSignal("destroy", logoWindow, Window::windowClose); 66 logoWindow->connectSignal("delete_event", logoWindow, Window::windowClose); 48 67 #endif /* HAVE_GTK2 */ 49 this->logoEventBox = new EventBox();50 this->logoBox = new Box('v');51 this->logoLabel = new Label("orxonox, version: " PACKAGE_VERSION);52 this->logoBox->fill(this->logoLabel);53 this->logoImage = new Image(logo_xpm);54 this->logoBox->fill(this->logoImage);68 logoEventBox = new EventBox(); 69 logoBox = new Box('v'); 70 logoLabel = new Label("orxonox, version: " PACKAGE_VERSION); 71 logoBox->fill(logoLabel); 72 logoImage = new Image(logo_xpm); 73 logoBox->fill(logoImage); 55 74 56 //! \todo add the names of all the guys working on orxonox57 this->orxIsLabel = new Label("orxonox is:\nPatrick Boenzli - main Developer\nBenjamin Grauer - right Hand\n....");58 this->logoBox->fill(this->orxIsLabel);59 this->logoEventBox->fill(this->logoBox);75 //! \todo add the names of all the guys working on orxonox 76 orxIsLabel = new Label("orxonox is:\nPatrick Boenzli - main Developer\nBenjamin Grauer - right Hand\n...."); 77 logoBox->fill(orxIsLabel); 78 logoEventBox->fill(logoBox); 60 79 #ifdef HAVE_GTK2 61 this->logoEventBox->connectSignal("button_press_event", this->logoWindow, Window::windowClose);80 logoEventBox->connectSignal("button_press_event", logoWindow, Window::windowClose); 62 81 #endif /* HAVE_GTK2 */ 63 64 this->logoWindow->fill(this->logoEventBox); 82 logoWindow->fill(logoEventBox); 83 } 84 Window::addWindow(logoWindow); 65 85 66 Window::addWindow(this->logoWindow); 67 68 this->setMainWidget(bannerEventBox); 86 setMainWidget(bannerEventBox); 69 87 } 70 88 -
orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui_banner.h
r4030 r4046 14 14 class OrxonoxGuiBanner : public OrxonoxGuiElement 15 15 { 16 private:17 // the banner Frame18 Frame* bannerFrame; //!< The frame that holds the Banner.19 Box* bannerBox; //!< The box that holds the Banner.20 EventBox* bannerEventBox; //!< an Image needs an EventBox to catch klicks.21 Image* bannerImage; //!< The Image for the Banner.22 Label* bannerLabel; //!< The Label of the Banner.23 24 // the logo Window25 Window* logoWindow; //!< The Window that holds the Orxonox-CrewLogo.26 EventBox* logoEventBox; //!< The EventBox that holds the Orxonox-CrewLogo. it has to be an eventbox, because Images can not receive clicks.27 Box* logoBox; //!< The Box that holds the Orxonox-CrewLogo28 Image* logoImage; //!< The Orxonox-CrewLogo-Image29 Label* logoLabel; //!< The Label for the Orxonox-CrewLogo30 Label* orxIsLabel; //!< Some text about us.31 32 16 public: 33 17 OrxonoxGuiBanner(void); -
orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui_element.cc
r4024 r4046 40 40 } 41 41 42 /** 43 \brief Every GuiElement should set this, or it could result in a SegFault. 44 */ 42 45 void OrxonoxGuiElement::setMainWidget(Widget* widget) 43 46 { -
orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui_element.h
r4024 r4046 10 10 #include "orxonox_gui_gtk.h" 11 11 12 // FORWARD DEFINITION 13 14 15 16 //! A class for ... 12 //! A SuperClass for all the Different GuiElements 17 13 class OrxonoxGuiElement { 18 14 … … 21 17 virtual ~OrxonoxGuiElement(); 22 18 19 /** \returns the main Widget of this GuiElement. */ 23 20 Widget* getWidget(void) {return this->mainWidget;} 24 21 protected: -
orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui_gtk.cc
r4039 r4046 32 32 using namespace std; 33 33 34 // temporarily.35 34 #include "orxonox_gui_flags.h" 36 extern Window* orxonoxGUI;37 35 extern OrxonoxGuiFlags* flags; 36 38 37 char* guiExecutable; 39 38 char* progExecutable; … … 145 144 ////////////////////////////// 146 145 146 //////////// 147 147 /* WIDGET */ 148 //////////// 148 149 /** 149 150 \brief constructs a Widget … … 153 154 next = NULL; 154 155 this->title = NULL; 155 return;156 156 } 157 157 … … 162 162 Widget::~Widget(void) 163 163 { 164 164 if (this->title) 165 165 { 166 166 delete []this->title; 167 167 } 168 169 PRINTF(5)("deleting the Widget part.\n"); 170 171 PRINTF(5)("deleting recursively\n"); 168 169 PRINTF(5)("deleting the Widget part.\n"); 172 170 173 171 // deleting next item if existent … … 178 176 //! \todo not hiding widget, deleting. 179 177 // this->hide(); 180 // delete this->widget;178 // gtk_destroy_widget(this->widget); 181 179 } 182 180 … … 317 315 int* count =(int*)data; 318 316 *count = *count +1; 319 PRINT(0)(" %d:%s is %s\n", *count, static_cast<Option*>(widget)->title, static_cast<Option*>(widget)->save()); 317 PRINT(0)(" %d:%s is %s\n", *count, 318 static_cast<Option*>(widget)->title, 319 static_cast<Option*>(widget)->save()); 320 320 } 321 321 } … … 421 421 bool found = false; 422 422 // check if long flag matches 423 if ((option->flagName && strlen(name) >2 &&423 if ((option->flagName && strlen(name) > 2 && 424 424 !strncmp(name+2, option->flagName, strlen(option->flagName)) && 425 425 (name[strlen(option->flagName)+2] == '\0' || name[strlen(option->flagName)+2] == '=') )) … … 518 518 #endif /* HAVE_GTK2 */ 519 519 520 //void deleteWidget(Widget* lastWidget) 521 522 520 ///////////// 523 521 /* PACKERS */ 522 ///////////// 524 523 /** 525 524 \brief Constructs a Packer … … 537 536 { 538 537 PRINTF(5)("deleting the Packer part.\n"); 539 540 538 if (this->groupName) 541 539 delete []this->groupName; 542 540 543 541 //deleting recursively. 544 542 if (this->down) 545 543 delete this->down; 546 this->down = NULL;547 544 } 548 545 … … 551 548 \param name The name of the group. 552 549 */ 553 void Packer::setGroupName(c har* name)550 void Packer::setGroupName(const char* name) 554 551 { 555 552 if (this->groupName) … … 559 556 } 560 557 561 /** 562 \brief Retrieves the group name under which all the lower widgets of this will be saved. 563 \returns name The name of the group. 564 */ 565 char* Packer::getGroupName(void) 566 { 567 return this->groupName; 568 } 569 558 //////////////// 570 559 /* CONTAINERS */ 571 560 //////////////// 572 561 /** 573 562 \brief Initializes a Container. … … 594 583 It does this by filling up the down pointer only if down points to NULL. 595 584 */ 596 void Container::fill(Widget *lowerWidget)585 void Container::fill(Widget* lowerWidget) 597 586 { 598 587 if (this->down == NULL) … … 601 590 gtk_container_add(GTK_CONTAINER(this->widget), lowerWidget->widget); 602 591 #endif /* HAVE_GTK2 */ 592 603 593 this->down = lowerWidget; 604 594 } 605 595 else 606 PRINTF(1)("!!error!! You try to put more than one Widget into a Container. \nNot including this item.\nThis is only possible with Boxes.\n"); 607 } 608 609 // gtk_container_set_border_width(GTK_CONTAINER(widget), 5); 610 596 PRINTF(1)("You tried to put more than one Widget into a Container. \nNot including this item.\nThis is only possible with Boxes.\n"); 597 } 598 599 /** 600 \param borderwidth sets the Width of the border 601 */ 602 void Container::setBorderWidth(int borderwidth) 603 { 604 this->borderwidth = borderwidth; 605 606 #ifdef HAVE_GTK2 607 gtk_container_set_border_width(GTK_CONTAINER(widget), borderwidth); 608 #endif /* HAVE_GTK2 */ 609 } 610 611 //////////// 611 612 /* WINDOW */ 612 613 Window* Window::mainWindow = NULL; 614 615 /** 616 \brief Adds a new Window Windows to the List of Windows. 617 \param windowToAdd The Windows that should be added to the List 618 \todo this instead of windowToAdd(possibly) 619 */ 620 void Window::addWindow(Window* windowToAdd) 621 { 622 if (!mainWindow) 623 { 624 mainWindow = windowToAdd; 625 return; 626 } 627 628 Widget* tmpWindow = mainWindow; 629 while(tmpWindow->next) 630 tmpWindow = tmpWindow->next; 631 tmpWindow->next = windowToAdd; 632 633 return; 634 } 635 636 637 /** 638 \brief Creating a new Window without a Name 639 */ 640 Window::Window(void) 641 { 642 this->init(); 643 } 613 //////////// 614 615 /** 616 \brief The main Window of Th Gui 617 */ 618 Window* Window::mainWindow = NULL; 644 619 645 620 /** … … 647 622 \param windowName the name the window should get. 648 623 */ 649 650 Window::Window(char* windowName) 651 { 652 this->init(); 653 this->setTitle(windowName); 654 } 655 656 /** 657 \brief Destructs a Window. 658 */ 659 Window::~Window(void) 660 { 661 if (this->title) 662 PRINTF(5)("deleting the Window: %s\n", this->title); 663 else 664 PRINTF(5)("deleting the Window.\n"); 665 // this->hide(); 666 } 667 668 /** 669 \brief initializes a new Window 670 */ 671 void Window::init(void) 624 Window::Window(const char* windowName) 672 625 { 673 626 if (!mainWindow) 674 mainWindow = this; 675 627 { 628 mainWindow = this; 629 this->isOpen = true; 630 } 676 631 isOpen = false; 677 632 … … 684 639 gtk_container_set_border_width(GTK_CONTAINER(widget), 3); 685 640 #endif /* HAVE_GTK2 */ 641 642 if (windowName) 643 this->setTitle(windowName); 644 } 645 646 /** 647 \brief Destructs a Window. 648 */ 649 Window::~Window(void) 650 { 651 PRINTF(5)("deleting the Window: %s\n", this->title); 652 } 653 654 /** 655 \brief Adds a new Window Windows to the List of Windows. 656 \param windowToAdd The Windows that should be added to the List 657 \todo this instead of windowToAdd(possibly) 658 */ 659 void Window::addWindow(Window* windowToAdd) 660 { 661 if (!mainWindow) 662 { 663 mainWindow = windowToAdd; 664 windowToAdd->isOpen = true; 665 } 666 else 667 { 668 Widget* tmpWindow = mainWindow; 669 while(tmpWindow->next) 670 tmpWindow = tmpWindow->next; 671 tmpWindow->next = windowToAdd; 672 windowToAdd->isOpen = false; 673 } 674 return; 686 675 } 687 676 … … 691 680 void Window::showall(void) 692 681 { 682 #ifdef HAVE_GTK2 693 683 if (!this->isOpen) 694 { 695 // printf("showall\n"); 696 #ifdef HAVE_GTK2 697 gtk_widget_show_all(this->widget); 698 #endif /* HAVE_GTK2 */ 699 this->isOpen = true; 700 } 684 gtk_widget_show_all(this->widget); 701 685 else 702 { 703 // printf("showone\n"); 704 #ifdef HAVE_GTK2 705 gtk_widget_show(this->widget); 706 #endif /* HAVE_GTK2 */ 707 } 686 gtk_widget_show(this->widget); 687 #endif /* HAVE_GTK2 */ 708 688 } 709 689 … … 753 733 } 754 734 755 #ifdef HAVE_GTK2756 735 /** 757 736 \brief opens up a window(not topmost Window). … … 761 740 \param window the Window that should be opened 762 741 */ 763 gint Window::windowOpen(GtkWidget *widget, GdkEvent* event, void* window) 742 #ifdef HAVE_GTK2 743 gint Window::windowOpen(GtkWidget* widget, GdkEvent* event, void* window) 764 744 { 765 745 static_cast<Window*>(window)->open(); 766 746 } 747 #else /* HAVE_GTK2 */ 748 int Window::windowOpen(void* widget, void* event, void* window){} 749 #endif /* HAVE_GTK2 */ 767 750 768 751 /** … … 773 756 \param window the Window that should be closed 774 757 */ 775 gint Window::windowClose(GtkWidget *widget, GdkEvent* event, void* window) 758 #ifdef HAVE_GTK2 759 gint Window::windowClose(GtkWidget* widget, GdkEvent* event, void* window) 776 760 { 777 761 static_cast<Window*>(window)->close(); 778 762 } 779 780 #endif /* HAVE_GTK2 */ 781 782 763 #else /* HAVE_GTK2 */ 764 int Window::windowClose(void* widget, void* event, void* window){} 765 #endif /* HAVE_GTK2 */ 766 767 /////////// 783 768 /* FRAME */ 784 785 /** 786 \brief Creates a new Frame without a name 787 */ 788 Frame::Frame(void) 789 { 790 this->init(); 791 } 792 769 /////////// 793 770 /** 794 771 \brief Creates a new Frame with name title 795 772 */ 796 Frame::Frame(char* title) 797 { 798 this->init(); 799 this->setTitle(title); 800 } 801 802 /** 803 \brief destrcucts a Frame 804 */ 805 Frame::~Frame(void) 806 { 807 PRINTF(5)("deleting the Frame: %s\n", this->title); 808 } 809 810 /** 811 \brief Initializes a new Frame with default settings 812 */ 813 void Frame::init(void) 773 Frame::Frame(char* frameName) 814 774 { 815 775 #ifdef HAVE_GTK2 … … 817 777 gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3); 818 778 #endif /* HAVE_GTK2 */ 779 if (title) 780 this->setTitle(frameName); 781 } 782 783 /** 784 \brief destrcucts a Frame 785 */ 786 Frame::~Frame(void) 787 { 788 PRINTF(5)("deleting the Frame: %s\n", this->title); 819 789 } 820 790 … … 834 804 } 835 805 836 // EVENTBOX // 837 838 /** 839 \brief Creates a new EventBox with default settings. 840 */ 841 EventBox::EventBox(void) 842 { 843 this->init(); 844 } 845 806 ////////////// 807 /* EVENTBOX */ 808 ////////////// 846 809 /** 847 810 \brief Creates a new EventBox with name title 848 \param title title the Eventbox should get(only data-structure-internal) 849 */ 850 EventBox::EventBox(char* title) 851 { 852 this->init(); 853 this->setTitle(title); 854 } 855 856 /** 857 \brief destructs an EventBox. 858 */ 859 EventBox::~EventBox(void) 860 { 861 PRINTF(5)("deleting the EventBox: %s\n", this->title); 862 } 863 864 /** 865 \brief Initializes a new EventBox 866 */ 867 void EventBox::init(void) 811 \param eventBoxName title the Eventbox should get(only data-structure-internal) 812 */ 813 EventBox::EventBox(const char* eventBoxName) 868 814 { 869 815 this->isOption = -1; … … 873 819 gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3); 874 820 #endif /* HAVE_GTK2 */ 875 } 876 821 822 if (eventBoxName) 823 this->setTitle(eventBoxName); 824 } 825 826 /** 827 \brief destructs an EventBox. 828 */ 829 EventBox::~EventBox(void) 830 { 831 PRINTF(5)("deleting the EventBox: %s\n", this->title); 832 } 833 834 ///////// 877 835 /* BOX */ 878 879 /** 880 \brief Creates a new horizontal Box 881 */ 882 Box::Box(void) 883 { 884 this->init('h'); 885 } 886 836 ///////// 887 837 /** 888 838 \brief Creates a new Box of type boxtype … … 890 840 */ 891 841 Box::Box(char boxtype) 892 {893 this->init(boxtype);894 }895 896 /**897 \brief destructs a Box.898 */899 Box::~Box(void)900 {901 PRINTF(5)("deleting the Box: %s\n", this->title);902 }903 904 /**905 \brief Initializes a new Box with type boxtype906 \param boxtype see Box(char boxtype)907 */908 void Box::init(char boxtype)909 842 { 910 843 this->isOption = -2; … … 918 851 } 919 852 853 /** 854 \brief destructs a Box. 855 */ 856 Box::~Box(void) 857 { 858 PRINTF(5)("deleting the Box: %s\n", this->title); 859 } 860 920 861 /** 921 862 \brief Fills a box with a given Widget. … … 936 877 tmp = this->down; 937 878 while(tmp->next != NULL) 938 { 939 tmp = tmp->next; 940 } 879 tmp = tmp->next; 941 880 tmp->next = lowerWidget; 942 881 } 943 882 } 944 883 884 //////////// 945 885 /* OPTION */ 946 886 //////////// 947 887 /** 948 888 \brief Initializes a new Option. … … 954 894 this->flagName = NULL; 955 895 this->flagNameShort = NULL; 896 897 this->shortDescription = NULL; 898 this->longDescription = NULL; 899 956 900 this->saveable = false; 957 901 this->defaultValue = 0; … … 968 912 if (this->flagNameShort) 969 913 delete []this->flagNameShort; 914 if (this->shortDescription) 915 delete []this->shortDescription; 916 if (this->longDescription) 917 delete []this->longDescription; 970 918 } 971 919 … … 976 924 \param defaultvalue the default Value for this Option(see definition of defaultvalue 977 925 */ 978 void Option::setFlagName(c har* flagname, int defaultvalue)926 void Option::setFlagName(const char* flagname, int defaultvalue) 979 927 { 980 928 if (this->flagName) … … 982 930 this->flagName = new char [strlen(flagname)+1]; 983 931 strcpy(this->flagName, flagname); 932 984 933 this->defaultValue = defaultvalue; 934 935 if (this->flagNameShort) 936 { 937 delete this->flagNameShort; 938 this->flagNameShort = NULL; 939 } 985 940 986 941 // cout << "Set Flagname of " << this->title << " to " << flagname << endl; … … 993 948 \param flagnameshort a short flagname to be displayed in the output 994 949 */ 995 void Option::setFlagName(c har* flagname,char* flagnameshort, int defaultvalue)950 void Option::setFlagName(const char* flagname, const char* flagnameshort, int defaultvalue) 996 951 { 997 952 if (this->flagName) … … 1008 963 } 1009 964 1010 /** 1011 \brief Sets the saveable-state of the option to true. 1012 */ 1013 void Option::saveability(void) 1014 { 1015 this->saveable = true; 965 void Option::setDescription(const char* shortDescription, const char* longDescription) 966 { 967 // setting up the short description 968 if (this->shortDescription) 969 delete []this->shortDescription; 970 this->shortDescription = new char [strlen(shortDescription)+1]; 971 strcpy(this->shortDescription, shortDescription); 972 973 //setting up the long description 974 if (this->longDescription) 975 delete []this->longDescription; 976 if (longDescription) 977 { 978 this->longDescription = new char [strlen(longDescription)+1]; 979 strcpy(this->longDescription, longDescription); 980 } 981 else 982 this->longDescription = NULL; 1016 983 } 1017 984 … … 1027 994 /** 1028 995 \brief saves an Option 1029 \returns the String that should be saved. 996 \returns the String that should be saved. (this string __should__ be deleted) 1030 997 1031 998 this is a default Option save … … 1033 1000 char* Option::save(void) 1034 1001 { 1035 char* value = new char [ 10];1002 char* value = new char [30]; 1036 1003 sprintf (value, "%d", this->value); 1037 1004 return value; … … 1070 1037 #endif /* HAVE_GTK2 */ 1071 1038 1072 1039 //////////// 1073 1040 /* BUTTON */ 1074 1041 //////////// 1075 1042 /** 1076 1043 \brief Creates a new Button with a buttonname 1077 \param buttonname sets the Name of the Button 1078 */ 1079 Button::Button(char* buttonname) 1080 { 1081 this->init(); 1082 this->setTitle(buttonname); 1044 \param buttonName sets the Name of the Button 1045 */ 1046 Button::Button(char* buttonName) 1047 { 1048 isOption = 0; 1049 1050 #ifdef HAVE_GTK2 1051 widget = gtk_button_new_with_label(""); 1052 #endif /* HAVE_GTK2 */ 1053 1054 if (buttonName) 1055 this->setTitle(buttonName); 1083 1056 } 1084 1057 … … 1089 1062 { 1090 1063 PRINTF(5)("deleting the Label: %s\n", this->title); 1091 }1092 1093 /**1094 \brief Initializes a new Button1095 */1096 void Button::init(void)1097 {1098 isOption = 0;1099 1100 #ifdef HAVE_GTK21101 widget = gtk_button_new_with_label("");1102 #endif /* HAVE_GTK2 */1103 1064 } 1104 1065 … … 1120 1081 /** 1121 1082 \brief redraws the Button 1122 not implemented yet1083 \todo not implemented yet 1123 1084 */ 1124 1085 void Button::redraw(void) … … 1136 1097 } 1137 1098 1099 ///////////////// 1138 1100 /* CHECKBUTTON */ 1139 1101 ///////////////// 1140 1102 /** 1141 1103 \brief Creates a new CheckButton with an ame 1142 \param buttonname The name the CheckButton should display. 1143 */ 1144 CheckButton::CheckButton(char* buttonname) 1145 { 1146 this->init(); 1147 this->setTitle(buttonname); 1104 \param buttonName The name the CheckButton should display. 1105 */ 1106 CheckButton::CheckButton(const char* buttonName) 1107 { 1108 this->isOption = 1; 1109 1110 #ifdef HAVE_GTK2 1111 this->widget = gtk_check_button_new_with_label(""); 1112 #endif /* HAVE_GTK2 */ 1113 1114 if (buttonName) 1115 this->setTitle(buttonName); 1148 1116 1149 1117 #ifdef HAVE_GTK2 … … 1164 1132 1165 1133 /** 1166 \brief Initialize a new CheckButton with default settings1167 */1168 void CheckButton::init(void)1169 {1170 this->isOption = 1;1171 1172 #ifdef HAVE_GTK21173 this->widget = gtk_check_button_new_with_label("");1174 #endif /* HAVE_GTK2 */1175 }1176 1177 /**1178 1134 \brief Sets a new Title to a CheckButton 1179 1135 \param title The new Name the CheckButton should display. … … 1190 1146 } 1191 1147 1148 /** 1149 \returns the Active state of the checkButton 1150 */ 1192 1151 bool CheckButton::isActive(void) 1193 1152 { … … 1215 1174 } 1216 1175 1217 1218 1176 /** 1219 1177 \brief Redraws the CheckButton(if option has changed). … … 1227 1185 } 1228 1186 1187 //////////// 1229 1188 /* SLIDER */ 1230 1189 //////////// 1231 1190 /** 1232 1191 \brief Creates a new Slider … … 1235 1194 \param end The maximal Value of the slider. 1236 1195 */ 1237 Slider::Slider(char* slidername, int start, int end) 1238 { 1239 this->init(start, end); 1196 Slider::Slider(const char* slidername, int start, int end) 1197 { 1198 this->isOption = 2; 1199 1200 this->start = start; 1201 this->end = end; 1202 #ifdef HAVE_GTK2 1203 widget = gtk_hscale_new_with_range(this->start, this->end, 5); 1204 #endif /* HAVE_GTK2 */ 1205 1240 1206 this->setValue(start); 1241 1207 this->setTitle(slidername); … … 1254 1220 1255 1221 /** 1256 \brief Initializes a Slider with start and end Values1257 params: see Slider::Slider(char* slidername, int start, int end)1258 */1259 void Slider::init(int start, int end)1260 {1261 this->isOption = 2;1262 1263 this->start = start;1264 this->end = end;1265 #ifdef HAVE_GTK21266 widget = gtk_hscale_new_with_range(this->start, this->end, 5);1267 #endif /* HAVE_GTK2 */1268 }1269 1270 /**1271 1222 \brief Setting a new value to the Slider. 1272 1223 Maybe you also require a Slider::redraw() for this to display … … 1284 1235 { 1285 1236 #ifdef HAVE_GTK2 1286 gtk_range_set_value(GTK_RANGE(this->widget), value);1237 gtk_range_set_value(GTK_RANGE(this->widget), this->value); 1287 1238 #endif /* HAVE_GTK2 */ 1288 1239 } … … 1308 1259 } 1309 1260 1261 ////////// 1310 1262 /* MENU */ 1311 1263 ////////// 1312 1264 /** 1313 1265 \brief constructs a new Menu, without adding any items to it. … … 1355 1307 /* 1356 1308 #ifdef HAVE_GTK2 1357 free(this->currItem->item);1309 gtk_widget_destroy(this->currItem->item); 1358 1310 #endif /* HAVE_GTK2 */ 1359 1311 MenuItem* tmpItem = this->currItem; … … 1480 1432 \param value The Value of the OptionLabel(what will be displayed). 1481 1433 */ 1482 OptionLabel::OptionLabel(char* label, char* value) 1483 { 1484 this->init(); 1434 OptionLabel::OptionLabel(const char* label, const char* value) 1435 { 1436 this->isOption = 5; 1437 cValue = NULL; 1438 1439 #ifdef HAVE_GTK2 1440 this->widget = gtk_label_new(""); 1441 #endif /* HAVE_GTK2 */ 1442 1485 1443 this->setTitle(label); 1486 1444 this->setValue(value); … … 1498 1456 1499 1457 /** 1500 \brief Initializes an OptionLabel1501 */1502 void OptionLabel::init(void)1503 {1504 this->isOption = 5;1505 cValue = NULL;1506 1507 #ifdef HAVE_GTK21508 this->widget = gtk_label_new("");1509 #endif /* HAVE_GTK2 */1510 }1511 1512 /**1513 1458 \brief Updates the value of an OptionLabel 1514 1459 \param newValue The new Name that should be displayed. 1515 1460 */ 1516 void OptionLabel::setValue(c har* newValue)1461 void OptionLabel::setValue(const char* newValue) 1517 1462 { 1518 1463 if (this->cValue) … … 1567 1512 void OptionLabel::load(char* loadString) 1568 1513 { 1569 PRINTF(4)( 1514 PRINTF(4)("Loading %s: setting to %s\n", this->title, loadString); 1570 1515 this->setValue(loadString); 1571 1516 } 1572 1517 1573 /** 1574 \brief Creates a new default Label with no Text. 1575 You migth consider adding Label::setTitle with this. 1576 */ 1577 Label::Label(void) 1578 { 1579 this->init(); 1580 } 1581 1518 /////////// 1519 /* LABEL */ 1520 /////////// 1582 1521 /** 1583 1522 \brief Creates a new Label with a Text. 1584 1523 \param text The text to be displayed. 1585 1524 */ 1586 Label:: Label(char* text) 1587 { 1588 this->init(); 1589 this->setTitle(text); 1590 } 1591 1592 /** 1593 \brief destructs a Label. 1594 */ 1595 Label::~Label(void) 1596 { 1597 PRINTF(5)("deleting the Label: %s\n", this->title); 1598 } 1599 1600 /** 1601 \brief initializes a new Label 1602 */ 1603 void Label::init(void) 1525 Label:: Label(const char* text) 1604 1526 { 1605 1527 this->isOption = 0; 1606 1528 1607 1529 #ifdef HAVE_GTK2 1608 1530 this->widget = gtk_label_new(""); 1609 1531 gtk_label_set_line_wrap(GTK_LABEL(this->widget), TRUE); 1610 1532 #endif /* HAVE_GTK2 */ 1533 1534 if (text) 1535 this->setTitle(text); 1536 } 1537 1538 /** 1539 \brief destructs a Label. 1540 */ 1541 Label::~Label(void) 1542 { 1543 PRINTF(5)("deleting the Label: %s\n", this->title); 1611 1544 } 1612 1545 … … 1615 1548 \param text The text to be inserted into the Label. 1616 1549 */ 1617 void Label::setTitle(c har* text)1550 void Label::setTitle(const char* text) 1618 1551 { 1619 1552 if (this->title) … … 1674 1607 \return The Text the Label holds. 1675 1608 */ 1676 c har* Label::getText(void)1609 const char* Label::getText(void) 1677 1610 { 1678 1611 return this->title; 1679 1612 } 1680 1613 1681 /** 1682 \brief Creates a new ProgressBar. 1683 */ 1684 ProgressBar::ProgressBar(void) 1685 { 1686 this->init(); 1687 } 1688 1614 ////////////////// 1615 /* PROGRESS-BAR */ 1616 ////////////////// 1689 1617 /** 1690 1618 \brief Creates a new ProgressBar. 1691 1619 \param label The name you want to get the ProgressBar. 1692 1620 */ 1693 ProgressBar::ProgressBar(char* label) 1694 { 1695 this->init(); 1696 this->setTitle(label); 1697 } 1698 1699 /** 1700 \brief destructs a ProgressBar 1701 */ 1702 ProgressBar::~ProgressBar(void) 1703 { 1704 PRINTF(5)("deleting the ProgressBar: %s\n", this->title); 1705 } 1706 1707 /** 1708 \brief Initializes a ProgressBar 1709 */ 1710 void ProgressBar::init(void) 1621 ProgressBar::ProgressBar(const char* label) 1711 1622 { 1712 1623 this->isOption = 0; … … 1718 1629 this->widget = gtk_progress_bar_new_with_adjustment(this->adjustment); 1719 1630 #endif /* HAVE_GTK2 */ 1631 1632 if (label) 1633 this->setTitle(label); 1634 } 1635 1636 /** 1637 \brief destructs a ProgressBar 1638 */ 1639 ProgressBar::~ProgressBar(void) 1640 { 1641 PRINTF(5)("deleting the ProgressBar: %s\n", this->title); 1720 1642 } 1721 1643 … … 1740 1662 #ifdef HAVE_GTK2 1741 1663 gtk_progress_set_value(GTK_PROGRESS(widget), this->progress*100.0/this->totalSize); 1742 #endif /* HAVE_GTK2 */ 1743 PRINTF(3)("Progress: %f\n", this->progress*100.0/this->totalSize); 1664 PRINTF(4)("Progress: %f%%\n", this->progress*100.0/this->totalSize); 1665 #else /* HVE_GTK2 */ 1666 PRINT(0)("Progress: %f%%\n", this->progress*100.0/this->totalSize); 1667 #endif /* HAVE_GTK2 */ 1744 1668 } 1745 1669 … … 1752 1676 } 1753 1677 1678 /////////// 1754 1679 /* IMAGE */ 1755 1680 /////////// 1756 1681 /** 1757 1682 \brief Creates a new Image … … 1801 1726 this->title = new char[strlen(name)+1]; 1802 1727 strcpy(this->title, name); 1803 1804 } 1728 } -
orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui_gtk.h
r4039 r4046 30 30 #endif /* HAVE_GTK2 */ 31 31 32 // enumerator for different GuiOption-Types 33 enum GUI_OPTION {GUI_CONTAINER = -2, 34 GUI_BOX = -1, 35 GUI_NOTHING = 0, 36 GUI_BOOL = 1, 37 GUI_INT = 2, 38 GUI_FLOAT = 3, 39 GUI_CHAR = 4, 40 GUI_CHAR_ARRAY = 5}; 41 32 42 extern char* guiExecutable; 33 43 extern char* progExecutable; … … 48 58 void hide(void); 49 59 void setSize(int width, int height); 60 50 61 virtual void setTitle(const char* title); //!< An abstract Function, that sets the title of Widgets. 51 62 … … 65 76 #ifdef HAVE_GTK2 66 77 // Connection - Functions 67 68 78 gulong connectSignal(char* event, gint(*signal)(GtkWidget*, GdkEvent*, void* )); 69 79 gulong connectSignal(char* event, gint(*signal)(GtkWidget*, Widget* )); … … 72 82 gulong connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEventKey*, void* )); 73 83 void disconnectSignal(gulong signalID); 74 75 84 // Signals 76 85 static gint doNothingSignal(GtkWidget* widget, GdkEvent* event, void* nothing); 77 #endif /* HAVE_GTK2 */ 86 #else /* HAVE_GTK2 */ 87 // Connection - Functions 88 unsigned long connectSignal(char* event, int(*signal)(void*, void*, void* )){}; 89 unsigned long connectSignal(char* event, int(*signal)(void*, Widget* )){}; 90 unsigned long connectSignal(char* event, void* extObj, int(*signal)(void*, void*, void* )){}; 91 unsigned long connectSignal(char* event, void* extObj, int(*signal)(void*, void* )){}; 92 void disconnectSignal(unsigned long signalID); 93 // Signals 94 static int doNothingSignal(void* widget, void* event, void* nothing); 95 #endif /* HAVE_GTK2 */ 96 78 97 79 98 Widget* next; //!< next always points to the next Widget in the list. Every Widget has a next one, or has NULL as next 80 99 #ifdef HAVE_GTK2 81 100 GtkWidget* widget; //!< widget is the gtk_widget that the specific Object Contains. 82 #endif /* HAVE_GTK2 */ 101 #else /* HAVE_GTK2 */ 102 void* widget; 103 #endif /* HAVE_GTK2 */ 104 83 105 int isOption; //!< with this Paramenter one can set the option-type: -2:Container, -1: Box, 0: not an Option, 1: Bool-option, 2: int-option, 3: float option, 4:char option, 5: char* option 84 85 //! defines isOption states 86 enum option { containerType = -2, boxType = -1, nothingType = 0, boolType = 1, intType = 2}; 106 87 107 char* title; //!< The name of the Widget. Some do display it, Options need it to save; 88 108 }; … … 95 115 virtual ~Packer(void); 96 116 97 Widget* down; //!< this points to the Widget below this. 98 char* groupName; //!< For each Packer you can specify a Groupname under which the lowerWidgets will be saved. 99 100 void setGroupName(char* name); 101 char* getGroupName(void); 117 Widget* down; //!< this points to the Widget below this. 118 char* groupName; //!< For each Packer you can specify a Groupname under which the lowerWidgets will be saved. 119 120 void setGroupName(const char* name); 121 /** \returns the GroupName if existent NULL otherwise */ 122 inline const char* getGroupName(void) const {return this->groupName;} 123 102 124 103 125 virtual void fill(Widget* lowerWidget) = 0; //!< An abstract function, that fills Packers. … … 119 141 Container(void); 120 142 virtual ~Container(void); 121 //void setBorderWidth(int borderwidth);143 void setBorderWidth(int borderwidth); 122 144 void fill(Widget* lowerWidget); 123 145 }; … … 136 158 static void addWindow(Window* windowToAdd); 137 159 138 Window(void); 139 Window(char* windowName); 160 Window(const char* windowName = NULL); 140 161 virtual ~Window(void); 141 void init(void); 142 143 void setTitle(const char* title); 162 163 virtual void setTitle(const char* title); 144 164 void showall(void); 145 165 void open(void); … … 150 170 static gint windowOpen(GtkWidget* widget, GdkEvent* event, void* window); 151 171 static gint windowClose(GtkWidget* widget, GdkEvent* event, void* window); 172 #else /* HAVE_GTK2 */ 173 int Window::windowOpen(void* widget, void* event, void* window); 174 int Window::windowClose(void* widget, void* event, void* window); 152 175 #endif /* HAVE_GTK2 */ 153 176 }; … … 161 184 { 162 185 public: 163 Frame(void); 164 Frame(char* frameName); 186 Frame(char* frameName = NULL); 165 187 virtual ~Frame(void); 166 void init(void); 167 168 void setTitle(const char* title); 188 189 virtual void setTitle(const char* title); 169 190 }; 170 191 … … 176 197 { 177 198 public: 178 EventBox(void); 179 EventBox(char* eventBoxName); 199 EventBox(const char* eventBoxName = NULL); 180 200 virtual ~EventBox(void); 181 void init(void);182 201 }; 183 202 … … 191 210 { 192 211 public: 193 Box(void); 194 Box(char boxtype); 212 Box(char boxtype = 'h'); 195 213 virtual ~Box(void); 196 void init(char boxtype); 197 198 void fill(Widget* lowerWidget); 214 215 virtual void fill(Widget* lowerWidget); 199 216 }; 200 217 … … 206 223 { 207 224 protected: 208 bool saveable; //!< Options can be Saved.225 bool saveable; //!< Options can be Saved. 209 226 210 227 public: 211 228 Option(void); 212 229 virtual ~Option(void); 213 void init(void); 214 215 int value; //!< every option has a value either true or false(0,1) or something else like 25 for 25% of the volume 216 char* flagName; //!< options have a flag name that will be appendet if you start the Program from the GUI. 217 char* flagNameShort; //!< like flag_name but shorter 218 int defaultValue; //!< A default value is good, for hiding a option if it is not needed.(hidden if value == default_value) 219 220 void saveability(void); 221 void saveability(bool isSaveable); 230 231 int value; //!< every option has a value either true or false(0,1) or something else like 25 for 25% of the volume 232 char* flagName; //!< options have a flag name that will be appendet if you start the Program from the GUI. 233 char* flagNameShort; //!< like flag_name but shorter 234 int defaultValue; //!< A default value is good, for hiding a option if it is not needed.(hidden if value == default_value) 235 236 char* shortDescription; //!< A Text that describes this option in short 237 char* longDescription; //!< A Longer Text describing this option in a full way 238 239 void saveability(bool isSaveable = true); 222 240 virtual char* save(void); 223 241 virtual void load(char* loadString); 224 242 225 243 bool isSaveable(void); 226 void setFlagName(char* flagname, int defaultvalue); 227 void setFlagName(char* flagname, char* flagnameshort, int defaultvalue); 228 virtual void redraw(void) = 0; //!< A Option must be able to redraw itself. 244 void setFlagName(const char* flagname, int defaultvalue); 245 void setFlagName(const char* flagname, const char* flagnameshort, int defaultvalue); 246 void setDescription(const char* shortDescription, const char* longDescription = NULL); 247 248 virtual void redraw(void) = 0; //!< A Option must be able to redraw itself. 229 249 virtual void changeOption(void) = 0; //!< What to do, if an Option is Changed. eacht option decides for itself. 230 250 #ifdef HAVE_GTK2 … … 241 261 { 242 262 public: 243 Button(char* button name);263 Button(char* buttonName = NULL); 244 264 virtual ~Button(void); 245 void init(void); 246 247 void setTitle(const char* title); 248 void redraw(void); 249 void changeOption(void); 265 266 virtual void setTitle(const char* title); 267 virtual void redraw(void); 268 virtual void changeOption(void); 250 269 }; 251 270 … … 256 275 { 257 276 public: 258 CheckButton(c har* buttonname);277 CheckButton(const char* buttonName = NULL); 259 278 virtual ~CheckButton(void); 260 void init(void); 261 262 void setTitle(const char* title); 263 bool isActive(void); //!< a Bool value to see, if this CheckButton is active.264 v oid redraw(void);265 v oid changeOption(void);279 280 bool isActive(void); 281 282 virtual void setTitle(const char* title); 283 virtual void redraw(void); 284 virtual void changeOption(void); 266 285 }; 267 286 … … 276 295 int end; //!< The end of the Slider-range. 277 296 public: 278 Slider(c har* slidername, int start, int end);297 Slider(const char* slidername, int start, int end); 279 298 virtual ~Slider(void); 280 void init(int start, int end);281 299 282 300 void setValue(int value); 283 v oid redraw(void);284 v oid changeOption(void);301 virtual void redraw(void); 302 virtual void changeOption(void); 285 303 }; 286 304 … … 301 319 GtkWidget* item; //!< One Item From a Menu. 302 320 #endif /* HAVE_GTK2 */ 321 303 322 MenuItem* next; //!< Pointer to the next MenuItem. 304 323 }; … … 316 335 317 336 void addItem(char* itemName); 318 v oid redraw(void);319 v oid changeOption(void);337 virtual void redraw(void); 338 virtual void changeOption(void); 320 339 }; 321 340 … … 323 342 class OptionLabel : public Option 324 343 { 325 private: 326 327 public: 328 OptionLabel(char* label, char* value); 344 public: 345 OptionLabel(const char* label, const char* value); 329 346 virtual ~OptionLabel(void); 330 void init(void); 331 332 void setValue(char* newValue); 347 348 void setValue(const char* newValue); 333 349 334 350 virtual char* save(void); 335 351 virtual void load(char* loadString); 336 352 337 v oid redraw(void);338 v oid changeOption(void);353 virtual void redraw(void); 354 virtual void changeOption(void); 339 355 340 356 char* cValue; //!< The Value the Label will have. \todo make private 341 342 357 }; 343 358 … … 346 361 { 347 362 public: 348 Label(void); 349 Label(char* text); 363 Label(const char* text = NULL); 350 364 virtual ~Label(void); 351 void init(void); 352 353 void setTitle(char* text); 365 366 virtual void setTitle(const char* text); 354 367 void ereaseText(void); 355 368 void appendText(char* textToAppend); 356 369 void appendInt(int intToAppend); 357 c har* getText(void);370 const char* getText(void); 358 371 }; 359 372 … … 362 375 { 363 376 public: 364 ProgressBar(void); 365 ProgressBar(char* label); 377 ProgressBar(const char* label = NULL); 366 378 virtual ~ProgressBar(void); 367 void init(void);368 379 369 380 void setProgress(double progress);
Note: See TracChangeset
for help on using the changeset viewer.