Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/std/src/lib/gui/gl_gui/glgui_widget.h @ 7218

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

orxonox/std:: more strings

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