Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.