diff options
author | Vojtech Kral <vojtech@kral.hk> | 2018-10-03 15:07:10 +0300 |
---|---|---|
committer | Vojtech Kral <vojtech@kral.hk> | 2018-10-03 15:07:10 +0300 |
commit | 83f55b608c49993ee3279f5b598748a36b04d979 (patch) | |
tree | 96b24a1bbe1bf44b4241135085601ee7f0ed58ab /src/slic3r/GUI/Event.hpp | |
parent | 770d944283cda7c90ea7aa614be824aaa3de3519 (diff) |
Event.hpp: Set event object
Diffstat (limited to 'src/slic3r/GUI/Event.hpp')
-rw-r--r-- | src/slic3r/GUI/Event.hpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/slic3r/GUI/Event.hpp b/src/slic3r/GUI/Event.hpp index ffcad7f9f..63800fa00 100644 --- a/src/slic3r/GUI/Event.hpp +++ b/src/slic3r/GUI/Event.hpp @@ -1,6 +1,7 @@ #ifndef slic3r_Events_hpp_ #define slic3r_Events_hpp_ + #include <wx/event.h> @@ -11,11 +12,14 @@ namespace GUI { struct SimpleEvent : public wxEvent { - SimpleEvent(wxEventType type, int id = 0) : wxEvent(id, type) {} + SimpleEvent(wxEventType type, wxObject* origin = nullptr) : wxEvent(0, type) + { + SetEventObject(origin); + } virtual wxEvent* Clone() const { - return new SimpleEvent(GetEventType(), GetId()); + return new SimpleEvent(GetEventType(), GetEventObject()); } }; @@ -23,26 +27,30 @@ template<class T, size_t N> struct ArrayEvent : public wxEvent { std::array<T, N> data; - ArrayEvent(wxEventType type, std::array<T, N> data, int id = 0) - : wxEvent(id, type), data(std::move(data)) - {} + ArrayEvent(wxEventType type, std::array<T, N> data, wxObject* origin = nullptr) + : wxEvent(0, type), data(std::move(data)) + { + SetEventObject(origin); + } virtual wxEvent* Clone() const { - return new ArrayEvent<T, N>(GetEventType(), data, GetId()); + return new ArrayEvent<T, N>(GetEventType(), data, GetEventObject()); } }; template<class T> struct ArrayEvent<T, 1> : public wxEvent { T data; - ArrayEvent(wxEventType type, T data, int id = 0) - : wxEvent(id, type), data(std::move(data)) - {} + ArrayEvent(wxEventType type, T data, wxObject* origin = nullptr) + : wxEvent(0, type), data(std::move(data)) + { + SetEventObject(origin); + } virtual wxEvent* Clone() const { - return new ArrayEvent<T, 1>(GetEventType(), data, GetId()); + return new ArrayEvent<T, 1>(GetEventType(), data, GetEventObject()); } }; |