Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4046 in orxonox.OLD for orxonox


Ignore:
Timestamp:
May 4, 2005, 11:50:34 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/guiMerge: heavy clean-up of the gui

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  
    2626#include <unistd.h>
    2727
     28#include "orxonox_gui_gtk.h"
    2829#include "orxonox_gui.h"
    2930#include "orxonox_gui_video.h"
     
    3536#include "orxonox_gui_update.h"
    3637
    37   Window* orxonoxGUI = NULL;
    38   OrxonoxGuiVideo* video = NULL;
    39   OrxonoxGuiAudio* audio = NULL;
    40   OrxonoxGuiExec* exec = NULL;
    41   OrxonoxGuiFlags* flags = NULL;
    42   OrxonoxGuiBanner* banner = NULL;
    43   OrxonoxGuiKeys* keys = NULL;
    44   OrxonoxGuiUpdate* update = NULL;
     38// GUI-modules
     39OrxonoxGuiFlags* flags = NULL;
     40OrxonoxGuiVideo* video = NULL;
     41OrxonoxGuiAudio* audio = NULL;
     42OrxonoxGuiExec* exec = NULL;
     43OrxonoxGuiBanner* banner = NULL;
     44OrxonoxGuiKeys* keys = NULL;
     45OrxonoxGuiUpdate* update = NULL;
    4546
    4647/* ORXONOXGUI */
     
    5152OrxonoxGui::OrxonoxGui(int argc, char *argv[])
    5253{
     54  Window* orxonoxGUI = NULL;
     55
    5356  initGUI(argc, argv);
    5457
    5558  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);
    5875
    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  }
    9196  // 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);
    9499  // Merging changes to the Options from appended flags.
    95100  for (int optCount = 1; optCount < argc; optCount++)
    96101    orxonoxGUI->walkThrough(Widget::flagCheck, argv[optCount], 0);
    97102
    98   flags->setTextFromFlags(orxonoxGUI);
     103  flags->setTextFromFlags(Window::mainWindow);
    99104  orxonoxGUI->showall();
    100105
     
    103108  // case update //
    104109#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)
    106111    {
    107112      update->checkForUpdates();
     
    110115
    111116  // 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)
    113119    OrxonoxGuiExec::startOrxonox(NULL, exec);
    114120  else
  • orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui.h

    r4034 r4046  
    1616using namespace std;
    1717
    18 #include "orxonox_gui_gtk.h"
     18#include <stdlib.h>
    1919
    20 #include <stdlib.h>
     20#define ORXONOX_GUI_DEFAULT_CONFIG_FILE "~/.orxonox/orxonox.conf"
     21
     22class OrxonoxGuiElement;
    2123
    2224//! Class that creates the OrxonoxGui
     
    2628  OrxonoxGui(int argc, char *argv[]);
    2729  ~OrxonoxGui(void);
    28 
    2930};
    3031
  • orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui_audio.cc

    r4024 r4046  
    3131OrxonoxGuiAudio::OrxonoxGuiAudio(void)
    3232{
    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.
    5338
    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);
    5665}
    5766
  • orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui_audio.h

    r4024 r4046  
    77#define _ORXONOX_GUI_AUDIO_H
    88
    9 #include "orxonox_gui.h"
    109#include "orxonox_gui_element.h"
    1110
  • orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui_banner.cc

    r4030 r4046  
    3333OrxonoxGuiBanner::OrxonoxGuiBanner(void)
    3434{
     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
    3550  // 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.
    3954
     55    bannerImage = new Image(banner_xpm);
     56    bannerEventBox->fill(bannerImage);
     57  }
    4058  // Banner Window //
    41   this->logoWindow = new Window("Logo");
     59  logoWindow = new Window("Logo");
     60  {
    4261
    4362#ifdef HAVE_GTK2
    44   this->bannerEventBox->connectSignal("button_press_event", this->logoWindow, Window::windowOpen);
     63    bannerEventBox->connectSignal("button_press_event", logoWindow, Window::windowOpen);
    4564
    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);
    4867#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);
    5574
    56   //! \todo add the names of all the guys working on orxonox
    57   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);
    6079#ifdef HAVE_GTK2
    61   this->logoEventBox->connectSignal("button_press_event", this->logoWindow, Window::windowClose);
     80    logoEventBox->connectSignal("button_press_event", logoWindow, Window::windowClose);
    6281#endif /* HAVE_GTK2 */
    63 
    64   this->logoWindow->fill(this->logoEventBox);
     82    logoWindow->fill(logoEventBox);
     83  }
     84  Window::addWindow(logoWindow);
    6585 
    66   Window::addWindow(this->logoWindow);
    67 
    68   this->setMainWidget(bannerEventBox);
     86  setMainWidget(bannerEventBox);
    6987}
    7088
  • orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui_banner.h

    r4030 r4046  
    1414class OrxonoxGuiBanner : public OrxonoxGuiElement
    1515{
    16  private:
    17   // the banner Frame
    18   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 Window
    25   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-CrewLogo
    28   Image* logoImage;         //!< The Orxonox-CrewLogo-Image
    29   Label* logoLabel;         //!< The Label for the Orxonox-CrewLogo
    30   Label* orxIsLabel;        //!< Some text about us.
    31 
    3216 public:
    3317  OrxonoxGuiBanner(void);
  • orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui_element.cc

    r4024 r4046  
    4040}
    4141
     42/**
     43   \brief Every GuiElement should set this, or it could result in a SegFault.
     44*/
    4245void OrxonoxGuiElement::setMainWidget(Widget* widget)
    4346{
  • orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui_element.h

    r4024 r4046  
    1010#include "orxonox_gui_gtk.h"
    1111
    12 // FORWARD DEFINITION
    13 
    14 
    15 
    16 //! A class for ...
     12//! A SuperClass for all the Different GuiElements
    1713class OrxonoxGuiElement {
    1814
     
    2117  virtual ~OrxonoxGuiElement();
    2218 
     19  /** \returns the main Widget of this GuiElement. */
    2320  Widget* getWidget(void) {return this->mainWidget;}
    2421 protected:
  • orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui_gtk.cc

    r4039 r4046  
    3232using namespace std;
    3333
    34 // temporarily.
    3534#include "orxonox_gui_flags.h"
    36 extern Window* orxonoxGUI;
    3735extern OrxonoxGuiFlags* flags;
     36
    3837char* guiExecutable;
    3938char* progExecutable;
     
    145144//////////////////////////////
    146145
     146////////////
    147147/* WIDGET */
     148////////////
    148149/**
    149150   \brief constructs a Widget
     
    153154  next = NULL;
    154155  this->title = NULL;
    155   return;
    156156}
    157157
     
    162162Widget::~Widget(void)
    163163{
    164     if (this->title)
     164  if (this->title)
    165165    {
    166166      delete []this->title;
    167167    }
    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");
    172170
    173171  // deleting next item if existent
     
    178176  //!  \todo not hiding widget, deleting.
    179177  //  this->hide();
    180   //  delete this->widget;
     178  // gtk_destroy_widget(this->widget);
    181179}
    182180
     
    317315      int* count =(int*)data;
    318316      *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());
    320320    }
    321321}
     
    421421      bool found = false;
    422422      // check if long flag matches
    423       if ((option->flagName && strlen(name)>2 &&
     423      if ((option->flagName && strlen(name) > 2 &&
    424424           !strncmp(name+2, option->flagName, strlen(option->flagName)) &&
    425425           (name[strlen(option->flagName)+2] == '\0' || name[strlen(option->flagName)+2] == '=') ))
     
    518518#endif /* HAVE_GTK2 */
    519519
    520 //void deleteWidget(Widget* lastWidget)
    521 
    522 
     520/////////////
    523521/* PACKERS */
     522/////////////
    524523/**
    525524   \brief Constructs a Packer
     
    537536{
    538537  PRINTF(5)("deleting the Packer part.\n");
    539  
    540538  if (this->groupName)
    541539    delete []this->groupName;
    542 
     540 
    543541  //deleting recursively.
    544542  if (this->down)
    545543    delete this->down;
    546   this->down = NULL;
    547544}
    548545
     
    551548   \param name The name of the group.
    552549*/
    553 void Packer::setGroupName(char* name)
     550void Packer::setGroupName(const char* name)
    554551{
    555552  if (this->groupName)
     
    559556}
    560557
    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////////////////
    570559/* CONTAINERS */
    571 
     560////////////////
    572561/**
    573562   \brief Initializes a Container.
     
    594583   It does this by filling up the down pointer only if down points to NULL.
    595584*/
    596 void Container::fill(Widget *lowerWidget)
     585void Container::fill(Widget* lowerWidget)
    597586{
    598587  if (this->down == NULL)
     
    601590      gtk_container_add(GTK_CONTAINER(this->widget), lowerWidget->widget);
    602591#endif /* HAVE_GTK2 */
     592
    603593      this->down = lowerWidget;
    604594    }
    605595  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*/
     602void 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////////////
    611612/* 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*/
     618Window* Window::mainWindow = NULL;     
    644619
    645620/**
     
    647622   \param windowName the name the window should get.
    648623*/
    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)
     624Window::Window(const char* windowName)
    672625{
    673626  if (!mainWindow)
    674     mainWindow = this;
    675  
     627    {
     628      mainWindow = this;
     629      this->isOpen = true;
     630    }
    676631  isOpen = false;
    677632
     
    684639  gtk_container_set_border_width(GTK_CONTAINER(widget), 3);
    685640#endif /* HAVE_GTK2 */
     641
     642  if (windowName)
     643    this->setTitle(windowName);
     644}
     645
     646/**
     647   \brief Destructs a Window.
     648*/
     649Window::~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*/
     659void 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;
    686675}
    687676
     
    691680void Window::showall(void)
    692681{
     682#ifdef HAVE_GTK2
    693683  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);
    701685  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 */
    708688}
    709689
     
    753733}
    754734
    755 #ifdef HAVE_GTK2
    756735/**
    757736   \brief opens up a window(not topmost Window).
     
    761740   \param window the Window that should be opened
    762741*/
    763 gint Window::windowOpen(GtkWidget *widget, GdkEvent* event, void* window)
     742#ifdef HAVE_GTK2
     743gint Window::windowOpen(GtkWidget* widget, GdkEvent* event, void* window)
    764744{
    765745  static_cast<Window*>(window)->open();
    766746}
     747#else /* HAVE_GTK2 */
     748int Window::windowOpen(void* widget, void* event, void* window){}
     749#endif /* HAVE_GTK2 */
    767750
    768751/**
     
    773756   \param window the Window that should be closed
    774757*/
    775 gint Window::windowClose(GtkWidget *widget, GdkEvent* event, void* window)
     758#ifdef HAVE_GTK2
     759gint Window::windowClose(GtkWidget* widget, GdkEvent* event, void* window)
    776760{
    777761  static_cast<Window*>(window)->close();
    778762}
    779 
    780 #endif /* HAVE_GTK2 */
    781 
    782 
     763#else /* HAVE_GTK2 */
     764int Window::windowClose(void* widget, void* event, void* window){}
     765#endif /* HAVE_GTK2 */
     766
     767///////////
    783768/* FRAME */
    784 
    785 /**
    786     \brief Creates a new Frame without a name
    787 */
    788 Frame::Frame(void)
    789 {
    790   this->init();
    791 }
    792 
     769///////////
    793770/**
    794771   \brief Creates a new Frame with name title
    795772*/
    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)
     773Frame::Frame(char* frameName)
    814774{
    815775#ifdef HAVE_GTK2
     
    817777  gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);
    818778#endif /* HAVE_GTK2 */
     779  if (title)
     780    this->setTitle(frameName);
     781}
     782
     783/**
     784   \brief destrcucts a Frame
     785*/
     786Frame::~Frame(void)
     787{
     788  PRINTF(5)("deleting the Frame: %s\n", this->title);
    819789}
    820790
     
    834804}
    835805
    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//////////////
    846809/**
    847810   \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*/
     813EventBox::EventBox(const char* eventBoxName)
    868814{
    869815  this->isOption = -1;
     
    873819  gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);
    874820#endif /* HAVE_GTK2 */
    875 }
    876 
     821
     822  if (eventBoxName)
     823    this->setTitle(eventBoxName);
     824}
     825
     826/**
     827   \brief destructs an EventBox.
     828*/
     829EventBox::~EventBox(void)
     830{
     831  PRINTF(5)("deleting the EventBox: %s\n", this->title);
     832}
     833
     834/////////
    877835/* BOX */
    878 
    879 /**
    880    \brief Creates a new horizontal Box
    881 */
    882 Box::Box(void)
    883 {
    884   this->init('h');
    885 }
    886 
     836/////////
    887837/**
    888838   \brief Creates a new Box of type boxtype
     
    890840*/
    891841Box::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 boxtype
    906    \param boxtype see Box(char boxtype)
    907 */
    908 void Box::init(char boxtype)
    909842{
    910843  this->isOption = -2;
     
    918851}
    919852
     853/**
     854   \brief destructs a Box.
     855*/
     856Box::~Box(void)
     857{
     858  PRINTF(5)("deleting the Box: %s\n", this->title);
     859}
     860
    920861/**
    921862    \brief Fills a box with a given Widget.
     
    936877      tmp = this->down;
    937878      while(tmp->next != NULL)
    938         {
    939           tmp = tmp->next;
    940         }
     879        tmp = tmp->next;
    941880      tmp->next = lowerWidget;
    942881    }
    943882}
    944883
     884////////////
    945885/* OPTION */
    946 
     886////////////
    947887/**
    948888   \brief Initializes a new Option.
     
    954894  this->flagName = NULL;
    955895  this->flagNameShort = NULL;
     896 
     897  this->shortDescription = NULL;
     898  this->longDescription = NULL;
     899
    956900  this->saveable = false;
    957901  this->defaultValue = 0;
     
    968912  if (this->flagNameShort)
    969913    delete []this->flagNameShort;
     914  if (this->shortDescription)
     915    delete []this->shortDescription;
     916  if (this->longDescription)
     917    delete []this->longDescription;
    970918}
    971919
     
    976924   \param defaultvalue the default Value for this Option(see definition of defaultvalue
    977925*/
    978 void Option::setFlagName(char* flagname, int defaultvalue)
     926void Option::setFlagName(const char* flagname, int defaultvalue)
    979927{
    980928  if (this->flagName)
     
    982930  this->flagName = new char [strlen(flagname)+1];
    983931  strcpy(this->flagName, flagname);
     932
    984933  this->defaultValue = defaultvalue;
     934
     935  if (this->flagNameShort)
     936    {
     937      delete this->flagNameShort;
     938      this->flagNameShort = NULL;
     939    }
    985940
    986941  //  cout << "Set Flagname of " << this->title << " to " << flagname << endl;
     
    993948    \param flagnameshort a short flagname to be displayed in the output
    994949*/
    995 void Option::setFlagName(char* flagname, char* flagnameshort,  int defaultvalue)
     950void Option::setFlagName(const char* flagname, const char* flagnameshort,  int defaultvalue)
    996951{
    997952  if (this->flagName)
     
    1008963}
    1009964
    1010 /**
    1011    \brief Sets the saveable-state of the option to true.
    1012 */
    1013 void Option::saveability(void)
    1014 {
    1015   this->saveable = true;
     965void 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;
    1016983}
    1017984
     
    1027994/**
    1028995   \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)
    1030997
    1031998   this is a default Option save
     
    10331000char* Option::save(void)
    10341001{
    1035   char* value = new char [10];
     1002  char* value = new char [30];
    10361003  sprintf (value, "%d", this->value);
    10371004  return value;
     
    10701037#endif /* HAVE_GTK2 */
    10711038
    1072 
     1039////////////
    10731040/* BUTTON */
    1074 
     1041////////////
    10751042/**
    10761043   \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*/
     1046Button::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);
    10831056}
    10841057
     
    10891062{
    10901063  PRINTF(5)("deleting the Label: %s\n", this->title);
    1091 }
    1092 
    1093 /**
    1094    \brief Initializes a new Button
    1095 */
    1096 void Button::init(void)
    1097 {
    1098   isOption = 0;
    1099 
    1100 #ifdef HAVE_GTK2
    1101   widget = gtk_button_new_with_label("");
    1102 #endif /* HAVE_GTK2 */
    11031064}
    11041065
     
    11201081/**
    11211082   \brief redraws the Button
    1122    not implemented yet
     1083   \todo not implemented yet
    11231084*/
    11241085void Button::redraw(void)
     
    11361097}
    11371098
     1099/////////////////
    11381100/* CHECKBUTTON */
    1139 
     1101/////////////////
    11401102/**
    11411103   \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*/
     1106CheckButton::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);
    11481116
    11491117#ifdef HAVE_GTK2
     
    11641132
    11651133/**
    1166    \brief Initialize a new CheckButton with default settings
    1167 */
    1168 void CheckButton::init(void)
    1169 {
    1170   this->isOption = 1;
    1171 
    1172 #ifdef HAVE_GTK2
    1173   this->widget = gtk_check_button_new_with_label("");
    1174 #endif /* HAVE_GTK2 */
    1175 }
    1176 
    1177 /**
    11781134   \brief Sets a new Title to a CheckButton
    11791135   \param title The new Name the CheckButton should display.
     
    11901146}
    11911147
     1148/**
     1149   \returns the Active state of the checkButton
     1150*/
    11921151bool CheckButton::isActive(void)
    11931152{
     
    12151174}
    12161175
    1217 
    12181176/**
    12191177   \brief Redraws the CheckButton(if option has changed).
     
    12271185}
    12281186
     1187////////////
    12291188/* SLIDER */
    1230 
     1189////////////
    12311190/**
    12321191   \brief Creates a new Slider
     
    12351194   \param end The maximal Value of the slider.
    12361195*/
    1237 Slider::Slider(char* slidername, int start, int end)
    1238 {
    1239   this->init(start, end);
     1196Slider::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
    12401206  this->setValue(start);
    12411207  this->setTitle(slidername);
     
    12541220
    12551221/**
    1256    \brief Initializes a Slider with start and end Values
    1257    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_GTK2
    1266  widget = gtk_hscale_new_with_range(this->start, this->end, 5);
    1267 #endif /* HAVE_GTK2 */
    1268 }
    1269 
    1270 /**
    12711222   \brief Setting a new value to the Slider.
    12721223   Maybe you also require a Slider::redraw() for this to display
     
    12841235{
    12851236#ifdef HAVE_GTK2
    1286   gtk_range_set_value(GTK_RANGE(this->widget), value);
     1237  gtk_range_set_value(GTK_RANGE(this->widget), this->value);
    12871238#endif /* HAVE_GTK2 */
    12881239}
     
    13081259}
    13091260
     1261//////////
    13101262/* MENU */
    1311 
     1263//////////
    13121264/**
    13131265   \brief constructs a new Menu, without adding any items to it.
     
    13551307      /*
    13561308        #ifdef HAVE_GTK2
    1357         free(this->currItem->item);
     1309        gtk_widget_destroy(this->currItem->item);
    13581310        #endif /* HAVE_GTK2 */
    13591311      MenuItem* tmpItem = this->currItem;
     
    14801432   \param value The Value of the OptionLabel(what will be displayed).
    14811433*/
    1482 OptionLabel::OptionLabel(char* label, char* value)
    1483 {
    1484   this->init();
     1434OptionLabel::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
    14851443  this->setTitle(label);
    14861444  this->setValue(value);
     
    14981456
    14991457/**
    1500    \brief Initializes an OptionLabel
    1501 */
    1502 void OptionLabel::init(void)
    1503 {
    1504   this->isOption = 5;
    1505   cValue = NULL;
    1506 
    1507 #ifdef HAVE_GTK2
    1508   this->widget = gtk_label_new("");
    1509 #endif /* HAVE_GTK2 */
    1510 }
    1511 
    1512 /**
    15131458   \brief Updates the value of an OptionLabel
    15141459   \param newValue The new Name that should be displayed.
    15151460*/
    1516 void OptionLabel::setValue(char* newValue)
     1461void OptionLabel::setValue(const char* newValue)
    15171462{
    15181463  if (this->cValue)
     
    15671512void OptionLabel::load(char* loadString)
    15681513{
    1569   PRINTF(4)( "Loading %s: setting to %s\n", this->title, loadString);
     1514  PRINTF(4)("Loading %s: setting to %s\n", this->title, loadString);
    15701515  this->setValue(loadString);
    15711516}
    15721517
    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///////////
    15821521/**
    15831522   \brief Creates a new Label with a Text.
    15841523   \param text The text to be displayed.
    15851524*/
    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)
     1525Label:: Label(const char* text)
    16041526{
    16051527  this->isOption = 0;
    1606 
     1528 
    16071529#ifdef HAVE_GTK2
    16081530  this->widget = gtk_label_new("");
    16091531  gtk_label_set_line_wrap(GTK_LABEL(this->widget), TRUE);
    16101532#endif /* HAVE_GTK2 */
     1533 
     1534  if (text)
     1535    this->setTitle(text);
     1536}
     1537
     1538/**
     1539   \brief destructs a Label.
     1540*/
     1541Label::~Label(void)
     1542{
     1543  PRINTF(5)("deleting the Label: %s\n", this->title);
    16111544}
    16121545
     
    16151548   \param text The text to be inserted into the Label.
    16161549*/
    1617 void Label::setTitle(char* text)
     1550void Label::setTitle(const char* text)
    16181551{
    16191552  if (this->title)
     
    16741607   \return The Text the Label holds.
    16751608*/
    1676 char* Label::getText(void)
     1609const char* Label::getText(void)
    16771610{
    16781611  return this->title;
    16791612}
    16801613
    1681 /**
    1682    \brief Creates a new ProgressBar.
    1683 */
    1684 ProgressBar::ProgressBar(void)
    1685 {
    1686   this->init();
    1687 }
    1688 
     1614//////////////////
     1615/* PROGRESS-BAR */
     1616//////////////////
    16891617/**
    16901618   \brief Creates a new ProgressBar.
    16911619   \param label The name you want to get the ProgressBar.
    16921620*/
    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)
     1621ProgressBar::ProgressBar(const char* label)
    17111622{
    17121623  this->isOption = 0;
     
    17181629  this->widget = gtk_progress_bar_new_with_adjustment(this->adjustment);
    17191630#endif /* HAVE_GTK2 */
     1631
     1632  if (label)
     1633    this->setTitle(label);
     1634}
     1635
     1636/**
     1637   \brief destructs a ProgressBar
     1638*/
     1639ProgressBar::~ProgressBar(void)
     1640{
     1641  PRINTF(5)("deleting the ProgressBar: %s\n", this->title);
    17201642}
    17211643
     
    17401662#ifdef HAVE_GTK2
    17411663  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 */
    17441668}
    17451669
     
    17521676}
    17531677
     1678///////////
    17541679/* IMAGE */
    1755 
     1680///////////
    17561681/**
    17571682   \brief Creates a new Image
     
    18011726  this->title = new char[strlen(name)+1];
    18021727  strcpy(this->title, name);
    1803 
    1804 }
     1728}
  • orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui_gtk.h

    r4039 r4046  
    3030#endif /* HAVE_GTK2 */
    3131
     32// enumerator for different GuiOption-Types
     33enum 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
    3242extern char* guiExecutable;
    3343extern char* progExecutable;
     
    4858  void hide(void);
    4959  void setSize(int width, int height);
     60
    5061  virtual void setTitle(const char* title);  //!< An abstract Function, that sets the title of Widgets.
    5162
     
    6576#ifdef HAVE_GTK2
    6677  // Connection - Functions
    67 
    6878  gulong connectSignal(char* event, gint(*signal)(GtkWidget*, GdkEvent*, void* ));
    6979  gulong connectSignal(char* event, gint(*signal)(GtkWidget*, Widget* ));
     
    7282  gulong connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEventKey*, void* ));
    7383  void disconnectSignal(gulong signalID);
    74 
    7584  // Signals
    7685  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
    7897
    7998  Widget* next;                     //!< next always points to the next Widget in the list. Every Widget has a next one, or has NULL as next
    8099#ifdef HAVE_GTK2
    81100  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
    83105  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 
    87107  char* title;                      //!< The name of the Widget. Some do display it, Options need it to save;
    88108};
     
    95115  virtual ~Packer(void);
    96116
    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
    102124
    103125  virtual void fill(Widget* lowerWidget) = 0; //!< An abstract function, that fills Packers.
     
    119141  Container(void);
    120142  virtual ~Container(void);
    121   //  void setBorderWidth(int borderwidth);
     143  void setBorderWidth(int borderwidth);
    122144  void fill(Widget* lowerWidget);
    123145};
     
    136158  static void addWindow(Window* windowToAdd);
    137159
    138   Window(void);
    139   Window(char* windowName);
     160  Window(const char* windowName = NULL);
    140161  virtual ~Window(void);
    141   void init(void);
    142  
    143   void setTitle(const char* title);
     162 
     163  virtual void setTitle(const char* title);
    144164  void showall(void);
    145165  void open(void);
     
    150170  static gint windowOpen(GtkWidget* widget, GdkEvent* event, void* window);
    151171  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);
    152175#endif /* HAVE_GTK2 */
    153176};
     
    161184{
    162185 public:
    163   Frame(void);
    164   Frame(char* frameName);
     186  Frame(char* frameName = NULL);
    165187  virtual ~Frame(void);
    166   void init(void);
    167 
    168   void setTitle(const char* title);
     188
     189  virtual void setTitle(const char* title);
    169190};
    170191
     
    176197{
    177198 public:
    178   EventBox(void);
    179   EventBox(char* eventBoxName);
     199  EventBox(const char* eventBoxName = NULL);
    180200  virtual ~EventBox(void);
    181   void init(void);
    182201};
    183202
     
    191210{
    192211 public:
    193   Box(void);
    194   Box(char boxtype);
     212  Box(char boxtype = 'h');
    195213  virtual ~Box(void);
    196   void init(char boxtype);
    197  
    198   void fill(Widget* lowerWidget);
     214 
     215  virtual void fill(Widget* lowerWidget);
    199216};
    200217
     
    206223{
    207224 protected:
    208   bool saveable;  //!< Options can be Saved.
     225  bool saveable;              //!< Options can be Saved.
    209226 
    210227 public:
    211228  Option(void);
    212229  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);
    222240  virtual char* save(void);
    223241  virtual void load(char* loadString);
    224242
    225243  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.
    229249  virtual void changeOption(void) = 0; //!< What to do, if an Option is Changed. eacht option decides for itself.
    230250#ifdef HAVE_GTK2
     
    241261{
    242262 public:
    243   Button(char* buttonname);
     263  Button(char* buttonName = NULL);
    244264  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);
    250269};
    251270
     
    256275{
    257276 public:
    258   CheckButton(char* buttonname);
     277  CheckButton(const char* buttonName = NULL);
    259278  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   void redraw(void);
    265   void 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);
    266285};
    267286
     
    276295  int end;                              //!< The end of the Slider-range.
    277296 public:
    278   Slider(char* slidername, int start, int end);
     297  Slider(const char* slidername, int start, int end);
    279298  virtual ~Slider(void);
    280   void init(int start, int end);
    281299
    282300  void setValue(int value);
    283   void redraw(void);
    284   void changeOption(void);
     301  virtual void redraw(void);
     302  virtual void changeOption(void);
    285303};
    286304
     
    301319    GtkWidget* item;                    //!< One Item From a Menu.
    302320#endif /* HAVE_GTK2 */
     321
    303322    MenuItem* next;                     //!< Pointer to the next MenuItem.
    304323  };
     
    316335 
    317336  void addItem(char* itemName);
    318   void redraw(void);
    319   void changeOption(void);
     337  virtual void redraw(void);
     338  virtual void changeOption(void);
    320339};
    321340
     
    323342class OptionLabel : public Option
    324343{
    325  private:
    326 
    327  public:
    328   OptionLabel(char* label, char* value);
     344 public:
     345  OptionLabel(const char* label, const char* value);
    329346  virtual ~OptionLabel(void);
    330   void init(void);
    331  
    332   void setValue(char* newValue);
     347 
     348  void setValue(const char* newValue);
    333349
    334350  virtual char* save(void);
    335351  virtual void load(char* loadString);
    336352
    337   void redraw(void);
    338   void changeOption(void);
     353  virtual void redraw(void);
     354  virtual void changeOption(void);
    339355
    340356  char* cValue;                          //!< The Value the Label will have. \todo make private
    341 
    342357};
    343358
     
    346361{
    347362 public:
    348   Label(void);
    349   Label(char* text);
     363  Label(const char* text = NULL);
    350364  virtual ~Label(void);
    351   void init(void);
    352  
    353   void setTitle(char* text);
     365 
     366  virtual void setTitle(const char* text);
    354367  void ereaseText(void);
    355368  void appendText(char* textToAppend);
    356369  void appendInt(int intToAppend);
    357   char* getText(void);
     370  const char* getText(void);
    358371};
    359372
     
    362375{
    363376 public:
    364   ProgressBar(void);
    365   ProgressBar(char* label);
     377  ProgressBar(const char* label = NULL);
    366378  virtual ~ProgressBar(void);
    367   void init(void);
    368379
    369380  void setProgress(double progress);
Note: See TracChangeset for help on using the changeset viewer.