Changeset 3430 in orxonox.OLD for orxonox/branches/trackManager/src/gui/orxonox_gui_gtk.h
- Timestamp:
- Mar 1, 2005, 9:50:30 AM (19 years ago)
- Location:
- orxonox/branches/trackManager
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/trackManager
- Property svn:externals set to
-
orxonox/branches/trackManager/src/gui/orxonox_gui_gtk.h
r3187 r3430 3 3 \brief Contains all th different Widgets. 4 4 */ 5 6 5 #ifndef _ORXONOX_GUI_GTK_H 7 6 #define _ORXONOX_GUI_GTK_H … … 10 9 #include <config.h> 11 10 #endif 11 12 //! verbose level, soon obsolete 13 extern int verbose; // soon obsolete here 14 15 #include "../debug.h" 12 16 13 17 #ifdef HAVE_GTK2 … … 26 30 #include <gtk/gtkimage.h> 27 31 #include <gtk/gtkeventbox.h> 28 #endif /* HAVE_GTK2 */ 29 30 #ifdef HAVE_GTK2 31 bool initGTK(int argc, char *argv[]); 32 bool mainloopGTK(void); 33 #endif /* HAVE_GTK2 */ 34 32 #include <gtk/gtkprogressbar.h> 33 #endif /* HAVE_GTK2 */ 34 35 bool initGUI(int argc, char* argv[]); 36 bool mainloopGUI(void); 35 37 36 38 //! This is the topmost object that can be displayed all others are derived from it. … … 40 42 41 43 public: 42 ~Widget (); 43 44 Widget* next; //!< next always points to the next Widget in the list. Every Widget has a next one, or has NULL as next 45 #ifdef HAVE_GTK2 46 GtkWidget* widget; //!< widget is the gtk_widget that the specific Object Contains. 47 #endif /* HAVE_GTK2 */ 48 void init(void); 49 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 50 /** 51 \briefdefines isOption states 52 */ 44 virtual ~Widget(void); 45 void init(void); 46 void destroy(void); 47 48 void show(void); 49 void hide(void); 50 void setSize(int width, int height); 51 virtual void setTitle(char* title) = 0; //!< An abstract Function, that sets the title of Widgets. 52 53 Widget* findWidgetByName(char* name, unsigned int depth); 54 void walkThrough(void(*function)(Widget*), unsigned int depth); 55 void walkThrough(void(*function)(Widget*, void*), void* data, unsigned int depth); 56 static void listOptionsAndGroups(Widget* widget); 57 static void listOptions(Widget* widget); 58 static void listOptions(Widget* widget, void* data); 59 Widget* findOptionByNumber(int* number, unsigned int depth); 60 static void listGroups(Widget* widget); 61 static void listGroups(Widget* widget, void* data); 62 Widget* findGroupByNumber(int* number, unsigned int depth); 63 static void setOptions(Widget* widget); 64 static void flagCheck(Widget* widget, void* flagName); 65 66 #ifdef HAVE_GTK2 67 // Connection - Functions 68 69 gulong connectSignal(char* event, gint(*signal)(GtkWidget*, GdkEvent*, void* )); 70 gulong connectSignal(char* event, gint(*signal)(GtkWidget*, Widget* )); 71 gulong connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEvent*, void* )); 72 gulong connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, void* )); 73 gulong connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEventKey*, void* )); 74 void disconnectSignal(gulong signalID); 75 76 // Signals 77 static gint doNothingSignal(GtkWidget* widget, GdkEvent* event, void* nothing); 78 #endif /* HAVE_GTK2 */ 79 80 Widget* next; //!< next always points to the next Widget in the list. Every Widget has a next one, or has NULL as next 81 #ifdef HAVE_GTK2 82 GtkWidget* widget; //!< widget is the gtk_widget that the specific Object Contains. 83 #endif /* HAVE_GTK2 */ 84 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 85 86 //! defines isOption states 53 87 enum option { containerType = -2, boxType = -1, nothingType = 0, boolType = 1, intType = 2}; 54 char* label; //!< The name of the Widget. Some do display it, Options need it to save; 55 #ifdef HAVE_GTK2 56 gulong connectSignal (char* event, gint (*signal)(GtkWidget*, GdkEvent*, void *)); 57 gulong connectSignal (char* event, gint (*signal)(GtkWidget*, Widget *)); 58 gulong connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEvent*, void *)); 59 gulong connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEventKey*, void *)); 60 void disconnectSignal (gulong signalID); 61 #endif /* HAVE_GTK2 */ 62 void show (); 63 void hide (); 64 void setSize(int width, int height); 65 66 void walkThrough (void (*function)(Widget*)); 67 static void listOptions (Widget* widget); 68 static void setOptions (Widget* widget); 69 70 #ifdef HAVE_GTK2 71 static gint doNothingSignal (GtkWidget *widget, GdkEvent* event, void* nothing); 72 #endif /* HAVE_GTK2 */ 88 char* title; //!< The name of the Widget. Some do display it, Options need it to save; 73 89 }; 74 90 … … 81 97 82 98 void init(void); 83 void setGroupName (char* name); 84 char* getGroupName (void); 99 void destroy(void); 100 101 void setGroupName(char* name); 102 char* getGroupName(void); 103 104 virtual void fill(Widget* lowerWidget) = 0; //!< An abstract function, that fills Packers. 85 105 }; 86 106 … … 94 114 { 95 115 private: 96 int borderwidth; 97 int policy; 98 99 public: 100 void init(void); 101 // void setBorderWidth (int borderwidth); 102 // virtual void setTitle (char* title) = 0; 103 void fill (Widget *lowerWidget); 116 int borderwidth; //!< The width of The Container Boarder. 117 int policy; //!< The Update Policy of a Container. 118 119 public: 120 void init(void); 121 void destroy(void); 122 123 // void setBorderWidth(int borderwidth); 124 // virtual void setTitle(char* title) = 0; 125 void fill(Widget* lowerWidget); 104 126 }; 105 127 … … 112 134 { 113 135 private: 114 bool isOpen; //!< A bool Variable that checks if a Window is already open.115 public: 116 static Window* mainWindow; //!< Pointer to the First Window that was opened. By default this should be the GUI's main-Window.136 bool isOpen; //!< A bool Variable that checks if a Window is already open. 137 public: 138 static Window* mainWindow; //!< Pointer to the First Window that was opened. By default this should be the GUI's main-Window. 117 139 static void addWindow(Window* windowToAdd); 118 140 119 Window (void); 120 Window (char* windowName); 121 void init (); 122 123 void setTitle (char* title); 124 void showall (); 125 void open(); 126 void close(); 127 128 #ifdef HAVE_GTK2 129 static gint windowOpen (GtkWidget *widget, GdkEvent* event, void* window); 130 static gint windowClose (GtkWidget *widget, GdkEvent* event, void* window); 131 static gint orxonox_gui_quit (GtkWidget *widget, GdkEvent *event, gpointer data); 141 Window(void); 142 Window(char* windowName); 143 ~Window(void); 144 void init(void); 145 void destroy(void); 146 147 void setTitle(char* title); 148 void showall(void); 149 void open(void); 150 void close(void); 151 152 #ifdef HAVE_GTK2 153 // Signals 154 static gint windowOpen(GtkWidget* widget, GdkEvent* event, void* window); 155 static gint windowClose(GtkWidget* widget, GdkEvent* event, void* window); 132 156 #endif /* HAVE_GTK2 */ 133 157 }; … … 141 165 { 142 166 public: 143 Frame (char* frameName); 144 Frame (void); 145 void init(void); 146 147 void setTitle (char* title); 167 Frame(void); 168 Frame(char* frameName); 169 ~Frame(void); 170 void init(void); 171 void destroy(void); 172 173 void setTitle(char* title); 148 174 }; 149 175 … … 155 181 { 156 182 public: 157 EventBox (char* eventBoxName); 158 EventBox (void); 159 void init(void); 160 161 void setTitle (char* title); 183 EventBox(void); 184 EventBox(char* eventBoxName); 185 ~EventBox(void); 186 void init(void); 187 void destroy(void); 188 189 void setTitle(char* title); 162 190 }; 163 191 … … 166 194 A Box can Contain multiple Widgets, that are ordered either horizontally or vertically 167 195 I defined the standartbox to be horizontally. 168 A Box is always filled left->right (horizontally) or up->down(vertically)196 A Box is always filled left->right(horizontally) or up->down(vertically) 169 197 */ 170 198 class Box : public Packer 171 199 { 172 200 public: 173 Box (void); 174 Box (char boxtype); 201 Box(void); 202 Box(char boxtype); 203 ~Box(void); 175 204 void init(char boxtype); 176 177 void fill (Widget* lowerWidget); 178 205 void destroy(void); 206 207 void fill(Widget* lowerWidget); 208 209 void setTitle(char* title); 210 }; 211 212 //! An Option is a Widget that contains something that may change its state. 213 /** 214 * Options are the essence of a GUI, they: Configure, Start, Quit, Execute, and make it worth something 215 */ 216 class Option : public Widget 217 { 218 protected: 219 bool saveable; //!< Options can be Saved. 220 221 public: 222 void init(void); 223 void destroy(void); 224 225 int value; //!< every option has a value either true or false(0,1) or something else like 25 for 25% of the volume 226 char* flagName; //!< options have a flag name that will be appendet if you start the Program from the GUI. 227 char* flagNameShort; //!< like flag_name but shorter 228 int defaultValue; //!< A default value is good, for hiding a option if it is not needed.(hidden if value == default_value) 229 230 void saveability(void); 231 void saveability(bool isSaveable); 232 bool isSaveable(void); 233 void setFlagName(char* flagname, int defaultvalue); 234 void setFlagName(char* flagname, char* flagnameshort, int defaultvalue); 235 virtual void redraw(void) = 0; //!< A Option must be able to redraw itself. 236 virtual void changeOption(void) = 0; //!< What to do, if an Option is Changed. eacht option decides for itself. 237 #ifdef HAVE_GTK2 238 // Signals 239 static gint OptionChange(GtkWidget* widget, Widget* option); //!< Signal for Options that change. 240 #endif /* HAVE_GTK2 */ 241 }; 242 243 //! Buttons can be pressed, and released. 244 /** 245 * Buttons are mainly there for executing some action like Starting the Programm, or Quiting it. 246 */ 247 class Button : public Option 248 { 249 public: 250 Button(char* buttonname); 251 ~Button(void); 252 void init(void); 253 void destroy(void); 254 255 void setTitle(char* title); 256 void redraw(void); 257 void changeOption(void); 258 }; 259 260 //! CheckButtons are a key in configuring bool Variables 261 /** CheckButtons can configure bool Variables like wireframe on/off, enable_sound etc. 262 */ 263 class CheckButton : public Option 264 { 265 public: 266 CheckButton(char* buttonname); 267 ~CheckButton(void); 268 void init(void); 269 void destroy(void); 270 271 void setTitle(char* title); 272 bool isActive(void); //!< a Bool value to see, if this CheckButton is active. 273 void redraw(void); 274 void changeOption(void); 275 }; 276 277 //! Sliders are Options that can be modified in their value 278 /** 279 * good for volume, brightness, etc. 280 */ 281 class Slider : public Option 282 { 283 private: 284 int start; //!< The beginning of the Slider-range. 285 int end; //!< The end of the Slider-range. 286 public: 287 Slider(char* slidername, int start, int end); 288 ~Slider(void); 289 void init(int start, int end); 290 void destroy(void); 291 292 void setTitle(char* title); 293 void setValue(int value); 294 void redraw(void); 295 void changeOption(void); 296 }; 297 298 //! A Menu is an Option that has a dropdown menu, where you can chose between different Items 299 class Menu : public Option 300 { 301 private: 302 #ifdef HAVE_GTK2 303 GtkWidget* menu; //!< The menu That will hold the Options. 304 GtkWidget* item; //!< One Item From a Menu. 305 #endif /* HAVE_GTK2 */ 306 va_list itemlist; //!< The list to readin multiple Options. 307 308 public: 309 Menu(char* menuname, ...); 310 ~Menu(void); 311 void init(void); 312 void destroy(void); 313 314 void setTitle(char* title); 315 void addItem(char* itemName); 316 void redraw(void); 317 void changeOption(void); 318 }; 319 320 //! A OptionLabel is a simple Label, that holds a char*, and will be updated, if changed. 321 class OptionLabel : public Option 322 { 323 private: 324 325 public: 326 OptionLabel(char* label, char* value); 327 ~OptionLabel(void); 328 void init(void); 329 void destroy(void); 330 331 332 void setValue(char* newValue); 333 void setTitle(char* title); 334 void redraw(void); 335 void changeOption(void); 336 337 char* cValue; //!< The Value the Label will have. \todo make private 338 339 }; 340 341 //! A label is a Widget, that displays a text 342 class Label : public Widget 343 { 344 public: 345 Label(void); 346 Label(char* text); 347 ~Label(void); 348 void init(void); 349 void destroy(void); 350 351 void setTitle(char* text); 352 void ereaseText(void); 353 void appendText(char* textToAppend); 354 void appendInt(int intToAppend); 355 char* getText(void); 356 }; 357 358 //! A ProgressBar is a Widget, that can display a Progress 359 class ProgressBar : public Widget 360 { 361 public: 362 ProgressBar(void); 363 ProgressBar(char* label); 364 ~ProgressBar(void); 365 void init(void); 366 void destroy(void); 367 368 void setTitle(char* title); 369 void setProgress(double progress); 370 void setTotalSize(double totalSize); 371 double getProgress(void); 372 373 private: 374 double totalSize; //!< The total Size of a download Bar 375 double progress; //!< The progress of a Bar. 376 #ifdef HAVE_GTK2 377 GtkAdjustment* adjustment; 378 #endif /* HAVE_GTK2 */ 179 379 }; 180 380 … … 187 387 { 188 388 public: 189 Image (char* imgaename); 190 void init(void); 191 }; 192 193 //! An Option is a Widget that contains something that may change its state. 194 /** 195 * Options are the essence of a GUI, they: Configure, Start, Quit, Execute, and make it worth something 196 */ 197 class Option : public Widget 198 { 199 public: 200 //virtual gint OptionChange (GtkWidget *widget, GdkEvent *event, gpointer data); 201 void init(void); 202 203 int value; //!< every option has a value either true or false (0,1) or something else like 25 for 25% of the volume 204 char* flagName; //!< options have a flag name that will be appendet if you start the Program from the GUI. 205 char* flagNameShort; //!< like flag_name but shorter 206 int defaultValue; //!< A default value is good, for hiding a option if it is not needed. (hidden if value == default_value) 207 bool saveable; //!< Options can be Saved. 208 209 void setFlagName (char* flagname, int defaultvalue); 210 void setFlagName (char* flagname, char* flagnameshort, int defaultvalue); 211 virtual void redraw () = 0; //!< A Option must be able to redraw itself. 212 }; 213 214 //! Buttons can be pressed, and released. 215 /** 216 * Buttons are mainly there for executing some action like Starting the Programm, or Quiting it. 217 */ 218 class Button : public Option 219 { 220 public: 221 Button (char* buttonname); 222 void init(void); 223 224 void setTitle(char* title); 225 226 void redraw(); 227 }; 228 229 //! CheckButtons are a key in configuring bool Variables 230 /** CheckButtons can configure bool Variables like wireframe on/off, enable_sound etc. 231 */ 232 class CheckButton : public Option 233 { 234 public: 235 CheckButton (char* buttonname); 236 #ifdef HAVE_GTK2 237 static gint OptionChange (GtkWidget* widget, Widget* checkbutton); 238 #endif /* HAVE_GTK2 */ 239 240 void init(void); 241 void setTitle(char* title); 242 243 bool isActive(); 244 void redraw (); 245 }; 246 247 //! Sliders are Options that can be modified in their value 248 /** 249 * good for volume, brightness, etc. 250 */ 251 class Slider : public Option 252 { 253 public: 254 Slider (char* slidername,int start, int end); 255 void init(int start, int end); 256 257 void setTitle(char* title); 258 void setValue(int value); 259 260 #ifdef HAVE_GTK2 261 static gint OptionChange (GtkWidget* widget, Widget* slider); 262 #endif /* HAVE_GTK2 */ 263 void redraw(); 264 }; 265 266 //! A Menu is an Option that has a dropdown menu, where you can chose between different Items 267 class Menu : public Option 268 { 269 private: 270 #ifdef HAVE_GTK2 271 GtkWidget* menu; //!< The menu That will hold the Options. 272 GtkWidget* item; //!< One Item From a Menu. 273 #endif /* HAVE_GTK2 */ 274 va_list itemlist; //!> The list to readin multiple Options. 275 276 public: 277 Menu (char* menuname, ...); 278 void init(void); 279 280 void setTitle(char* title); 281 282 void addItem(char* itemName); 283 #ifdef HAVE_GTK2 284 static gint OptionChange (GtkWidget* widget, Widget* menu); 285 #endif /* HAVE_GTK2 */ 286 void redraw(); 287 }; 288 289 //! A CharLabel is a simple Label, that holds a char*, and will be updated, if changed. 290 class OptionLabel : public Option 291 { 292 public: 293 OptionLabel(char* label, char* value); 294 void init(void); 295 296 char* cValue; //!< The Value the Label will have. 297 298 void setValue(char* newValue); 299 void setTitle(char* title); 300 void redraw(); 301 }; 302 303 //! A label is a Widget, that displays a text 304 class Label : public Widget 305 { 306 public: 307 Label (); 308 Label (char* text); 309 void init(void); 310 311 void setText (char* text); 312 char* getText (); 313 }; 314 315 316 //gint orxonox_gui_quit (GtkWidget *widget, GdkEvent *event, gpointer data); 389 Image(char* imgaename); 390 ~Image(void); 391 void init(void); 392 void destroy(void); 393 394 void setTitle(char* title); 395 }; 396 397 //gint orxonox_gui_quit(GtkWidget* widget, GdkEvent* event, gpointer data); 317 398 318 399 #endif /* _ORXONOX_GUI_GTK_H */
Note: See TracChangeset
for help on using the changeset viewer.