43 #ifndef FTOGGLEBUTTON_H 44 #define FTOGGLEBUTTON_H 46 #if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT) 47 #error "Only <final/final.h> can be included directly." 50 #include "final/fwidget.h" 66 using FWidget::delAccelerator;
67 using FWidget::setGeometry;
88 auto getClassName()
const ->
FString override;
92 void setSize (
const FSize&,
bool =
true)
override;
93 void setGeometry (
const FPoint&,
const FSize&,
bool =
true)
override;
94 void resetColors()
override;
95 void setNoUnderline (
bool =
true);
96 void unsetNoUnderline();
97 void setEnable (
bool =
true)
override;
98 void unsetEnable()
override;
99 void setDisable()
override;
100 void setChecked (
bool =
true);
102 virtual void setText (
const FString&);
105 auto isChecked()
const noexcept -> bool;
106 auto hasRadiobuttonFocus()
const noexcept -> bool;
109 void hide()
override;
125 void setHotkeyAccelerator();
126 void setButtonWidth (std::size_t) noexcept;
127 void setLabelOffsetPos (std::size_t) noexcept;
130 auto isRadioButton()
const -> bool;
131 auto isCheckboxButton()
const -> bool;
132 auto hasGroup()
const -> bool;
135 void draw()
override;
137 void processClick()
const;
138 void processToggle()
const;
145 static constexpr
auto NOT_SET =
static_cast<std::size_t
>(-1);
153 void drawText (
const FString&, std::size_t);
154 void performButtonAction();
155 void correctSize (
FSize&)
const;
160 std::size_t label_offset_pos{0};
161 std::size_t button_width{0};
162 bool radiobutton_focus{
false};
168 inline auto FToggleButton::getClassName()
const ->
FString 169 {
return "FToggleButton"; }
172 inline auto FToggleButton::getText() & ->
FString&
176 inline void FToggleButton::unsetNoUnderline()
177 { setNoUnderline(
false); }
180 inline void FToggleButton::unsetEnable()
181 { setEnable(
false); }
184 inline void FToggleButton::setDisable()
185 { setEnable(
false); }
188 inline void FToggleButton::unsetChecked()
189 { setChecked(
false); }
192 inline auto FToggleButton::isChecked()
const noexcept ->
bool 196 inline auto FToggleButton::hasRadiobuttonFocus()
const noexcept ->
bool 197 {
return radiobutton_focus; }
200 inline auto FToggleButton::getGroup()
const ->
FButtonGroup*
201 {
return button_group; }
204 inline void FToggleButton::setButtonWidth (std::size_t width) noexcept
205 { button_width = width; }
208 inline void FToggleButton::setLabelOffsetPos (std::size_t offset) noexcept
209 { label_offset_pos = offset; }
212 inline auto FToggleButton::hasGroup()
const ->
bool 213 {
return button_group; }
217 #endif // FTOGGLEBUTTON_H
Definition: class_template.cpp:25