Files
OrcaSlicer/src/slic3r/GUI/Widgets/RadioGroup.hpp
yw4z 8fff1caa39 Class for RadioGroup & LabeledStaticBox and improvements for Calibration Dialogs, Windows with wxStaticBoxSizer (#9797)
* update

* Update calib_dlg.cpp

* Update LabeledStaticBox.hpp

* Update calib_dlg.cpp

* update

* update

* RadioGroup fix

* update

* update

* update

* update

* RadioGroup

* Fix render issue when position is set to default (-1)

* Fix macOS render issue by removing default NSBox border

* Fix compile

---------

Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
2025-06-12 20:15:02 +08:00

64 lines
1.3 KiB
C++

#ifndef slic3r_GUI_RADIOGROUP_hpp_
#define slic3r_GUI_RADIOGROUP_hpp_
#include "../wxExtensions.hpp"
#include <wx/wx.h>
#include <wx/dcclient.h>
#include <wx/dcgraph.h>
#include <vector>
#include <string>
class RadioGroup : public wxPanel
{
public:
RadioGroup();
RadioGroup(
wxWindow* parent,
const std::vector<wxString>& labels = {"1", "2", "3"},
long direction = wxHORIZONTAL,
int row_col_limit = -1
);
void Create(
wxWindow* parent,
const std::vector<wxString>& labels = {"1", "2", "3"},
long direction = wxHORIZONTAL,
int row_col_limit = -1
);
int GetSelection();
void SetSelection(int index);
void SelectNext(bool focus = true);
void SelectPrevious(bool focus = true);
private:
std::vector<wxString> m_labels;
std::vector<wxStaticBitmap*> m_radioButtons;
std::vector<wxStaticText*> m_labelButtons;
int m_selectedIndex;
bool m_focused;
ScalableBitmap m_on;
ScalableBitmap m_off;
ScalableBitmap m_on_hover;
ScalableBitmap m_off_hover;
ScalableBitmap m_disabled;
void OnClick(int i);
void UpdateFocus(bool focus);
void SetRadioIcon(int i, bool hover);
void OnKeyDown(wxKeyEvent& e);
};
#endif // !slic3r_GUI_RADIOGROUP_hpp_