Index: orxonox/branches/trackManager/src/gui/orxonox_gui_gtk.h
===================================================================
--- orxonox/branches/trackManager/src/gui/orxonox_gui_gtk.h	(revision 3369)
+++ orxonox/branches/trackManager/src/gui/orxonox_gui_gtk.h	(revision 3430)
@@ -3,5 +3,4 @@
  \brief Contains all th different Widgets.
 */
-
 #ifndef _ORXONOX_GUI_GTK_H
 #define _ORXONOX_GUI_GTK_H
@@ -10,4 +9,9 @@
 #include <config.h> 
 #endif
+
+//! verbose level, soon obsolete
+extern int verbose; // soon obsolete here
+
+#include "../debug.h"
 
 #ifdef HAVE_GTK2
@@ -26,11 +30,9 @@
 #include <gtk/gtkimage.h>
 #include <gtk/gtkeventbox.h>
-#endif /* HAVE_GTK2 */
-
-#ifdef HAVE_GTK2
-bool initGTK(int argc, char *argv[]);
-bool mainloopGTK(void);
-#endif /* HAVE_GTK2 */
-
+#include <gtk/gtkprogressbar.h>
+#endif /* HAVE_GTK2 */
+
+bool initGUI(int argc, char* argv[]);
+bool mainloopGUI(void);
 
 //! This is the topmost object that can be displayed all others are derived from it.
@@ -40,35 +42,49 @@
 
  public:
-  ~Widget ();
-
-  Widget* next; //!< next always points to the next Widget in the list. Every Widget has a next one, or has NULL as next
-#ifdef HAVE_GTK2
-  GtkWidget* widget; //!< widget is the gtk_widget that the specific Object Contains.
-#endif /* HAVE_GTK2 */
-  void init(void);
-  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
-  /**
-     \briefdefines isOption states
-  */
+  virtual ~Widget(void);
+  void init(void);
+  void destroy(void);
+
+  void show(void);
+  void hide(void);
+  void setSize(int width, int height);
+  virtual void setTitle(char* title) = 0;  //!< An abstract Function, that sets the title of Widgets.
+
+  Widget* findWidgetByName(char* name, unsigned int depth);
+  void walkThrough(void(*function)(Widget*), unsigned int depth);
+  void walkThrough(void(*function)(Widget*, void*), void* data, unsigned int depth);
+  static void listOptionsAndGroups(Widget* widget);
+  static void listOptions(Widget* widget);
+  static void listOptions(Widget* widget, void* data);
+  Widget* findOptionByNumber(int* number, unsigned int depth);
+  static void listGroups(Widget* widget);
+  static void listGroups(Widget* widget, void* data);
+  Widget* findGroupByNumber(int* number, unsigned int depth);
+  static void setOptions(Widget* widget);
+  static void flagCheck(Widget* widget, void* flagName);
+  
+#ifdef HAVE_GTK2
+  // Connection - Functions
+
+  gulong connectSignal(char* event, gint(*signal)(GtkWidget*, GdkEvent*, void* ));
+  gulong connectSignal(char* event, gint(*signal)(GtkWidget*, Widget* ));
+  gulong connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEvent*, void* ));
+  gulong connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, void* ));
+  gulong connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEventKey*, void* ));
+  void disconnectSignal(gulong signalID);
+
+  // Signals
+  static gint doNothingSignal(GtkWidget* widget, GdkEvent* event, void* nothing);
+#endif /* HAVE_GTK2 */
+
+  Widget* next;                     //!< next always points to the next Widget in the list. Every Widget has a next one, or has NULL as next
+#ifdef HAVE_GTK2
+  GtkWidget* widget;                //!< widget is the gtk_widget that the specific Object Contains.
+#endif /* HAVE_GTK2 */
+  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
+
+  //! defines isOption states
   enum option { containerType = -2, boxType = -1, nothingType = 0, boolType = 1, intType = 2}; 
-  char* label; //!< The name of the Widget. Some do display it, Options need it to save;
-#ifdef HAVE_GTK2
-  gulong connectSignal (char* event, gint (*signal)(GtkWidget*, GdkEvent*, void *));
-  gulong connectSignal (char* event, gint (*signal)(GtkWidget*, Widget *));
-  gulong connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEvent*, void *));
-  gulong connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEventKey*, void *));
-  void disconnectSignal (gulong signalID);
-#endif /* HAVE_GTK2 */
-  void show ();
-  void hide ();
-  void setSize(int width, int height);
-
-  void walkThrough (void (*function)(Widget*));
-  static void listOptions (Widget* widget);
-  static void setOptions (Widget* widget);
-  
-#ifdef HAVE_GTK2
-  static gint doNothingSignal (GtkWidget *widget, GdkEvent* event, void* nothing);
-#endif /* HAVE_GTK2 */
+  char* title;                      //!< The name of the Widget. Some do display it, Options need it to save;
 };
 
@@ -81,6 +97,10 @@
 
   void init(void);
-  void setGroupName (char* name);
-  char* getGroupName (void);
+  void destroy(void);
+
+  void setGroupName(char* name);
+  char* getGroupName(void);
+
+  virtual void fill(Widget* lowerWidget) = 0; //!< An abstract function, that fills Packers.
 };
 
@@ -94,12 +114,14 @@
 {
  private:
-  int borderwidth;
-  int policy;
-  
- public:
-  void init(void);
-  //  void setBorderWidth (int borderwidth);
-  //  virtual void setTitle (char* title) = 0;
-  void fill (Widget *lowerWidget);
+  int borderwidth;          //!< The width of The Container Boarder.
+  int policy;               //!< The Update Policy of a Container.
+  
+ public:
+  void init(void);
+  void destroy(void);
+
+  //  void setBorderWidth(int borderwidth);
+  //  virtual void setTitle(char* title) = 0;
+  void fill(Widget* lowerWidget);
 };
 
@@ -112,22 +134,24 @@
 {
  private:
-  bool isOpen;                //!< A bool Variable that checks if a Window is already open.
- public:
-  static Window* mainWindow;  //!< Pointer to the First Window that was opened. By default this should be the GUI's main-Window.
+  bool isOpen;                      //!< A bool Variable that checks if a Window is already open.
+ public:
+  static Window* mainWindow;        //!< Pointer to the First Window that was opened. By default this should be the GUI's main-Window.
   static void addWindow(Window* windowToAdd);
 
-  Window (void);
-  Window (char* windowName);
-  void init ();
-  
-  void setTitle (char* title);
-  void showall ();
-  void open();
-  void close();
-
-#ifdef HAVE_GTK2
-  static gint windowOpen (GtkWidget *widget, GdkEvent* event, void* window);
-  static gint windowClose (GtkWidget *widget, GdkEvent* event, void* window);
-  static gint orxonox_gui_quit (GtkWidget *widget, GdkEvent *event, gpointer data);
+  Window(void);
+  Window(char* windowName);
+  ~Window(void);
+  void init(void);
+  void destroy(void);
+  
+  void setTitle(char* title);
+  void showall(void);
+  void open(void);
+  void close(void);
+
+#ifdef HAVE_GTK2
+  // Signals
+  static gint windowOpen(GtkWidget* widget, GdkEvent* event, void* window);
+  static gint windowClose(GtkWidget* widget, GdkEvent* event, void* window);
 #endif /* HAVE_GTK2 */
 };
@@ -141,9 +165,11 @@
 {
  public:
-  Frame (char* frameName);
-  Frame (void);
-  void init(void);
-  
-  void setTitle (char* title);
+  Frame(void);
+  Frame(char* frameName);
+  ~Frame(void);
+  void init(void);
+  void destroy(void);
+  
+  void setTitle(char* title);
 };
 
@@ -155,9 +181,11 @@
 {
  public:
-  EventBox (char* eventBoxName);
-  EventBox (void);
-  void init(void);
-  
-  void setTitle (char* title);
+  EventBox(void);
+  EventBox(char* eventBoxName);
+  ~EventBox(void);
+  void init(void);
+  void destroy(void);
+  
+  void setTitle(char* title);
 };
 
@@ -166,15 +194,187 @@
    A Box can Contain multiple Widgets, that are ordered either horizontally or vertically
    I defined the standartbox to be horizontally.
-   A Box is always filled left->right (horizontally) or up->down (vertically)
+   A Box is always filled left->right(horizontally) or up->down(vertically)
 */
 class Box : public Packer
 {
  public:
-  Box (void);
-  Box (char boxtype);
+  Box(void);
+  Box(char boxtype);
+  ~Box(void);
   void init(char boxtype);
-
-  void fill (Widget* lowerWidget);
-
+  void destroy(void);
+  
+  void fill(Widget* lowerWidget);
+
+  void setTitle(char* title);
+};
+
+//! An Option is a Widget that contains something that may change its state.
+/**
+ * Options are the essence of a GUI, they: Configure, Start, Quit, Execute, and make it worth something
+ */
+class Option : public Widget
+{
+ protected:
+  bool saveable;  //!< Options can be Saved.
+  
+ public:
+  void init(void);
+  void destroy(void);
+
+  int value; //!< every option has a value either true or false(0,1) or something else like 25 for 25% of the volume
+  char* flagName; //!< options have a flag name that will be appendet if you start the Program from the GUI.
+  char* flagNameShort; //!< like flag_name but shorter
+  int defaultValue; //!< A default value is good, for hiding a option if it is not needed.(hidden if value == default_value)
+
+  void saveability(void);
+  void saveability(bool isSaveable);
+  bool isSaveable(void);
+  void setFlagName(char* flagname, int defaultvalue);
+  void setFlagName(char* flagname, char* flagnameshort, int defaultvalue);
+  virtual void redraw(void) = 0; //!< A Option must be able to redraw itself.
+  virtual void changeOption(void) = 0; //!< What to do, if an Option is Changed. eacht option decides for itself.
+#ifdef HAVE_GTK2
+    // Signals  
+  static gint OptionChange(GtkWidget* widget, Widget* option); //!< Signal for Options that change.
+#endif /* HAVE_GTK2 */
+};
+
+//! Buttons can be pressed, and released.
+/**
+ * Buttons are mainly there for executing some action like Starting the Programm, or Quiting it.
+ */
+class Button : public Option 
+{
+ public:
+  Button(char* buttonname);
+  ~Button(void);
+  void init(void);
+  void destroy(void);
+
+  void setTitle(char* title);
+  void redraw(void);
+  void changeOption(void);
+};
+
+//! CheckButtons are a key in configuring bool Variables
+/** CheckButtons can configure bool Variables like wireframe on/off, enable_sound etc.
+ */
+class CheckButton : public Option
+{
+ public:
+  CheckButton(char* buttonname);
+  ~CheckButton(void);
+  void init(void);
+  void destroy(void);
+
+  void setTitle(char* title);
+  bool isActive(void);           //!< a Bool value to see, if this CheckButton is active.
+  void redraw(void);
+  void changeOption(void);
+};
+
+//! Sliders are Options that can be modified in their value
+/**
+ * good for volume, brightness, etc.
+ */
+class Slider : public Option
+{
+ private:
+  int start;                            //!< The beginning of the Slider-range.
+  int end;                              //!< The end of the Slider-range.
+ public:
+  Slider(char* slidername, int start, int end);
+  ~Slider(void);
+  void init(int start, int end);
+  void destroy(void);
+
+  void setTitle(char* title);
+  void setValue(int value);
+  void redraw(void);
+  void changeOption(void);
+};
+
+//! A Menu is an Option that has a dropdown menu, where you can chose between different Items
+class Menu : public Option
+{
+ private:
+#ifdef HAVE_GTK2
+  GtkWidget* menu;                      //!< The menu That will hold the Options.
+  GtkWidget* item;                      //!< One Item From a Menu.
+#endif /* HAVE_GTK2 */
+  va_list itemlist;                     //!< The list to readin multiple Options.
+  
+ public:
+  Menu(char* menuname, ...);
+  ~Menu(void);
+  void init(void);
+  void destroy(void);
+  
+  void setTitle(char* title);
+  void addItem(char* itemName);
+  void redraw(void);
+  void changeOption(void);
+};
+
+//! A OptionLabel is a simple Label, that holds a char*, and will be updated, if changed.
+class OptionLabel : public Option
+{
+ private:
+
+ public:
+  OptionLabel(char* label, char* value);
+  ~OptionLabel(void);
+  void init(void);
+  void destroy(void);
+  
+  
+  void setValue(char* newValue);
+  void setTitle(char* title);
+  void redraw(void);
+  void changeOption(void);
+
+  char* cValue;                          //!< The Value the Label will have. \todo make private
+
+};
+
+//! A label is a Widget, that displays a text
+class Label : public Widget
+{
+ public:
+  Label(void);
+  Label(char* text);
+  ~Label(void);
+  void init(void);
+  void destroy(void);
+  
+  void setTitle(char* text);
+  void ereaseText(void);
+  void appendText(char* textToAppend);
+  void appendInt(int intToAppend);
+  char* getText(void);
+};
+
+//! A ProgressBar is a Widget, that can display a Progress
+class ProgressBar : public Widget
+{
+ public:
+  ProgressBar(void);
+  ProgressBar(char* label);
+  ~ProgressBar(void);
+  void init(void);
+  void destroy(void);
+
+  void setTitle(char* title);
+  void setProgress(double progress);
+  void setTotalSize(double totalSize);
+  double getProgress(void);
+
+ private:
+  double totalSize;         //!< The total Size of a download Bar
+  double progress;          //!< The progress of a Bar.
+#ifdef HAVE_GTK2
+  GtkAdjustment* adjustment;
+#endif /* HAVE_GTK2 */
 };
 
@@ -187,132 +387,13 @@
 {
  public:
-  Image (char* imgaename);
-  void init(void);
-};
-
-//! An Option is a Widget that contains something that may change its state.
-/**
- * Options are the essence of a GUI, they: Configure, Start, Quit, Execute, and make it worth something
- */
-class Option : public Widget
-{
- public:
-  //virtual gint OptionChange (GtkWidget *widget, GdkEvent *event, gpointer data);
-  void init(void);
-
-  int value; //!< every option has a value either true or false (0,1) or something else like 25 for 25% of the volume
-  char* flagName; //!< options have a flag name that will be appendet if you start the Program from the GUI.
-  char* flagNameShort; //!< like flag_name but shorter
-  int defaultValue; //!< A default value is good, for hiding a option if it is not needed. (hidden if value == default_value)
-  bool saveable;  //!< Options can be Saved.
-
-  void setFlagName (char* flagname, int defaultvalue);
-  void setFlagName (char* flagname, char* flagnameshort, int defaultvalue);
-  virtual void redraw () = 0; //!< A Option must be able to redraw itself.
-};
-
-//! Buttons can be pressed, and released.
-/**
- * Buttons are mainly there for executing some action like Starting the Programm, or Quiting it.
- */
-class Button : public Option 
-{
- public:
-  Button (char* buttonname);
-  void init(void);
-
-  void setTitle(char* title);
-  
-  void redraw();
-};
-
-//! CheckButtons are a key in configuring bool Variables
-/** CheckButtons can configure bool Variables like wireframe on/off, enable_sound etc.
- */
-class CheckButton : public Option
-{
- public:
-  CheckButton (char* buttonname);
-#ifdef HAVE_GTK2
-  static gint OptionChange (GtkWidget* widget, Widget* checkbutton);
-#endif /* HAVE_GTK2 */
-  
-  void init(void);
-  void setTitle(char* title);
-
-  bool isActive();
-  void redraw ();
-};
-
-//! Sliders are Options that can be modified in their value
-/**
- * good for volume, brightness, etc.
- */
-class Slider : public Option
-{
- public:
-  Slider (char* slidername,int start, int end);
-  void init(int start, int end);
-
-  void setTitle(char* title);
-  void setValue(int value);
-
-#ifdef HAVE_GTK2
-  static gint OptionChange (GtkWidget* widget, Widget* slider);
-#endif /* HAVE_GTK2 */
-  void redraw();
-};
-
-//! A Menu is an Option that has a dropdown menu, where you can chose between different Items
-class Menu : public Option
-{
- private:
-#ifdef HAVE_GTK2
-  GtkWidget* menu;     //!< The menu That will hold the Options.
-  GtkWidget* item;     //!< One Item From a Menu.
-#endif /* HAVE_GTK2 */
-  va_list itemlist;    //!> The list to readin multiple Options.
-  
- public:
-  Menu (char* menuname, ...);
-  void init(void);
-
-  void setTitle(char* title);
-
-  void addItem(char* itemName);
-#ifdef HAVE_GTK2
-  static gint OptionChange (GtkWidget* widget, Widget* menu);
-#endif /* HAVE_GTK2 */
-  void redraw();
-};
-
-//! A CharLabel is a simple Label, that holds a char*, and will be updated, if changed.
-class OptionLabel : public Option
-{
- public:
-  OptionLabel(char* label, char* value);
-  void init(void);
-  
-  char* cValue;   //!< The Value the Label will have.
-  
-  void setValue(char* newValue);
-  void setTitle(char* title);
-  void redraw();
-};
-
-//! A label is a Widget, that displays a text
-class Label : public Widget
-{
- public:
-  Label ();
-  Label (char* text);
-  void init(void);
-  
-  void setText (char* text);
-  char* getText ();
-};
-
-
-//gint orxonox_gui_quit (GtkWidget *widget, GdkEvent *event, gpointer data);
+  Image(char* imgaename);
+  ~Image(void);
+  void init(void);
+  void destroy(void);
+
+  void setTitle(char* title);
+};
+
+//gint orxonox_gui_quit(GtkWidget* widget, GdkEvent* event, gpointer data);
 
 #endif /* _ORXONOX_GUI_GTK_H */
