Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7862 was 7855, checked in by bensch, 18 years ago

qtgui: cleanup as patrick sugested

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    Signal_click     = 0,
25    Signal_release,
26    Signal_rollOn,
27    Signal_rollOff,
28    Signal_open,
29    Signal_close,
30    Signal_destroy,
31
32    SignalCount,
33  } SignalType;
34
35
36  //! if the Element should be visible by default.
37#define GLGUI_WIDGET_DEFAULT_VISIBLE       false
38
39  //! This is widget part of the openglGUI class
40  /**
41   * A widget is the main class of all the elements of th GUI.
42   */
43  class GLGuiWidget : public Element2D
44  {
45  private:
46
47  public:
48    GLGuiWidget();
49    virtual ~GLGuiWidget();
50
51    void show();
52    void hide();
53
54    void connectSignal(SignalType signalType, BaseObject* obj, const Executor* signal);
55    void disconnectSignal(SignalType signalType);
56    bool focusOverWidget(float x, float y);
57
58    // if something was clickt on the GUI-widget.
59    virtual void clicked(const Event& event) {};
60    virtual void released(const Event& event) {};
61
62    virtual void receivedFocus() {};
63    virtual void removedFocus() {};
64
65    virtual void destroyed() {};
66
67    virtual void update() {};
68    virtual void draw() const;
69
70    Material& backMaterial() { return this->backMat; };
71    Material& frontMaterial() { return this->frontMat; };
72
73  protected:
74    inline void startDraw() const { glPushMatrix(); glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0); };
75    inline void endDraw() const { glPopMatrix(); };
76
77  private:
78    void init();
79
80
81
82
83  protected:
84    Material               backMat;
85    GLuint                 backModel;
86
87    Material               frontMat;
88    GLuint                 frontModel;
89
90  private:
91    std::vector<SignalConnector> widgetSignals;
92
93    bool                   focusable;        //!< If this widget can receive focus.
94    bool                   clickable;        //!< if this widget can be clicked upon.
95  };
96}
97#endif /* _GLGUI_WIDGET_H */
Note: See TracBrowser for help on using the repository browser.