mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-01-06 06:47:41 -07:00
Fix switch button color
This commit is contained in:
parent
e5bd736def
commit
24fe8a9fa7
2 changed files with 21 additions and 5 deletions
|
|
@ -38,22 +38,26 @@ void SwitchButton::SetLabels(wxString const& lbl_on, wxString const& lbl_off)
|
|||
|
||||
void SwitchButton::SetTextColor(StateColor const& color)
|
||||
{
|
||||
text_color = color;
|
||||
text_color = color;
|
||||
Rescale();
|
||||
}
|
||||
|
||||
void SwitchButton::SetTextColor2(StateColor const &color)
|
||||
{
|
||||
text_color2 = color;
|
||||
text_color2 = color;
|
||||
Rescale();
|
||||
}
|
||||
|
||||
void SwitchButton::SetTrackColor(StateColor const& color)
|
||||
{
|
||||
track_color = color;
|
||||
track_color = color;
|
||||
Rescale();
|
||||
}
|
||||
|
||||
void SwitchButton::SetThumbColor(StateColor const& color)
|
||||
{
|
||||
thumb_color = color;
|
||||
thumb_color = color;
|
||||
Rescale();
|
||||
}
|
||||
|
||||
void SwitchButton::SetValue(bool value)
|
||||
|
|
@ -63,6 +67,16 @@ void SwitchButton::SetValue(bool value)
|
|||
update();
|
||||
}
|
||||
|
||||
bool SwitchButton::SetBackgroundColour(const wxColour& colour)
|
||||
{
|
||||
if (wxBitmapToggleButton::SetBackgroundColour(colour)) {
|
||||
Rescale();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void SwitchButton::Rescale()
|
||||
{
|
||||
if (labels[0].IsEmpty()) {
|
||||
|
|
@ -70,7 +84,7 @@ void SwitchButton::Rescale()
|
|||
m_off.msw_rescale();
|
||||
}
|
||||
else {
|
||||
SetBackgroundColour(StaticBox::GetParentBackgroundColor(GetParent()));
|
||||
wxBitmapToggleButton::SetBackgroundColour(StaticBox::GetParentBackgroundColor(GetParent()));
|
||||
#ifdef __WXOSX__
|
||||
auto scale = Slic3r::GUI::mac_max_scaling_factor();
|
||||
int BS = (int) scale;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ public:
|
|||
|
||||
void Rescale();
|
||||
|
||||
bool SetBackgroundColour(const wxColour& colour) override;
|
||||
|
||||
private:
|
||||
void update();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue