Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7884 in orxonox.OLD for branches/gui/src/lib/gui/gl_gui


Ignore:
Timestamp:
May 27, 2006, 2:24:51 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: first Event gets dispached… but i see, that the interface is crappy… there has to be a much better solution for:

  1. Generating Signals (more variable)
  2. Bringing Variables onto the Signals
  3. Interface has to be way simpler:

at the moment the Interface looks like this:
===
OrxGui::GLGuiPushButton* rdnpb = new OrxGui::GLGuiPushButton("REALLY DO NOT PUSH ME");
rdnpb→connectSignal(OrxGui::Signal_release, this, createExecutor<SimpleGameMenu>(&SimpleGameMenu::quitMenu));
===
But it should be like the following:
OrxGui::GLGuiPushButton* pb = new OrxGui::GLGuiPushButton("Push this button, it is way better");
pb→connect(this, OrxGui::SIGNAL(released()), this, OrxGui::SLOT(quitMenu()));

man, this would be almost too much :)

Location:
branches/gui/src/lib/gui/gl_gui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/src/lib/gui/gl_gui/glgui_handler.cc

    r7883 r7884  
    9595      {
    9696        if (event.bPressed)
     97        {
    9798          GLGuiWidget::focused()->click();
     99        }
    98100        else
    99101          GLGuiWidget::focused()->release();
  • branches/gui/src/lib/gui/gl_gui/glgui_widget.cc

    r7883 r7884  
    6969
    7070
     71  /** @brief gives focus to this widget */
     72  void GLGuiWidget::giveFocus()
     73  {
     74    GLGuiWidget::_focused = this;
     75    this->receivedFocus();
     76  };
     77
     78  void GLGuiWidget::breakFocus()
     79  {
     80    GLGuiWidget::_focused = NULL;
     81    this->removedFocus();
     82  };
     83
     84
    7185  bool GLGuiWidget::focusOverWidget(const Vector2D& position) const
    7286  {
     
    7993    return this->focusOverWidget(cursor->getAbsCoor2D());
    8094  }
     95
     96  void GLGuiWidget::click()
     97  {
     98    this->widgetSignals[Signal_click]("none");
     99
     100    this->clicked();
     101  }
     102
     103  void GLGuiWidget::release()
     104  {
     105    this->widgetSignals[Signal_release]("none");
     106
     107    this->released();
     108  }
     109
    81110
    82111
  • branches/gui/src/lib/gui/gl_gui/glgui_widget.h

    r7883 r7884  
    6161    /// FOCUS
    6262    /** @brief gives focus to this widget */
    63     void giveFocus() { GLGuiWidget::_focused = this; this->receivedFocus(); };
    64     void breakFocus() { GLGuiWidget::_focused = NULL; this->removedFocus(); };
     63    void giveFocus();
     64    void breakFocus();
    6565    /** @returns true if the widget is focusable */
    6666    bool focusable() const { return this->_focusable; };
     
    7777
    7878    /// CLICK
     79    void click();
     80    void release();
    7981    bool clickable() const { return this->_clickable; };
    8082    void setClickable(bool clickable = true) { this->_clickable = clickable; };
    81     void click() { this->clicked(); };
    82     void release() { this->released(); };
    8383
    8484    virtual void update() {};
Note: See TracChangeset for help on using the changeset viewer.