Files
OrcaSlicer/src/slic3r/GUI/Widgets/RadioBox.cpp
milk f63cdc30e4 FIX:change interface for send
jira:[none]

Change-Id: Ia59bb1bb606399541aa191991ff0fb3f106d75d1
(cherry picked from commit b22af6cfe0a589ae5fa2e95a01ebe47f6742ee99)
2025-10-28 15:30:02 +08:00

55 lines
1.1 KiB
C++

#include "RadioBox.hpp"
#include "../wxExtensions.hpp"
namespace Slic3r {
namespace GUI {
RadioBox::RadioBox(wxWindow *parent)
: wxBitmapToggleButton(parent, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE)
, m_on(this, "radio_on", 18)
, m_off(this, "radio_off", 18)
, m_ban(this, "radio_ban", 18)
{
// SetBackgroundStyle(wxBG_STYLE_TRANSPARENT);
if (parent) SetBackgroundColour(parent->GetBackgroundColour());
// Bind(wxEVT_TOGGLEBUTTON, [this](auto& e) { update(); e.Skip(); });
SetSize(m_on.GetBmpSize());
SetMinSize(m_on.GetBmpSize());
update();
}
void RadioBox::SetValue(bool value)
{
wxBitmapToggleButton::SetValue(value);
update();
}
bool RadioBox::GetValue()
{
return wxBitmapToggleButton::GetValue();
}
void RadioBox::Rescale()
{
m_on.msw_rescale();
m_off.msw_rescale();
SetSize(m_on.GetBmpSize());
update();
}
void RadioBox::update() {
if (IsEnabled())
{
SetBitmap((GetValue() ? m_on : m_off).bmp());
} else
{
SetBitmap(m_ban.bmp());
}
}
}
}