Files
OrcaSlicer-KX/src/slic3r/GUI/Widgets/SwitchButton.hpp
tao wang f2598e0265 NEW:support multiple extruder new control
jira:[device page]

Change-Id: Idf68a3385172cbaa123cedb4e2b814c15cc09f07
(cherry picked from commit 7700b911a6fec782ce6b484b9b030963283a846c)
2025-08-26 20:12:40 +08:00

71 lines
1.6 KiB
C++

#ifndef slic3r_GUI_SwitchButton_hpp_
#define slic3r_GUI_SwitchButton_hpp_
#include "../wxExtensions.hpp"
#include "StateColor.hpp"
#include <wx/tglbtn.h>
#include "Label.hpp"
#include "Button.hpp"
wxDECLARE_EVENT(wxCUSTOMEVT_SELECT_NOZZLE_POS, wxCommandEvent);
class SwitchButton : public wxBitmapToggleButton
{
public:
SwitchButton(wxWindow * parent = NULL, wxWindowID id = wxID_ANY);
public:
void SetLabels(wxString const & lbl_on, wxString const & lbl_off);
void SetTextColor(StateColor const &color);
void SetTextColor2(StateColor const &color);
void SetTrackColor(StateColor const &color);
void SetThumbColor(StateColor const &color);
void SetValue(bool value) override;
void Rescale();
private:
void update();
private:
ScalableBitmap m_on;
ScalableBitmap m_off;
wxString labels[2];
StateColor text_color;
StateColor text_color2;
StateColor track_color;
StateColor thumb_color;
};
class SwitchBoard : public wxWindow
{
public:
SwitchBoard(wxWindow *parent = NULL, wxString leftL = "", wxString right = "", wxSize size = wxDefaultSize);
wxString leftLabel;
wxString rightLabel;
void updateState(wxString target);
bool switch_left{false};
bool switch_right{false};
bool is_enable {true};
public:
void paintEvent(wxPaintEvent &evt);
void render(wxDC &dc);
void doRender(wxDC &dc);
void on_left_down(wxMouseEvent &evt);
void Enable(){is_enable = true;Refresh();};
void Disable(){is_enable = false;Refresh();};
bool IsEnabled(){return is_enable;};
};
#endif // !slic3r_GUI_SwitchButton_hpp_