mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-01-31 21:30:51 -07:00
* A *lot* of import fixes for flatpak Aside, thank you @hadess for the majority of these fixes. You are the base point for a lot of issues fixed during the creation of this flatpak. * Use slic3r::load_string_file Boost 1.84 removed `boost::fs::load_string_file` so use the func located in Utils.hpp
64 lines
1.3 KiB
C++
64 lines
1.3 KiB
C++
#ifndef slic3r_GUI_StateHandler_hpp_
|
|
#define slic3r_GUI_StateHandler_hpp_
|
|
|
|
#include <memory>
|
|
#include <wx/event.h>
|
|
|
|
#include "StateColor.hpp"
|
|
|
|
wxDECLARE_EVENT(EVT_ENABLE_CHANGED, wxCommandEvent);
|
|
|
|
class StateHandler : public wxEvtHandler
|
|
{
|
|
public:
|
|
enum State {
|
|
Enabled = 1,
|
|
Checked = 2,
|
|
Focused = 4,
|
|
Hovered = 8,
|
|
Pressed = 16,
|
|
Disabled = 1 << 16,
|
|
NotChecked = 2 << 16,
|
|
NotFocused = 4 << 16,
|
|
NotHovered = 8 << 16,
|
|
NotPressed = 16 << 16,
|
|
};
|
|
|
|
public:
|
|
StateHandler(wxWindow * owner);
|
|
|
|
~StateHandler();
|
|
|
|
public:
|
|
void attach(StateColor const & color);
|
|
|
|
void attach(std::vector<StateColor const *> const & colors);
|
|
|
|
void attach_child(wxWindow *child);
|
|
|
|
void remove_child(wxWindow *child);
|
|
|
|
void update_binds();
|
|
|
|
int states() const { return states_ | states2_; }
|
|
|
|
void set_state(int state, int mask);
|
|
|
|
private:
|
|
StateHandler(StateHandler * parent, wxWindow *owner);
|
|
|
|
void changed(wxEvent &event);
|
|
|
|
void changed(int state2);
|
|
|
|
private:
|
|
wxWindow * owner_;
|
|
std::vector<StateColor const *> colors_;
|
|
int bind_states_ = 0;
|
|
int states_ = 0;
|
|
int states2_ = 0; // from children
|
|
std::vector<std::unique_ptr<StateHandler>> children_;
|
|
StateHandler * parent_ = nullptr;
|
|
};
|
|
|
|
#endif // !slic3r_GUI_StateHandler_hpp_
|