diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6f81384a1..cf8958389 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -186,6 +186,7 @@ IF(wxWidgets_FOUND) ${GUI_LIBDIR}/GUI.cpp ${GUI_LIBDIR}/MainFrame.cpp ${GUI_LIBDIR}/Plater.cpp + ${GUI_LIBDIR}/ProgressStatusBar.cpp ${GUI_LIBDIR}/Plater/Plate2D.cpp ${GUI_LIBDIR}/Plater/PlaterObject.cpp ${GUI_LIBDIR}/Settings.cpp diff --git a/src/GUI/ProgressStatusBar.cpp b/src/GUI/ProgressStatusBar.cpp new file mode 100644 index 000000000..8684c2e35 --- /dev/null +++ b/src/GUI/ProgressStatusBar.cpp @@ -0,0 +1,10 @@ +#include "ProgressStatusBar.hpp" + +namespace Slic3r { namespace GUI { + +void ProgressStatusBar::SendStatusText(wxEvtHandler* dest, wxWindowID origin, const wxString& msg) { + wxQueueEvent(dest, new StatusTextEvent(EVT_STATUS_TEXT_POST, origin, msg)); + +} + +}} // Namespace Slic3r::GUI diff --git a/src/GUI/ProgressStatusBar.hpp b/src/GUI/ProgressStatusBar.hpp new file mode 100644 index 000000000..1b690f589 --- /dev/null +++ b/src/GUI/ProgressStatusBar.hpp @@ -0,0 +1,35 @@ +#ifndef PROGRESSSTATUSBAR_HPP +#define PROGRESSSTATUSBAR_HPP +#include +#include + +namespace Slic3r { namespace GUI { + +class StatusTextEvent : public wxEvent { +public: + StatusTextEvent(wxEventType eventType, int winid, const wxString& msg) + : wxEvent(winid, eventType), + message(msg) { } + + bool ShouldPropagate() const { return true; } // propagate this event + + /// One accessor + const wxString& GetMessage() const {return message;} + /// implement the base class pure virtual + virtual wxEvent *Clone() const { return new StatusTextEvent(*this); } + +private: + const wxString message; +}; + +wxDEFINE_EVENT(EVT_STATUS_TEXT_POST, StatusTextEvent); + +class ProgressStatusBar : public wxStatusBar { +public: + //< Post an event to owning box and let it percolate up to a window that sets the appropriate status text. + static void SendStatusText(wxEvtHandler* dest, wxWindowID origin, const wxString& msg); + ProgressStatusBar(wxWindow* parent, int id) : wxStatusBar(parent, id) { } +}; + +}} // Namespace Slic3r::GUI +#endif // PROGRESSSTATUSBAR_HPP