Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7972 in orxonox.OLD for branches/gui


Ignore:
Timestamp:
May 30, 2006, 10:29:13 AM (18 years ago)
Author:
bensch
Message:

gui: first signal is connected, althought the algorithm is not perfect yet

Location:
branches/gui/src
Files:
7 edited

Legend:

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

    r7942 r7972  
    7474    else
    7575      this->_value = value;
    76     printf("VALUE %f\n", _value);
     76    emit(valueChanged(this->_value));
    7777  }
    7878
  • branches/gui/src/lib/gui/gl_gui/glgui_slider.h

    r7942 r7972  
    4646    void stepMinus();
    4747
     48
    4849    virtual void tick(float dt);
    4950    virtual bool processEvent(const Event& event);
    5051    virtual void draw() const;
     52
     53    DeclareSignal(valueChanged, (float));
    5154
    5255  protected:
  • branches/gui/src/lib/gui/gl_gui/glgui_widget.cc

    r7943 r7972  
    171171
    172172
     173  void GLGuiWidget::connect(GLGuiWidget* sender, Signal& signal, BaseObject* receiver, Slot executor)
     174  {
     175    sender->connect(signal, receiver, executor);
     176  }
     177
     178  void GLGuiWidget::connect(Signal& signal, BaseObject* receiver, Slot executor)
     179  {
     180    signal.push_back(SignalConnector(receiver, executor));
     181  }
     182
     183
    173184  /**
    174185   * @brief connects a Signal to the Gui-Elements' Event.
  • branches/gui/src/lib/gui/gl_gui/glgui_widget.h

    r7971 r7972  
    4949  class GLGuiWidget : public Element2D
    5050  {
    51 
    52   private:
    53 
    5451  public:
    5552    GLGuiWidget(GLGuiWidget* parent = NULL);
     
    8885    void setClickable(bool clickable = true) { this->_clickable = clickable; };
    8986
     87    static void connect(GLGuiWidget* sender, Signal& signal, BaseObject* receiver, Slot executor);
     88    void connect(Signal& signal, BaseObject* receiver, Slot executor);
     89
     90    void disconnect(GLGuiWidget* sender, Signal& signal, BaseObject* receiver);
     91
    9092
    9193    /// MATERIAL (looks)
     
    118120    /** @param the Event to process. @returns true if the Event has been consumed*/
    119121    virtual bool processEvent(const Event& event) { };
    120 
    121 
    122     DeclareSignal(testSignal, ());
    123 
    124     static void connect(GLGuiWidget* sender, Signal& signal, BaseObject* receiver, Slot executor);
    125     void connect(Signal& signal, BaseObject* receiver, Slot executor);
    126 
    127     void disconnect(GLGuiWidget* sender, Signal& signal, BaseObject* receiver);
    128122
    129123  protected:
  • branches/gui/src/lib/gui/gl_gui/signal_connector.h

    r7971 r7972  
    3636    getSignalVector_##SignalName()
    3737
     38/**
     39 * @brief defines a Slot, the sink of a Signal.
     40 * @param Class the Class the Slot belongs to.
     41 * @param function the Function to Connect to.
     42 */
    3843#define SLOT(Class, function) \
    3944    createExecutor<Class>(&Class::function)
     45
     46/**
     47 * @brief emits function
     48 */
     49#define emit(function) function
    4050
    4151  //! A class for Conncting Signals to Objects, inside of the GUI
  • branches/gui/src/story_entities/simple_game_menu.cc

    r7971 r7972  
    101101
    102102  OrxGui::GLGuiSlider* slider = new OrxGui::GLGuiSlider();
     103  slider->connect(slider->SIGNAL(valueChanged), this, SLOT(SimpleGameMenu, TEST));
    103104  slider->setRange(-1, 10);
    104105  slider->setValue(slider->min());
  • branches/gui/src/story_entities/simple_game_menu.h

    r7924 r7972  
    6969    void quitMenu();
    7070
    71     void TEST() { printf("TEST\n"); }
     71    void TEST(float val) { printf("TEST %f\n", val); }
    7272
    7373  protected:
Note: See TracChangeset for help on using the changeset viewer.