mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 19:33:47 +00:00
Fix switch button color
This commit is contained in:
@@ -38,22 +38,26 @@ void SwitchButton::SetLabels(wxString const& lbl_on, wxString const& lbl_off)
|
|||||||
|
|
||||||
void SwitchButton::SetTextColor(StateColor const& color)
|
void SwitchButton::SetTextColor(StateColor const& color)
|
||||||
{
|
{
|
||||||
text_color = color;
|
text_color = color;
|
||||||
|
Rescale();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwitchButton::SetTextColor2(StateColor const &color)
|
void SwitchButton::SetTextColor2(StateColor const &color)
|
||||||
{
|
{
|
||||||
text_color2 = color;
|
text_color2 = color;
|
||||||
|
Rescale();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwitchButton::SetTrackColor(StateColor const& color)
|
void SwitchButton::SetTrackColor(StateColor const& color)
|
||||||
{
|
{
|
||||||
track_color = color;
|
track_color = color;
|
||||||
|
Rescale();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwitchButton::SetThumbColor(StateColor const& color)
|
void SwitchButton::SetThumbColor(StateColor const& color)
|
||||||
{
|
{
|
||||||
thumb_color = color;
|
thumb_color = color;
|
||||||
|
Rescale();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwitchButton::SetValue(bool value)
|
void SwitchButton::SetValue(bool value)
|
||||||
@@ -63,6 +67,16 @@ void SwitchButton::SetValue(bool value)
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SwitchButton::SetBackgroundColour(const wxColour& colour)
|
||||||
|
{
|
||||||
|
if (wxBitmapToggleButton::SetBackgroundColour(colour)) {
|
||||||
|
Rescale();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void SwitchButton::Rescale()
|
void SwitchButton::Rescale()
|
||||||
{
|
{
|
||||||
if (labels[0].IsEmpty()) {
|
if (labels[0].IsEmpty()) {
|
||||||
@@ -70,7 +84,7 @@ void SwitchButton::Rescale()
|
|||||||
m_off.msw_rescale();
|
m_off.msw_rescale();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SetBackgroundColour(StaticBox::GetParentBackgroundColor(GetParent()));
|
wxBitmapToggleButton::SetBackgroundColour(StaticBox::GetParentBackgroundColor(GetParent()));
|
||||||
#ifdef __WXOSX__
|
#ifdef __WXOSX__
|
||||||
auto scale = Slic3r::GUI::mac_max_scaling_factor();
|
auto scale = Slic3r::GUI::mac_max_scaling_factor();
|
||||||
int BS = (int) scale;
|
int BS = (int) scale;
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ public:
|
|||||||
|
|
||||||
void Rescale();
|
void Rescale();
|
||||||
|
|
||||||
|
bool SetBackgroundColour(const wxColour& colour) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user