50 #if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT) 51 #error "Only <final/final.h> can be included directly." 54 #include "final/fwidget.h" 72 using FWidget::addAccelerator;
73 using FWidget::delAccelerator;
74 using FWidget::setEnable;
96 auto getClassName()
const ->
FString override;
97 auto getHotkey()
const noexcept -> FKey;
98 auto getMenu()
const ->
FMenu*;
99 auto getTextLength()
const noexcept -> std::size_t;
100 auto getTextWidth()
const noexcept -> std::size_t;
101 auto getText()
const ->
FString;
104 void setEnable (
bool =
true)
override;
106 void unsetSelected();
108 void unsetSeparator();
109 void setCheckable() noexcept;
110 void unsetCheckable() noexcept;
111 void setChecked() noexcept;
112 void unsetChecked() noexcept;
113 void setRadioButton() noexcept;
114 void unsetRadioButton() noexcept;
115 void setMenu (
FMenu*);
119 auto isSelected()
const -> bool;
120 auto isSeparator()
const -> bool;
121 auto isCheckable()
const -> bool;
122 auto isChecked()
const -> bool;
123 auto isRadioButton()
const -> bool;
124 auto hasHotkey()
const -> bool;
125 auto hasMenu()
const -> bool;
128 void addAccelerator (FKey,
FWidget*) &
final;
129 void delAccelerator (
FWidget*) &
final;
130 void openMenu()
const;
144 auto getSuperMenu()
const ->
FWidget*;
150 auto isDialog (
const FWidget*)
const -> bool;
151 auto isMenuBar (
const FWidget*)
const -> bool;
152 auto isMenu (
const FWidget*)
const -> bool;
155 void initLayout()
override;
163 void calculateTextDimensions();
164 void updateSuperMenuDimensions();
165 void updateMenubarDimensions()
const;
166 void processEnable()
const;
167 void processDisable()
const;
168 void processActivate()
const;
169 void processDeactivate()
const;
170 void createDialogList (
FMenu*)
const;
171 template <
typename T>
172 void passMouseEvent (T,
const FMouseEvent*, Event)
const;
173 void resetSelectedItem (
const FMenuList*)
const;
176 void cb_switchToDialog (
FDialog*)
const;
177 void cb_destroyDialog (
FDialog*);
179 virtual void processClicked();
183 FMenu* menu{
nullptr};
185 FDialog* associated_window{
nullptr};
186 std::size_t text_length{0};
187 std::size_t text_width{0};
188 FKey accel_key{FKey::None};
189 FKey hotkey{FKey::None};
190 bool selected{
false};
191 bool separator{
false};
192 bool checkable{
false};
194 bool radio_button{
false};
195 bool dialog_index{
false};
207 inline auto FMenuItem::getClassName()
const ->
FString 208 {
return "FMenuItem"; }
211 inline auto FMenuItem::getHotkey()
const noexcept -> FKey
215 inline auto FMenuItem::getMenu()
const ->
FMenu*
219 inline auto FMenuItem::getTextLength()
const noexcept -> std::size_t
220 {
return text_length; }
223 inline auto FMenuItem::getTextWidth()
const noexcept -> std::size_t
224 {
return text_width; }
227 inline auto FMenuItem::getText()
const ->
FString 231 inline void FMenuItem::setSeparator()
238 inline void FMenuItem::unsetSeparator()
245 inline void FMenuItem::setCheckable() noexcept
246 { checkable =
true; }
249 inline void FMenuItem::unsetCheckable() noexcept
250 { checkable =
false; }
253 inline void FMenuItem::setChecked() noexcept
257 inline void FMenuItem::unsetChecked() noexcept
261 inline void FMenuItem::setRadioButton() noexcept
262 { radio_button =
true; }
265 inline void FMenuItem::unsetRadioButton() noexcept
266 { radio_button =
false; }
269 inline void FMenuItem::setMenu(
FMenu* m)
273 inline auto FMenuItem::isSelected()
const ->
bool 277 inline auto FMenuItem::isSeparator()
const ->
bool 278 {
return separator; }
281 inline auto FMenuItem::isCheckable()
const ->
bool 282 {
return checkable; }
285 inline auto FMenuItem::isChecked()
const ->
bool 289 inline auto FMenuItem::isRadioButton()
const ->
bool 290 {
return radio_button; }
293 inline auto FMenuItem::hasHotkey()
const ->
bool 294 {
return hotkey != FKey::None; }
297 inline auto FMenuItem::hasMenu()
const ->
bool 298 {
return menu !=
nullptr; }
301 inline auto FMenuItem::getSuperMenu()
const ->
FWidget*
302 {
return super_menu; }
305 inline void FMenuItem::setSuperMenu (
FWidget* smenu)
306 { super_menu = smenu; }
310 #endif // FMENUITEM_H
Definition: class_template.cpp:25