53 #if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT) 54 #error "Only <final/final.h> can be included directly." 60 #include "final/fwidget.h" 61 #include "final/widget/fwindow.h" 77 using FWidget::delAccelerator;
99 auto getClassName()
const ->
FString override;
100 virtual auto getKey()
const noexcept -> FKey;
101 virtual auto getText()
const ->
FString;
104 void setKey (FKey) noexcept;
107 void unsetActive() noexcept;
108 void setMouseFocus (
bool =
true);
109 void unsetMouseFocus();
112 auto isActivated()
const noexcept -> bool;
113 auto hasMouseFocus()
const noexcept -> bool;
121 void processActivate()
const;
122 auto getConnectedStatusbar()
const ->
FStatusBar*;
130 bool mouse_focus{
false};
139 inline auto FStatusKey::getClassName()
const ->
FString 140 {
return "FStatusKey"; }
143 inline auto FStatusKey::getKey()
const noexcept -> FKey
147 inline auto FStatusKey::getText()
const ->
FString 151 inline void FStatusKey::setKey (FKey k) noexcept
155 inline void FStatusKey::setText (
const FString& txt)
156 { text.setString(txt); }
159 inline void FStatusKey::unsetActive() noexcept
163 inline void FStatusKey::unsetMouseFocus()
164 { setMouseFocus(
false); }
167 inline auto FStatusKey::isActivated()
const noexcept ->
bool 171 inline auto FStatusKey::hasMouseFocus()
const noexcept ->
bool 172 {
return mouse_focus; }
175 inline auto FStatusKey::getConnectedStatusbar()
const ->
FStatusBar*
179 inline void FStatusKey::setConnectedStatusbar (
FStatusBar* sb)
191 using FWidget::delAccelerator;
200 auto getClassName()
const ->
FString override;
202 auto getMessage()
const ->
FString;
203 auto getCount()
const -> std::size_t;
206 void activateKey (
int);
207 void deactivateKey (
int);
208 void setMessage (
const FString&);
209 void resetColors()
override;
212 auto isActivated (
int)
const -> bool;
213 auto hasActivatedKey()
const -> bool;
216 void hide()
override;
223 void adjustSize()
override;
231 void cb_statuskey_activated (
const FStatusKey*);
235 using FKeyList = std::vector<FStatusKey*>;
239 auto getKeyNameWidth (
const FStatusKey*)
const -> int;
240 auto getKeyTextWidth (
const FStatusKey*)
const -> int;
241 void draw()
override;
243 void drawKey (FKeyList::const_iterator);
244 void drawKeySeparator (FKeyList::const_iterator);
245 void drawActiveKey (FKeyList::const_iterator);
246 void drawHotKeyName (FKeyList::const_iterator,
const FColorPair);
247 auto canPrintLeftActiveKeySeparator (FKeyList::const_iterator)
const -> bool;
248 auto canPrintKeySeparator (FKeyList::const_iterator)
const -> bool;
249 auto canDrawMessage()
const -> bool;
250 auto isLastActiveFocus()
const -> bool;
251 auto isClickInsideRange (
const FMouseEvent*,
const int,
const int)
const -> bool;
252 void setStatusBarColor()
const;
253 void nonLeftButtonClick();
255 void printMessageWithEllipsis (std::size_t);
256 void printPaddingSpaces (
int);
261 std::size_t screenWidth{80};
271 inline auto FStatusBar::getClassName()
const ->
FString 272 {
return "FStatusBar"; }
275 inline auto FStatusBar::getStatusKey (
int index)
const ->
FStatusKey*
276 {
return key_list[uInt(index - 1)]; }
279 inline auto FStatusBar::getCount()
const -> std::size_t
280 {
return key_list.size(); }
283 inline void FStatusBar::activateKey (
int index)
284 { key_list[uInt(index - 1)]->setActive(); }
287 inline void FStatusBar::deactivateKey (
int index)
288 { key_list[uInt(index - 1)]->unsetActive(); }
291 inline auto FStatusBar::isActivated(
int index)
const ->
bool 292 {
return key_list[uInt(index - 1)]->isActivated(); }
295 inline auto FStatusBar::getMessage()
const ->
FString 299 inline void FStatusBar::clearMessage()
304 #endif // FSTATUSBAR_H
Definition: fstatusbar.h:187
Definition: class_template.cpp:25
Definition: fstatusbar.h:73
Definition: fcolorpair.h:49