Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7799 was 7779, checked in by bensch, 19 years ago

3088 linews changed :): trunk: namespaces

File size: 2.1 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 "event.h"
11#include "material.h"
12
13#include "glincl.h"
14#include "signal_connector.h"
15
16// FORWARD DECLARATION
17class Material;
18
19namespace OrxGui
20{
21
22  typedef enum
23  {
24    GLGuiSignal_click     = 0,
25    GLGuiSignal_release,
26    GLGuiSignal_rollOn,
27    GLGuiSignal_rollOff,
28    GLGuiSignal_open,
29    GLGuiSignal_close,
30    GLGuiSignal_destroy,
31
32    GLGuiSignalCount,
33  } GLGuiSignalType;
34
35  //! if the Element should be visible by default.
36#define GLGUI_WIDGET_DEFAULT_VISIBLE       false
37
38  //! This is widget part of the openglGUI class
39  /**
40   * A widget is the main class of all the elements of th GUI.
41   */
42  class GLGuiWidget : public Element2D
43  {
44  private:
45
46  public:
47    GLGuiWidget();
48    virtual ~GLGuiWidget();
49
50    void show();
51    void hide();
52
53    void connectSignal(GLGuiSignalType signalType, BaseObject* obj, const Executor* signal);
54    void disconnectSignal(GLGuiSignalType signalType);
55    bool focusOverWidget(float x, float y);
56
57    // if something was clickt on the GUI-widget.
58    virtual void click(const Event& event) {};
59    virtual void release(const Event& event) {};
60
61    virtual void receiveFocus() {};
62    virtual void removeFocus() {};
63
64    virtual void update() {};
65    virtual void draw() const;
66
67    Material& backMaterial() { return this->backMat; };
68    Material& frontMaterial() { return this->frontMat; };
69
70  protected:
71    inline void startDraw() const { glPushMatrix(); glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0); };
72    inline void endDraw() const { glPopMatrix(); };
73
74  private:
75    void init();
76
77  protected:
78    Material               backMat;
79    GLuint                 backModel;
80
81    Material               frontMat;
82    GLuint                 frontModel;
83
84  private:
85    std::vector<SignalConnector*> widgetSignals;
86
87    bool                   focusable;        //!< If this widget can receive focus.
88    bool                   clickable;        //!< if this widget can be clicked upon.
89  };
90}
91#endif /* _GLGUI_WIDGET_H */
Note: See TracBrowser for help on using the repository browser.