Changeset 4046 in orxonox.OLD for orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui_gtk.h
- Timestamp:
- May 4, 2005, 11:50:34 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui_gtk.h
r4039 r4046 30 30 #endif /* HAVE_GTK2 */ 31 31 32 // enumerator for different GuiOption-Types 33 enum GUI_OPTION {GUI_CONTAINER = -2, 34 GUI_BOX = -1, 35 GUI_NOTHING = 0, 36 GUI_BOOL = 1, 37 GUI_INT = 2, 38 GUI_FLOAT = 3, 39 GUI_CHAR = 4, 40 GUI_CHAR_ARRAY = 5}; 41 32 42 extern char* guiExecutable; 33 43 extern char* progExecutable; … … 48 58 void hide(void); 49 59 void setSize(int width, int height); 60 50 61 virtual void setTitle(const char* title); //!< An abstract Function, that sets the title of Widgets. 51 62 … … 65 76 #ifdef HAVE_GTK2 66 77 // Connection - Functions 67 68 78 gulong connectSignal(char* event, gint(*signal)(GtkWidget*, GdkEvent*, void* )); 69 79 gulong connectSignal(char* event, gint(*signal)(GtkWidget*, Widget* )); … … 72 82 gulong connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEventKey*, void* )); 73 83 void disconnectSignal(gulong signalID); 74 75 84 // Signals 76 85 static gint doNothingSignal(GtkWidget* widget, GdkEvent* event, void* nothing); 77 #endif /* HAVE_GTK2 */ 86 #else /* HAVE_GTK2 */ 87 // Connection - Functions 88 unsigned long connectSignal(char* event, int(*signal)(void*, void*, void* )){}; 89 unsigned long connectSignal(char* event, int(*signal)(void*, Widget* )){}; 90 unsigned long connectSignal(char* event, void* extObj, int(*signal)(void*, void*, void* )){}; 91 unsigned long connectSignal(char* event, void* extObj, int(*signal)(void*, void* )){}; 92 void disconnectSignal(unsigned long signalID); 93 // Signals 94 static int doNothingSignal(void* widget, void* event, void* nothing); 95 #endif /* HAVE_GTK2 */ 96 78 97 79 98 Widget* next; //!< next always points to the next Widget in the list. Every Widget has a next one, or has NULL as next 80 99 #ifdef HAVE_GTK2 81 100 GtkWidget* widget; //!< widget is the gtk_widget that the specific Object Contains. 82 #endif /* HAVE_GTK2 */ 101 #else /* HAVE_GTK2 */ 102 void* widget; 103 #endif /* HAVE_GTK2 */ 104 83 105 int isOption; //!< with this Paramenter one can set the option-type: -2:Container, -1: Box, 0: not an Option, 1: Bool-option, 2: int-option, 3: float option, 4:char option, 5: char* option 84 85 //! defines isOption states 86 enum option { containerType = -2, boxType = -1, nothingType = 0, boolType = 1, intType = 2}; 106 87 107 char* title; //!< The name of the Widget. Some do display it, Options need it to save; 88 108 }; … … 95 115 virtual ~Packer(void); 96 116 97 Widget* down; //!< this points to the Widget below this. 98 char* groupName; //!< For each Packer you can specify a Groupname under which the lowerWidgets will be saved. 99 100 void setGroupName(char* name); 101 char* getGroupName(void); 117 Widget* down; //!< this points to the Widget below this. 118 char* groupName; //!< For each Packer you can specify a Groupname under which the lowerWidgets will be saved. 119 120 void setGroupName(const char* name); 121 /** \returns the GroupName if existent NULL otherwise */ 122 inline const char* getGroupName(void) const {return this->groupName;} 123 102 124 103 125 virtual void fill(Widget* lowerWidget) = 0; //!< An abstract function, that fills Packers. … … 119 141 Container(void); 120 142 virtual ~Container(void); 121 //void setBorderWidth(int borderwidth);143 void setBorderWidth(int borderwidth); 122 144 void fill(Widget* lowerWidget); 123 145 }; … … 136 158 static void addWindow(Window* windowToAdd); 137 159 138 Window(void); 139 Window(char* windowName); 160 Window(const char* windowName = NULL); 140 161 virtual ~Window(void); 141 void init(void); 142 143 void setTitle(const char* title); 162 163 virtual void setTitle(const char* title); 144 164 void showall(void); 145 165 void open(void); … … 150 170 static gint windowOpen(GtkWidget* widget, GdkEvent* event, void* window); 151 171 static gint windowClose(GtkWidget* widget, GdkEvent* event, void* window); 172 #else /* HAVE_GTK2 */ 173 int Window::windowOpen(void* widget, void* event, void* window); 174 int Window::windowClose(void* widget, void* event, void* window); 152 175 #endif /* HAVE_GTK2 */ 153 176 }; … … 161 184 { 162 185 public: 163 Frame(void); 164 Frame(char* frameName); 186 Frame(char* frameName = NULL); 165 187 virtual ~Frame(void); 166 void init(void); 167 168 void setTitle(const char* title); 188 189 virtual void setTitle(const char* title); 169 190 }; 170 191 … … 176 197 { 177 198 public: 178 EventBox(void); 179 EventBox(char* eventBoxName); 199 EventBox(const char* eventBoxName = NULL); 180 200 virtual ~EventBox(void); 181 void init(void);182 201 }; 183 202 … … 191 210 { 192 211 public: 193 Box(void); 194 Box(char boxtype); 212 Box(char boxtype = 'h'); 195 213 virtual ~Box(void); 196 void init(char boxtype); 197 198 void fill(Widget* lowerWidget); 214 215 virtual void fill(Widget* lowerWidget); 199 216 }; 200 217 … … 206 223 { 207 224 protected: 208 bool saveable; //!< Options can be Saved.225 bool saveable; //!< Options can be Saved. 209 226 210 227 public: 211 228 Option(void); 212 229 virtual ~Option(void); 213 void init(void); 214 215 int value; //!< every option has a value either true or false(0,1) or something else like 25 for 25% of the volume 216 char* flagName; //!< options have a flag name that will be appendet if you start the Program from the GUI. 217 char* flagNameShort; //!< like flag_name but shorter 218 int defaultValue; //!< A default value is good, for hiding a option if it is not needed.(hidden if value == default_value) 219 220 void saveability(void); 221 void saveability(bool isSaveable); 230 231 int value; //!< every option has a value either true or false(0,1) or something else like 25 for 25% of the volume 232 char* flagName; //!< options have a flag name that will be appendet if you start the Program from the GUI. 233 char* flagNameShort; //!< like flag_name but shorter 234 int defaultValue; //!< A default value is good, for hiding a option if it is not needed.(hidden if value == default_value) 235 236 char* shortDescription; //!< A Text that describes this option in short 237 char* longDescription; //!< A Longer Text describing this option in a full way 238 239 void saveability(bool isSaveable = true); 222 240 virtual char* save(void); 223 241 virtual void load(char* loadString); 224 242 225 243 bool isSaveable(void); 226 void setFlagName(char* flagname, int defaultvalue); 227 void setFlagName(char* flagname, char* flagnameshort, int defaultvalue); 228 virtual void redraw(void) = 0; //!< A Option must be able to redraw itself. 244 void setFlagName(const char* flagname, int defaultvalue); 245 void setFlagName(const char* flagname, const char* flagnameshort, int defaultvalue); 246 void setDescription(const char* shortDescription, const char* longDescription = NULL); 247 248 virtual void redraw(void) = 0; //!< A Option must be able to redraw itself. 229 249 virtual void changeOption(void) = 0; //!< What to do, if an Option is Changed. eacht option decides for itself. 230 250 #ifdef HAVE_GTK2 … … 241 261 { 242 262 public: 243 Button(char* button name);263 Button(char* buttonName = NULL); 244 264 virtual ~Button(void); 245 void init(void); 246 247 void setTitle(const char* title); 248 void redraw(void); 249 void changeOption(void); 265 266 virtual void setTitle(const char* title); 267 virtual void redraw(void); 268 virtual void changeOption(void); 250 269 }; 251 270 … … 256 275 { 257 276 public: 258 CheckButton(c har* buttonname);277 CheckButton(const char* buttonName = NULL); 259 278 virtual ~CheckButton(void); 260 void init(void); 261 262 void setTitle(const char* title); 263 bool isActive(void); //!< a Bool value to see, if this CheckButton is active.264 v oid redraw(void);265 v oid changeOption(void);279 280 bool isActive(void); 281 282 virtual void setTitle(const char* title); 283 virtual void redraw(void); 284 virtual void changeOption(void); 266 285 }; 267 286 … … 276 295 int end; //!< The end of the Slider-range. 277 296 public: 278 Slider(c har* slidername, int start, int end);297 Slider(const char* slidername, int start, int end); 279 298 virtual ~Slider(void); 280 void init(int start, int end);281 299 282 300 void setValue(int value); 283 v oid redraw(void);284 v oid changeOption(void);301 virtual void redraw(void); 302 virtual void changeOption(void); 285 303 }; 286 304 … … 301 319 GtkWidget* item; //!< One Item From a Menu. 302 320 #endif /* HAVE_GTK2 */ 321 303 322 MenuItem* next; //!< Pointer to the next MenuItem. 304 323 }; … … 316 335 317 336 void addItem(char* itemName); 318 v oid redraw(void);319 v oid changeOption(void);337 virtual void redraw(void); 338 virtual void changeOption(void); 320 339 }; 321 340 … … 323 342 class OptionLabel : public Option 324 343 { 325 private: 326 327 public: 328 OptionLabel(char* label, char* value); 344 public: 345 OptionLabel(const char* label, const char* value); 329 346 virtual ~OptionLabel(void); 330 void init(void); 331 332 void setValue(char* newValue); 347 348 void setValue(const char* newValue); 333 349 334 350 virtual char* save(void); 335 351 virtual void load(char* loadString); 336 352 337 v oid redraw(void);338 v oid changeOption(void);353 virtual void redraw(void); 354 virtual void changeOption(void); 339 355 340 356 char* cValue; //!< The Value the Label will have. \todo make private 341 342 357 }; 343 358 … … 346 361 { 347 362 public: 348 Label(void); 349 Label(char* text); 363 Label(const char* text = NULL); 350 364 virtual ~Label(void); 351 void init(void); 352 353 void setTitle(char* text); 365 366 virtual void setTitle(const char* text); 354 367 void ereaseText(void); 355 368 void appendText(char* textToAppend); 356 369 void appendInt(int intToAppend); 357 c har* getText(void);370 const char* getText(void); 358 371 }; 359 372 … … 362 375 { 363 376 public: 364 ProgressBar(void); 365 ProgressBar(char* label); 377 ProgressBar(const char* label = NULL); 366 378 virtual ~ProgressBar(void); 367 void init(void);368 379 369 380 void setProgress(double progress);
Note: See TracChangeset
for help on using the changeset viewer.