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 auto hasMoreCharacter (std::size_t, std::size_t)
const -> bool;
142 void setHotkeyStyle()
const;
143 void resetHotkeyStyle()
const;
144 void printEllipsis();
145 void resetStyle()
const;
146 void printTrailingSpaces();
147 void drawButtonTextLine (
const FString&);
148 void draw()
override;
149 void initializeDrawing();
150 void finalizingDrawing()
const;
151 auto getSpaceChar()
const -> wchar_t;
152 void handleMonochronBackground()
const;
153 void drawFlatBorder();
155 void updateButtonColor();
156 void processClick()
const;
160 bool button_down{
false};
161 bool active_focus{
false};
162 bool click_animation{
true};
164 wchar_t space_char{L
' '};
165 FColor button_fg{FColor::Default};
166 FColor button_bg{FColor::Default};
167 FColor button_hotkey_fg{FColor::Default};
168 FColor button_focus_fg{FColor::Default};
169 FColor button_focus_bg{FColor::Default};
170 FColor button_inactive_fg{FColor::Default};
171 FColor button_inactive_bg{FColor::Default};
172 std::size_t hotkeypos{NOT_SET};
173 std::size_t indent{0};
174 std::size_t center_offset{0};
175 std::size_t vcenter_offset{0};
176 std::size_t column_width{0};
181 inline auto FButton::getClassName()
const ->
FString 182 {
return "FButton"; }
185 inline auto FButton::getText()
const ->
FString 189 inline void FButton::unsetNoUnderline()
190 { setNoUnderline(
false); }
193 inline void FButton::unsetEnable()
194 { setEnable(
false); }
197 inline void FButton::setDisable()
198 { setEnable(
false); }
201 inline void FButton::unsetFlat()
205 inline void FButton::unsetShadow()
206 { setShadow(
false); }
209 inline void FButton::setUp()
213 inline void FButton::setClickAnimation(
bool enable)
214 { click_animation = enable; }
217 inline void FButton::unsetClickAnimation()
218 { setClickAnimation(
false); }
221 inline auto FButton::isFlat()
const ->
bool 222 {
return getFlags().feature.flat; }
225 inline auto FButton::isDown()
const noexcept ->
bool 226 {
return button_down; }
229 inline auto FButton::hasShadow()
const ->
bool 230 {
return getFlags().shadow.shadow; }
233 inline auto FButton::hasClickAnimation()
const noexcept ->
bool 234 {
return click_animation; }
Definition: class_template.cpp:25