diff options
author | Vojtech Kral <vojtech@kral.hk> | 2018-09-17 13:15:11 +0300 |
---|---|---|
committer | Vojtech Kral <vojtech@kral.hk> | 2018-10-01 10:28:40 +0300 |
commit | 342b584399cb14d648599bd7e950ac87bff6f9b1 (patch) | |
tree | e817cf45ce56405078af9d42edf83f7f912f27cf /src/slic3r/GUI/GLToolbar.cpp | |
parent | 746d06fe3eb4604272e648645f6610f00ef277e8 (diff) |
WIP: Plater
Diffstat (limited to 'src/slic3r/GUI/GLToolbar.cpp')
-rw-r--r-- | src/slic3r/GUI/GLToolbar.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/slic3r/GUI/GLToolbar.cpp b/src/slic3r/GUI/GLToolbar.cpp index 388868b12..196dc663f 100644 --- a/src/slic3r/GUI/GLToolbar.cpp +++ b/src/slic3r/GUI/GLToolbar.cpp @@ -6,19 +6,25 @@ #include <GL/glew.h> +#include <wx/event.h> #include <wx/bitmap.h> #include <wx/dcmemory.h> #include <wx/settings.h> +#include <wx/glcanvas.h> namespace Slic3r { namespace GUI { + +wxDEFINE_EVENT(EVT_GLTOOLBAR_ADD, wxCommandEvent); +wxDEFINE_EVENT(EVT_GLTOOLBAR_DELETE, wxCommandEvent); +wxDEFINE_EVENT(EVT_GLTOOLBAR_TODO_MORE, wxCommandEvent); + GLToolbarItem::Data::Data() : name("") , tooltip("") , sprite_id(-1) , is_toggable(false) - , action_callback(nullptr) { } @@ -49,10 +55,12 @@ const std::string& GLToolbarItem::get_tooltip() const return m_data.tooltip; } -void GLToolbarItem::do_action() +void GLToolbarItem::do_action(wxEvtHandler *target) { - if (m_data.action_callback != nullptr) - m_data.action_callback->call(); + // if (m_data.action_callback != nullptr) + // m_data.action_callback->call(); + + wxPostEvent(target, wxCommandEvent(m_data.action_event)); } bool GLToolbarItem::is_enabled() const @@ -325,13 +333,13 @@ void GLToolbar::do_action(unsigned int item_id) item->set_state(GLToolbarItem::Hover); m_parent.render(); - item->do_action(); + item->do_action(m_parent.widget()); } else { item->set_state(GLToolbarItem::HoverPressed); m_parent.render(); - item->do_action(); + item->do_action(m_parent.widget()); if (item->get_state() != GLToolbarItem::Disabled) { // the item may get disabled during the action, if not, set it back to hover state |