Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/gui/orxonox_gui.h @ 2588

Last change on this file since 2588 was 2588, checked in by bensch, 20 years ago

orxonox/trunk/gui: doxygen orxodox created for all h-files, classes and functions.

File size: 6.8 KB
Line 
1/*!
2 \file orxonox_gui.h
3 \brief Contains all Widgets and the Creation of the Gui
4*/
5
6#ifndef _ORXONOX_GUI_H
7#define _ORXONOX_GUI_H
8
9#include <stdlib.h>
10#include <string.h>
11#include <gtk/gtkmain.h>
12#include <gtk/gtkwindow.h>
13#include <gtk/gtkframe.h>
14#include <gtk/gtkhbox.h>
15#include <gtk/gtkvbox.h>
16#include <gtk/gtkbutton.h>
17#include <gtk/gtkcheckbutton.h>
18#include <gtk/gtkhscale.h>
19#include <gtk/gtkoptionmenu.h>
20#include <gtk/gtkmenu.h>
21#include <gtk/gtkmenuitem.h>
22#include <gtk/gtklabel.h>
23#include <gtk/gtkimage.h>
24#include <gtk/gtkeventbox.h>
25
26//! Class that creates the OrxonoxGui
27class OrxonoxGui
28{
29 public:
30  OrxonoxGui (int argc, char *argv[]);
31  ~OrxonoxGui ();
32
33};
34
35//! This is the topmost object that can be displayed all others are derived from it.
36
37class Widget
38{
39 private:
40 public:
41  Widget* next; //!< next always points to the next Widget in the list. Every Widget has a next one, or has NULL as next
42  GtkWidget* widget; //!< widget is the gtk_widget that the specific Object Contains.
43  virtual void init(void);
44  int is_option; //!< with this Paramenter one can set the IsOption type: -2:Container, -1: Box, 0: not an Option, 1: Bool-option, 2: int-option
45
46  void connectSignal (char* event, gint (*signal)(GtkWidget*, GdkEvent*, void *));
47  void connectSignal (char* event, gint (*signal)(GtkWidget*, Widget *));
48  void connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEvent*, void *));
49  void show ();
50
51  void walkThrough (void (*function)(Widget*));
52  static void listOptions (Widget* widget);
53  static void setOptions (Widget* widget);
54
55};
56
57
58//! This is a Container Class, it can contain one sub-Widget: down.
59/**
60 * A Container is a Widget that can hold a subWidget in addition to a next-Widget.
61 * The Container can by itself not be displayed created or used.
62 * The derived classes of Container can be displayed
63*/
64class Container : public Widget
65{
66 private:
67  int borderwidth;
68  int policy;
69  char* label;
70 
71 public:
72  void init(void);
73  Widget* down; //!< this points to the Widget below this.
74  //  void setBorderWidth (int borderwidth);
75  //  virtual void setTitle (char* title) = 0;
76  void fill (Widget *lowerWidget);
77};
78
79//! Window is the class that creates new Windows, and handels them
80/**
81 * A Window is a class derived from Container that contains a window-widget.
82 * It has the ability to hold one sub-object
83 */
84class Window : public Container
85{
86 public:
87  Window (char* windowName);
88  Window (void);
89  ~Window ();
90  void init ();
91 
92  void setTitle (char* title);
93  void showall (); 
94  static gint orxonox_gui_quit (GtkWidget *widget, GdkEvent *event, gpointer data);
95};
96
97//! Frame is the class that handles frames
98/**
99 * A Frame is an object, that has a border and if you like a name on it.
100 * It can contain a Widget, which means that you can insert anything you like inside of a frame
101 */
102class Frame :public Container
103{
104 public:
105  Frame (char* frameName);
106  Frame (void);
107  ~Frame ();
108  void init(void);
109 
110  void setTitle (char* title);
111};
112
113//! EventBox is a Container that can Handle all Events happening inside of it.
114/**
115 * Example: if you have a picture, and you want it to catch mouse-clicks, you have to pack it inside a EventBox
116 */
117class EventBox : public Container
118{
119 public:
120  EventBox (char* eventBoxName);
121  EventBox (void);
122  ~EventBox ();
123  void init(void);
124 
125  void setTitle (char* title);
126};
127
128//! A Box can contain multiple Widgets
129/**
130 * A Box can Contain multiple Widgets, that are ordered either horizontally or vertically
131 * I defined the standartbox to be horizontally.
132 * A Box is always filled left->right (horizontally) or up->down (vertically)
133 */
134class Box : public Widget
135{
136 public:
137  Box (void);
138  Box (char boxtype);
139  ~Box (void);
140  void init(char boxtype);
141
142  Widget* down; //!< the Lower Widget of a Box.
143  void fill (Widget* lowerWidget);
144
145};
146
147//! Image is the keeper of one Image
148/**
149 * Images are mighty cool.
150 * Images can help you lighten up the Programming process, and will give everyone a better impression of the Software.
151 */
152class Image : public Widget
153{
154 public:
155  Image (char* imgaename);
156  ~Image ();
157  void init(void);
158};
159
160//! An Option is a Widget that contains something that may change its state.
161/**
162 * Options are the essence of a GUI, they: Configure, Start, Quit, Execute, and make it worth something
163 */
164class Option : public Widget
165{
166 public:
167  //virtual gint OptionChange (GtkWidget *widget, GdkEvent *event, gpointer data);
168  void init(void);
169
170  int value; //!< every option has a value either true or false (0,1) or something else like 25 for 25% of the volume
171  char* option_name; //!< options have a name, that can be displayed around them
172  char* flag_name; //!< options have a flag name that will be appendet if you start the Program from the GUI.
173  char* flag_name_short; //!< like flag_name but shorter
174  int default_value; //!< A default value is good, for hiding a option if it is not needed. (hidden if value == default_value)
175
176  void setFlagName (char* flagname, int defaultvalue);
177  void setFlagName (char* flagname, char* flagnameshort, int defaultvalue);
178  virtual void redraw () = 0; //!< A Option must be able to redraw itself.
179};
180
181//! Buttons can be pressed, and released.
182/**
183 * Buttons are mainly there for executing some action like Starting the Programm, or Quiting it.
184 */
185class Button : public Option
186{
187 public:
188  Button (char* buttonname);
189  ~Button (void);
190  void init(void);
191
192  void setTitle(char* title);
193 
194  void redraw();
195};
196
197//! CheckButtons are a key in configuring bool Variables
198/** CheckButtons can configure bool Variables like wireframe on/off, enable_sound etc.
199 */
200class CheckButton : public Option
201{
202 public:
203  CheckButton (char* buttonname);
204  ~CheckButton (void);
205  static gint OptionChange (GtkWidget* widget, Widget* checkbutton);
206 
207  void init(void);
208  void setTitle(char* title);
209
210  void redraw ();
211};
212
213//! Sliders are Options that can be modified in their value
214/**
215 * good for volume, brightness, etc.
216 */
217class Slider : public Option
218{
219 public:
220  Slider (char* slidername,int start, int end);
221  ~Slider ();
222  void init(int start, int end);
223
224  void setTitle(char* title);
225  void setValue(int value);
226
227  static gint OptionChange (GtkWidget* widget, Widget* slider);
228  void redraw();
229};
230
231//! A Menu is an Option that has a dropdown menu, where you can chose between different Items
232class Menu : public Option
233{
234 private:
235  GtkWidget* menu;
236  GtkWidget* item;
237  va_list itemlist;
238 
239 public:
240  Menu (char* menuname, ...);
241  ~Menu ();
242  void init(void);
243
244  void setTitle(char* title);
245
246  void addItem(char* itemName);
247  static gint OptionChange (GtkWidget* widget, Widget* menu);
248  void redraw();
249};
250
251//! A label is a Widget, that displays a text
252class Label : public Widget
253{
254 public:
255  Label ();
256  Label (char* text);
257  ~Label ();
258  void init(void);
259 
260  void setText (char * text);
261  char* getText ();
262};
263
264//gint orxonox_gui_quit (GtkWidget *widget, GdkEvent *event, gpointer data);
265
266#endif /* _ORXONOX_GUI_H */
Note: See TracBrowser for help on using the repository browser.