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" 51 #include "final/fwidgetcolors.h" 64 using FWidget::delAccelerator;
77 auto getClassName()
const ->
FString override;
78 auto getText()
const ->
FString;
81 void setForegroundColor (FColor)
override;
82 void setBackgroundColor (FColor)
override;
83 void setHotkeyForegroundColor (FColor);
84 void setFocusForegroundColor (FColor);
85 void setFocusBackgroundColor (FColor);
86 void setInactiveForegroundColor (FColor);
87 void setInactiveBackgroundColor (FColor);
88 void resetColors()
override;
89 void setNoUnderline (
bool =
true);
90 void unsetNoUnderline();
91 void setEnable (
bool =
true)
override;
92 void unsetEnable()
override;
93 void setDisable()
override;
94 void setFlat (
bool =
true);
96 void setShadow (
bool =
true);
98 void setDown (
bool =
true);
100 void setClickAnimation (
bool =
true);
101 void unsetClickAnimation();
105 auto isFlat()
const -> bool;
106 auto isDown()
const noexcept -> bool;
107 auto hasShadow()
const -> bool;
108 auto hasClickAnimation()
const noexcept -> bool;
111 void hide()
override;
126 static constexpr
auto NOT_SET =
static_cast<std::size_t
>(-1);
130 void setHotkeyAccelerator();
132 auto clickAnimationIndent (
const FWidget*) -> std::size_t;
133 void clearRightMargin (
const FWidget*);
134 void drawMarginLeft();
135 void drawMarginRight();
136 void drawTopBottomBackground();
137 void printLeadingSpaces (std::size_t&);
138 void setCursorPositionOnButton();
139 void modifyStyle()
const;
140 void printButtonText (
const FString&, std::size_t&);
141 void printEllipsis();
142 void resetStyle()
const;
143 void printTrailingSpaces (std::size_t);
144 void drawButtonTextLine (
const FString&);
145 void draw()
override;
146 void initializeDrawing();
147 void finalizingDrawing()
const;
148 auto getSpaceChar()
const -> wchar_t;
149 void handleMonochronBackground()
const;
150 void drawFlatBorder();
152 void updateButtonColor();
153 void processClick()
const;
157 bool button_down{
false};
158 bool active_focus{
false};
159 bool click_animation{
true};
161 wchar_t space_char{L
' '};
162 FColor button_fg{FColor::Default};
163 FColor button_bg{FColor::Default};
164 FColor button_hotkey_fg{FColor::Default};
165 FColor button_focus_fg{FColor::Default};
166 FColor button_focus_bg{FColor::Default};
167 FColor button_inactive_fg{FColor::Default};
168 FColor button_inactive_bg{FColor::Default};
169 std::size_t hotkeypos{NOT_SET};
170 std::size_t indent{0};
171 std::size_t center_offset{0};
172 std::size_t vcenter_offset{0};
173 std::size_t column_width{0};
178 inline auto FButton::getClassName()
const ->
FString 179 {
return "FButton"; }
182 inline auto FButton::getText()
const ->
FString 186 inline void FButton::unsetNoUnderline()
187 { setNoUnderline(
false); }
190 inline void FButton::unsetEnable()
191 { setEnable(
false); }
194 inline void FButton::setDisable()
195 { setEnable(
false); }
198 inline void FButton::unsetFlat()
202 inline void FButton::unsetShadow()
203 { setShadow(
false); }
206 inline void FButton::setUp()
210 inline void FButton::setClickAnimation(
bool enable)
211 { click_animation = enable; }
214 inline void FButton::unsetClickAnimation()
215 { setClickAnimation(
false); }
218 inline auto FButton::isFlat()
const ->
bool 219 {
return getFlags().feature.flat; }
222 inline auto FButton::isDown()
const noexcept ->
bool 223 {
return button_down; }
226 inline auto FButton::hasShadow()
const ->
bool 227 {
return getFlags().shadow.shadow; }
230 inline auto FButton::hasClickAnimation()
const noexcept ->
bool 231 {
return click_animation; }
Definition: class_template.cpp:25