Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7971 in orxonox.OLD for branches/gui


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

preparing for Signal-Slot algo

Location:
branches/gui/src
Files:
4 edited

Legend:

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

    r7943 r7971  
    122122    DeclareSignal(testSignal, ());
    123123
     124    static void connect(GLGuiWidget* sender, Signal& signal, BaseObject* receiver, Slot executor);
     125    void connect(Signal& signal, BaseObject* receiver, Slot executor);
    124126
     127    void disconnect(GLGuiWidget* sender, Signal& signal, BaseObject* receiver);
    125128
    126129  protected:
  • branches/gui/src/lib/gui/gl_gui/signal_connector.h

    r7919 r7971  
    1111namespace OrxGui
    1212{
     13  /**
     14   * @brief declares a new Signal.
     15   * @param SignalName the Name of the Signal.
     16   * @param params the Parameters to be taken
     17   */
     18#define DeclareSignal(SignalName, params) \
     19  public: \
     20   void signal_ ## connect ## SignalName(const SignalConnector& connector) { \
     21     SignalName ## connected.push_back(connector); \
     22   }\
     23   Signal& getSignalVector_##SignalName () { return this->SignalName ## connected; }; \
     24  private: \
     25   void  SignalName params { \
     26     for (unsigned int i = 0; i < SignalName ## connected .size(); i++) \
     27       SignalName ## connected[i] ("TEST"); \
     28   }\
     29   Signal SignalName ## connected
    1330
    14 #define DeclareSignal(name, params) \
    15   public: \
    16    void signal_ ##connect ##name(const SignalConnector& connector) { \
    17      name ## connected.push_back(connector); \
    18    }\
    19   private: \
    20    void  signal_ ## name params { \
    21      for (unsigned int i = 0; i < name ## connected . size(); i++) \
    22        name ## connected[i] ("TEST"); \
    23    }\
    24    std::vector<SignalConnector> name ## connected
     31   /**
     32    * @brief selects a Signal.
     33    * @param SignalName the Signal to be retrieved.
     34    */
     35#define SIGNAL(SignalName) \
     36    getSignalVector_##SignalName()
     37
     38#define SLOT(Class, function) \
     39    createExecutor<Class>(&Class::function)
    2540
    2641  //! A class for Conncting Signals to Objects, inside of the GUI
     
    4560    const Executor*      exec;           //!< The Executor, that will be called, on object.
    4661  };
     62
     63  typedef std::vector<SignalConnector> Signal;
     64  typedef Executor*                    Slot;
     65
    4766}
    4867#endif /* _SIGNAL_CONNECTOR_H */
  • branches/gui/src/lib/math/vector.h

    r7939 r7971  
    9696  inline void slerpTo(const Vector& toVec, float t) { *this + (toVec - *this) * t; };
    9797
     98  /** @returns a Null Vector */
     99  inline static const Vector& nullVector() { static Vector nullVector; return nullVector; }
    98100  void debug() const;
    99101
  • branches/gui/src/story_entities/simple_game_menu.cc

    r7939 r7971  
    9393  rdnpb->show();
    9494  rdnpb->setAbsCoor2D(200, 180);
    95   rdnpb->connectSignal(OrxGui::Signal_release, this, createExecutor<SimpleGameMenu>(&SimpleGameMenu::quitMenu));
     95  rdnpb->connectSignal(OrxGui::Signal_release, this, SLOT(SimpleGameMenu, quitMenu));
    9696
    9797  OrxGui::GLGuiInputLine* input = new OrxGui::GLGuiInputLine();
Note: See TracChangeset for help on using the changeset viewer.