OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
CheckBox Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Widgets/CheckBox.hpp>

Inheritance diagram for CheckBox:
Collaboration diagram for CheckBox:

Public Member Functions

 CheckBox (wxWindow *parent, int id=wxID_ANY)
void SetValue (bool value) override
void SetHalfChecked (bool value=true)
bool IsHalfChecked () const
void Rescale ()

Private Member Functions

void update ()

Private Attributes

ScalableBitmap m_on
ScalableBitmap m_half
ScalableBitmap m_off
ScalableBitmap m_on_disabled
ScalableBitmap m_half_disabled
ScalableBitmap m_off_disabled
ScalableBitmap m_on_focused
ScalableBitmap m_half_focused
ScalableBitmap m_off_focused
bool m_half_checked = false

Detailed Description

Constructor & Destructor Documentation

◆ CheckBox()

CheckBox::CheckBox ( wxWindow * parent,
int id = wxID_ANY )
14 : wxBitmapToggleButton(parent, id, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE)
15 , m_on(this, "check_on", 18)
16 , m_half(this, "check_half", 18)
17 , m_off(this, "check_off", 18)
18 , m_on_disabled(this, "check_on_disabled", 18)
19 , m_half_disabled(this, "check_half_disabled", 18)
20 , m_off_disabled(this, "check_off_disabled", 18)
21 , m_on_focused(this, "check_on_focused", 18)
22 , m_half_focused(this, "check_half_focused", 18)
23 , m_off_focused(this, "check_off_focused", 18)
24{
25 //SetBackgroundStyle(wxBG_STYLE_TRANSPARENT);
26 if (parent)
27 SetBackgroundColour(parent->GetBackgroundColour());
28 Bind(wxEVT_TOGGLEBUTTON, [this](auto& e) { m_half_checked = false; update(); e.Skip(); });
29#ifdef __WXOSX__ // State not fully implement on MacOS
30 Bind(wxEVT_SET_FOCUS, &CheckBox::updateBitmap, this);
31 Bind(wxEVT_KILL_FOCUS, &CheckBox::updateBitmap, this);
32 Bind(wxEVT_ENTER_WINDOW, &CheckBox::updateBitmap, this);
33 Bind(wxEVT_LEAVE_WINDOW, &CheckBox::updateBitmap, this);
34#endif
35
36#ifdef __WXGTK__
37 Slic3r::GUI::RemoveButtonBorder(this);
38#endif
39
40 Rescale();
41}
void Rescale()
Definition CheckBox.cpp:57
void update()
Definition CheckBox.cpp:73
ScalableBitmap m_off_disabled
Definition CheckBox.hpp:53
ScalableBitmap m_on_disabled
Definition CheckBox.hpp:51
ScalableBitmap m_half
Definition CheckBox.hpp:49
ScalableBitmap m_off
Definition CheckBox.hpp:50
ScalableBitmap m_off_focused
Definition CheckBox.hpp:56
ScalableBitmap m_half_disabled
Definition CheckBox.hpp:52
ScalableBitmap m_on
Definition CheckBox.hpp:48
ScalableBitmap m_on_focused
Definition CheckBox.hpp:54
ScalableBitmap m_half_focused
Definition CheckBox.hpp:55
bool m_half_checked
Definition CheckBox.hpp:57

References m_half, m_half_checked, m_half_disabled, m_half_focused, m_off, m_off_disabled, m_off_focused, m_on, m_on_disabled, m_on_focused, Rescale(), and update().

Here is the call graph for this function:

Member Function Documentation

◆ IsHalfChecked()

bool CheckBox::IsHalfChecked ( ) const
inline
21{ return m_half_checked; }

References m_half_checked.

Referenced by CustomWidgetsPlugin::addCheckBoxProps().

Here is the caller graph for this function:

◆ Rescale()

void CheckBox::Rescale ( )
58{
59 m_on.msw_rescale();
60 m_half.msw_rescale();
61 m_off.msw_rescale();
62 m_on_disabled.msw_rescale();
63 m_half_disabled.msw_rescale();
64 m_off_disabled.msw_rescale();
65 m_on_focused.msw_rescale();
66 m_half_focused.msw_rescale();
67 m_off_focused.msw_rescale();
68 SetSize(m_on.GetBmpSize());
69 SetMinSize(m_on.GetBmpSize());
70 update();
71}

References m_half, m_half_disabled, m_half_focused, m_off, m_off_disabled, m_off_focused, m_on, m_on_disabled, m_on_focused, and update().

Referenced by CheckBox(), and Slic3r::GUI::CheckBox::msw_rescale().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetHalfChecked()

void CheckBox::SetHalfChecked ( bool value = true)
52{
53 m_half_checked = value;
54 update();
55}

References m_half_checked, and update().

Referenced by CustomWidgetsPlugin::addCheckBoxProps().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetValue()

void CheckBox::SetValue ( bool value)
override
44{
45 if (wxBitmapToggleButton::GetValue() != value) {
46 wxBitmapToggleButton::SetValue(value);
47 update();
48 }
49}

References update().

Referenced by Slic3r::GUI::create_select_filament_preset_checkbox().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update()

void CheckBox::update ( )
private
74{
75 SetBitmapLabel((m_half_checked ? m_half : GetValue() ? m_on : m_off).bmp());
76 SetBitmapDisabled((m_half_checked ? m_half_disabled : GetValue() ? m_on_disabled : m_off_disabled).bmp());
77#ifdef __WXMSW__
78 SetBitmapFocus((m_half_checked ? m_half_focused : GetValue() ? m_on_focused : m_off_focused).bmp());
79#endif
80 SetBitmapCurrent((m_half_checked ? m_half_focused : GetValue() ? m_on_focused : m_off_focused).bmp());
81#ifdef __WXOSX__
82 wxCommandEvent e(wxEVT_UPDATE_UI);
83 updateBitmap(e);
84#endif
85}

References m_half, m_half_checked, m_half_disabled, m_half_focused, m_off, m_off_disabled, m_off_focused, m_on, m_on_disabled, and m_on_focused.

Referenced by CheckBox(), Rescale(), SetHalfChecked(), and SetValue().

Here is the caller graph for this function:

Member Data Documentation

◆ m_half

ScalableBitmap CheckBox::m_half
private

Referenced by CheckBox(), Rescale(), and update().

◆ m_half_checked

bool CheckBox::m_half_checked = false
private

◆ m_half_disabled

ScalableBitmap CheckBox::m_half_disabled
private

Referenced by CheckBox(), Rescale(), and update().

◆ m_half_focused

ScalableBitmap CheckBox::m_half_focused
private

Referenced by CheckBox(), Rescale(), and update().

◆ m_off

ScalableBitmap CheckBox::m_off
private

Referenced by CheckBox(), Rescale(), and update().

◆ m_off_disabled

ScalableBitmap CheckBox::m_off_disabled
private

Referenced by CheckBox(), Rescale(), and update().

◆ m_off_focused

ScalableBitmap CheckBox::m_off_focused
private

Referenced by CheckBox(), Rescale(), and update().

◆ m_on

ScalableBitmap CheckBox::m_on
private

Referenced by CheckBox(), Rescale(), and update().

◆ m_on_disabled

ScalableBitmap CheckBox::m_on_disabled
private

Referenced by CheckBox(), Rescale(), and update().

◆ m_on_focused

ScalableBitmap CheckBox::m_on_focused
private

Referenced by CheckBox(), Rescale(), and update().


The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Widgets/CheckBox.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Widgets/CheckBox.cpp