mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-27 04:42:33 +00:00
Add the full source of BambuStudio
using version 1.0.10
This commit is contained in:
58
src/slic3r/GUI/Widgets/ImageSwitchButton.hpp
Normal file
58
src/slic3r/GUI/Widgets/ImageSwitchButton.hpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#ifndef slic3r_GUI_ImageSwitchButton_hpp_
|
||||
#define slic3r_GUI_ImageSwitchButton_hpp_
|
||||
|
||||
#include "../wxExtensions.hpp"
|
||||
#include "StateColor.hpp"
|
||||
#include "StateHandler.hpp"
|
||||
#include "Button.hpp"
|
||||
|
||||
|
||||
#include <wx/tglbtn.h>
|
||||
|
||||
class ImageSwitchButton : public StaticBox
|
||||
{
|
||||
public:
|
||||
ImageSwitchButton(wxWindow *parent, wxBitmap &img_on, wxBitmap &img_off, long style = 0);
|
||||
|
||||
void SetLabels(wxString const & lbl_on, wxString const & lbl_off);
|
||||
void SetImages(wxBitmap &img_on, wxBitmap &img_off);
|
||||
void SetTextColor(StateColor const &color);
|
||||
void SetBorderColor(StateColor const &color);
|
||||
void SetBgColor(StateColor const &color);
|
||||
void SetValue(bool value);
|
||||
void SetPadding(int padding);
|
||||
|
||||
bool GetValue() { return m_on_off; }
|
||||
void Rescale();
|
||||
|
||||
private:
|
||||
void messureSize();
|
||||
void paintEvent(wxPaintEvent &evt);
|
||||
void render(wxDC& dc);
|
||||
void mouseDown(wxMouseEvent &event);
|
||||
void mouseReleased(wxMouseEvent &event);
|
||||
void mouseEnterWindow(wxMouseEvent &event);
|
||||
void mouseLeaveWindow(wxMouseEvent &event);
|
||||
void sendButtonEvent();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
private:
|
||||
wxBitmap m_on;
|
||||
wxBitmap m_off;
|
||||
bool m_on_off;
|
||||
int m_padding; // size between icon and text
|
||||
bool pressedDown = false;
|
||||
bool hover = false;
|
||||
|
||||
wxSize textSize;
|
||||
wxSize minSize;
|
||||
|
||||
wxString labels[2];
|
||||
StateColor text_color;
|
||||
StateColor bg_color;
|
||||
StateColor border_color;
|
||||
StateHandler state_handler;
|
||||
};
|
||||
|
||||
#endif // !slic3r_GUI_SwitchButton_hpp_
|
||||
Reference in New Issue
Block a user