Skip to content

Commit

Permalink
More event work.
Browse files Browse the repository at this point in the history
  • Loading branch information
billyquith committed Jul 18, 2016
1 parent 9f7a604 commit b68d1c7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions source/gwork/include/Gwork/Events.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ namespace Gwk
public:

typedef void (Handler::*EventListener)(Event::Info info);
typedef std::function<void(Handler&,Event::Info)> EventCallback;

Listener();
~Listener();
Expand All @@ -126,7 +127,8 @@ namespace Gwk

private:

void AddInternal(Event::Handler* listener, EventListener function,
void AddInternal(Event::Handler* listener,
EventListener function,
const Event::Packet& packet);

void CleanLinks();
Expand All @@ -138,7 +140,6 @@ namespace Gwk
, listener(nullptr)
{}

typedef std::function<void(Handler&,Event::Info)> EventCallback;
EventCallback callback;
Event::Handler* listener;
Event::Packet Packet;
Expand Down
2 changes: 1 addition & 1 deletion source/test/source/factory/ReflectButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ GWK_CONTROL_CONSTRUCTOR(ReflectButton)
ponder::UserObject buttonA = metaclass->construct(ponder::Args(static_cast<Controls::Base*>(this)));
assert(buttonA != ponder::UserObject::nothing);
buttonA.set("text", "Hello world!");
buttonA.get("onPress").call("add", this, &ReflectButton::onButtonA);
// buttonA.get("onPress").call("add", this, &ReflectButton::onButtonA);

// {
// Controls::Button* buttonA = new Controls::Button(this);
Expand Down
2 changes: 2 additions & 0 deletions source/util/include/Gwork/Util/ControlFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ PONDER_TYPE(Gwk::Margin)
PONDER_TYPE(Gwk::Point)
PONDER_TYPE(Gwk::Position)

PONDER_TYPE(Gwk::Event::Listener);

PONDER_TYPE(Gwk::Controls::Base)
PONDER_TYPE(Gwk::Controls::Label)
PONDER_TYPE(Gwk::Controls::LabelClickable)
Expand Down
4 changes: 2 additions & 2 deletions source/util/source/ControlFactory/ControlFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ void InitialiseControls()
.value("fill", Gwk::Position::Fill)
;

ponder::Class::declare<Event::Caller>()
.function("add", [] (Event::Handler&, Controls::Base*))
ponder::Class::declare<Gwk::Event::Listener>()
// .function("add", [] (Event::Handler&, Controls::Base*))
;

ponder::Class::declare<Controls::Base>()
Expand Down

0 comments on commit b68d1c7

Please sign in to comment.