Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/gui/gl_gui/glgui_widget.h @ 5479

Last change on this file since 5479 was 5456, checked in by bensch, 19 years ago

orxonox/trunk: added Lasers and Rockets Class as TestBullet is not the best Name

File size: 2.0 KB
Line 
1/*!
2 * @file glgui_widget.h
3 * The gl_widget of the openglGUI
4 */
5
6#ifndef _GLGUI_WIDGET_H
7#define _GLGUI_WIDGET_H
8
9#include "element_2d.h"
10#include "glincl.h"
11#include "event.h"
12
13// FORWARD DECLARATION
14class Material;
15class Signal; //!< @todo create this!!
16
17typedef enum
18{
19  GLGuiSignal_click     = 0,
20  GLGuiSignal_release   = 1,
21  GLGuiSignal_rollOn    = 2,
22  GLGuiSignal_rollOff   = 3,
23  GLGuiSignal_open      = 4,
24  GLGuiSignal_close     = 5,
25  GLGuiSignal_destroy   = 6,
26
27  GLGuiSignalCount      = 7,
28} GLGuiSignalType;
29
30//! if the Element should be visible by default.
31#define GLGUI_WIDGET_DEFAULT_VISIBLE       false
32
33//! This is widget part of the openglGUI class
34/**
35 * A widget is the main class of all the elements of th GUI.
36 */
37class GLGuiWidget : public Element2D {
38  public:
39    GLGuiWidget();
40    virtual ~GLGuiWidget();
41
42    void init();
43    /** @returns a new char-array containing a string with the options. Delete with delete[]; */
44    virtual char* save() {};
45    /** loads options of the Widget. @param loadString a string containing the Options */
46    virtual void load(const char* loadString) {};
47
48    void show();
49    void hide() {};
50
51    void connectSignal(GLGuiSignalType signalType, Signal* signal);
52    void disconnectSignal(GLGuiSignalType signalType);
53    bool focusOverWidget(float x, float y);
54
55    // if something was clickt on the GUI-widget.
56    virtual void click(const Event& event) {};
57    virtual void release(const Event& event) {};
58
59    virtual void receiveFocus() {};
60    virtual void removeFocus() {};
61
62    virtual void update() = 0;
63    virtual void draw() const = 0;
64
65  protected:
66    Material*             backMat;
67    GLuint                backModel;
68
69    Material*             frontMat;
70    GLuint                frontModel;
71
72  private:
73    Signal*               widgetSignals[GLGuiSignalCount];
74
75    bool                  focusable;        //!< If this widget can receive focus.
76    bool                  clickable;        //!< if this widget can be clicked upon.
77};
78
79#endif /* _GLGUI_WIDGET_H */
Note: See TracBrowser for help on using the repository browser.