Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7919 in orxonox.OLD for trunk/src/lib/gui/gl_gui/glgui_widget.h


Ignore:
Timestamp:
May 28, 2006, 3:48:13 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the gui branche back
merged with command:
https://svn.orxonox.net/orxonox/branches/gui
no conflicts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/gui/gl_gui/glgui_widget.h

    r7868 r7919  
    88
    99#include "element_2d.h"
    10 #include "event.h"
     10#include "rect2D.h"
     11
    1112#include "material.h"
    1213
     14#include "event.h"
     15#include "signal_connector.h"
     16
    1317#include "glincl.h"
    14 #include "signal_connector.h"
     18
     19#include <vector>
    1520
    1621// FORWARD DECLARATION
     
    1924namespace OrxGui
    2025{
    21 
    2226  typedef enum
    2327  {
     
    3438
    3539
     40  class GLGuiCursor;
     41
    3642  //! if the Element should be visible by default.
    3743#define GLGUI_WIDGET_DEFAULT_VISIBLE       false
     
    4349  class GLGuiWidget : public Element2D
    4450  {
     51
    4552  private:
    4653
     
    5259    void hide();
    5360
     61    /// INTERCONNECTIVITY
    5462    void connectSignal(SignalType signalType, BaseObject* obj, const Executor* signal);
    5563    void disconnectSignal(SignalType signalType);
    56     bool focusOverWidget(float x, float y);
    5764
     65
     66    /// FOCUS
     67    /** @brief gives focus to this widget */
     68    void giveFocus();
     69    void breakFocus();
     70    /** @returns true if the widget is focusable */
     71    bool focusable() const { return this->_focusable; };
     72    /** @param focusable sets if the Widget should be focusable */
     73    void setFocusable(bool focusable = true) { this->_focusable = focusable; };
     74    /** @returns true if the position is inside of the Widget. @param position the position to check */
     75    bool focusOverWidget(const Vector2D& position) const;
     76    /** @brief overloaded function, that returns true if the cursor is on top of the Widget */
     77    bool focusOverWidget(const OrxGui::GLGuiCursor* const cursor) const;
     78
     79    /** @returns the currently focused Widget (NULL if none is selected) */
     80    static GLGuiWidget* focused() { return GLGuiWidget::_focused; };
     81
     82
     83    /// CLICK
     84    void click();
     85    void release();
     86    bool clickable() const { return this->_clickable; };
     87    void setClickable(bool clickable = true) { this->_clickable = clickable; };
    5888
    5989    virtual void update() {};
    6090    virtual void draw() const;
    6191
     92
     93    /// MATERIAL (looks)
    6294    Material& backMaterial() { return this->backMat; };
    6395    const Material& backMaterial() const { return this->backMat; };
     
    6698    const Material& frontMaterial() const { return this->frontMat; };
    6799
     100    /** @param the Event to process. @returns true if the Event has been consumed*/
     101    virtual bool processEvent(const Event& event) { };
     102
     103
     104    DeclareSignal(testSignal, ());
     105
    68106  protected:
    69107        // if something was clickt on the GUI-widget.
    70     virtual void clicked(const Event& event) {};
    71     virtual void released(const Event& event) {};
     108    virtual void clicked();
     109    virtual void released();
     110    virtual void receivedFocus();
     111    virtual void removedFocus();
    72112
    73     virtual void receivedFocus() {};
    74     virtual void removedFocus() {};
    75 
    76     virtual void destroyed() {};
     113    virtual void destroyed();
    77114
    78115
     
    84121
    85122
     123  private:
     124    /// LOOKS
     125    Material                       backMat;
     126    Rect2D                         backRect;
     127
     128    Material                       frontMat;
     129    Rect2D                         frontRect;
    86130
    87131
    88   protected:
    89     Material               backMat;
    90     GLuint                 backModel;
     132    /// SIGNALS
     133    std::vector<SignalConnector>   widgetSignals;
    91134
    92     Material               frontMat;
    93     GLuint                 frontModel;
     135    /// EVENTS
     136    bool                           _focusable;        //!< If this widget can receive focus.
     137    bool                           _clickable;        //!< if this widget can be clicked upon.
    94138
    95   private:
    96     std::vector<SignalConnector> widgetSignals;
     139    bool                           _pushed;
    97140
    98     bool                   focusable;        //!< If this widget can receive focus.
    99     bool                   clickable;        //!< if this widget can be clicked upon.
     141    static GLGuiWidget*            _focused;
     142    static GLGuiWidget*            _inputGrabber;
    100143  };
    101144}
Note: See TracChangeset for help on using the changeset viewer.