mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-01 07:21:59 +08:00
Define new event to post status text messages to a status bar; meant for child items to post information to the status bar that propagate up
This commit is contained in:
parent
4d9d2c88dc
commit
434fc0aa2e
@ -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
|
||||
|
10
src/GUI/ProgressStatusBar.cpp
Normal file
10
src/GUI/ProgressStatusBar.cpp
Normal file
@ -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
|
35
src/GUI/ProgressStatusBar.hpp
Normal file
35
src/GUI/ProgressStatusBar.hpp
Normal file
@ -0,0 +1,35 @@
|
||||
#ifndef PROGRESSSTATUSBAR_HPP
|
||||
#define PROGRESSSTATUSBAR_HPP
|
||||
#include <wx/event.h>
|
||||
#include <wx/statusbr.h>
|
||||
|
||||
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
|
Loading…
x
Reference in New Issue
Block a user