mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Replace PerlCallbacks with events in GLCanvas3d et al.
This commit is contained in:
parent
e9d26d1a8e
commit
770d944283
14 changed files with 197 additions and 933 deletions
55
src/slic3r/GUI/Event.hpp
Normal file
55
src/slic3r/GUI/Event.hpp
Normal file
|
@ -0,0 +1,55 @@
|
|||
#ifndef slic3r_Events_hpp_
|
||||
#define slic3r_Events_hpp_
|
||||
|
||||
#include <wx/event.h>
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
namespace GUI {
|
||||
|
||||
|
||||
struct SimpleEvent : public wxEvent
|
||||
{
|
||||
SimpleEvent(wxEventType type, int id = 0) : wxEvent(id, type) {}
|
||||
|
||||
virtual wxEvent* Clone() const
|
||||
{
|
||||
return new SimpleEvent(GetEventType(), GetId());
|
||||
}
|
||||
};
|
||||
|
||||
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))
|
||||
{}
|
||||
|
||||
virtual wxEvent* Clone() const
|
||||
{
|
||||
return new ArrayEvent<T, N>(GetEventType(), data, GetId());
|
||||
}
|
||||
};
|
||||
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))
|
||||
{}
|
||||
|
||||
virtual wxEvent* Clone() const
|
||||
{
|
||||
return new ArrayEvent<T, 1>(GetEventType(), data, GetId());
|
||||
}
|
||||
};
|
||||
|
||||
template <class T> using Event = ArrayEvent<T, 1>;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // slic3r_Events_hpp_
|
Loading…
Add table
Add a link
Reference in a new issue