5 #ifndef __coptionmenu__ 6 #define __coptionmenu__ 8 #include "cparamdisplay.h" 9 #include "../cstring.h" 42 virtual void setVirtualKey (int32_t virtualKeyCode, int32_t keyModifiers = 0);
66 ~
CMenuItem () noexcept override = default;
73 int32_t keyModifiers {0};
74 int32_t virtualKeyCode {0};
97 void setCommandCategory (
const UTF8String& category);
98 const UTF8String& getCommandCategory ()
const {
return commandCategory; }
99 bool isCommandCategory (
const UTF8String& category)
const;
102 const UTF8String& getCommandName ()
const {
return commandName; }
103 bool isCommandName (
const UTF8String& name)
const;
108 using ValidateCallbackFunction = std::function<void(CCommandMenuItem* item)>;
109 using SelectedCallbackFunction = std::function<void(CCommandMenuItem* item)>;
111 void setActions (SelectedCallbackFunction&& selected, ValidateCallbackFunction&& validate = [](
CCommandMenuItem*){});
120 ValidateCallbackFunction validateFunc;
121 SelectedCallbackFunction selectedFunc;
127 using CMenuItemList = std::vector<SharedPointer<CMenuItem>>;
128 using CMenuItemIterator = CMenuItemList::iterator;
129 using CConstMenuItemIterator = CMenuItemList::const_iterator;
154 virtual int32_t getCurrentIndex (
bool countSeparator =
false)
const;
157 virtual bool setCurrent (int32_t index,
bool countSeparator =
true);
161 virtual bool checkEntry (int32_t index,
bool state);
178 CMenuItemList* getItems ()
const {
return menuItems; }
182 void setValue (
float val)
override;
183 void setMin (
float val)
override {}
184 float getMin ()
const override {
return 0; }
185 void setMax (
float val)
override {}
186 float getMax ()
const override {
return (
float)(menuItems->size () - 1); }
188 void draw (CDrawContext* pContext)
override;
189 CMouseEventResult
onMouseDown (CPoint& where,
const CButtonState& buttons)
override;
195 static IdStringPtr kMsgBeforePopup;
197 CLASS_METHODS(COptionMenu, CParamDisplay)
202 CMenuItemList* menuItems;
204 bool inPopup {
false};
205 int32_t currentIndex {-1};
206 CButtonState lastButton {0};
207 int32_t nbItemsPerColumn {-1};
208 int32_t lastResult {-1};
209 int32_t prefixNumbers {0};
210 SharedPointer<CBitmap> bgWhenClick;
211 COptionMenu* lastMenu {
nullptr};
Rect structure.
Definition: crect.h:17
static IdStringPtr kMsgMenuItemValidate
message send to the target before the item is shown
Definition: coptionmenu.h:117
Definition: xmlparse.c:181
Definition: vstkeycode.h:12
Definition: vstguibase.h:299
a command menu item
Definition: coptionmenu.h:83
static IdStringPtr kMsgMenuItemSelected
message send to the target when this item was selected
Definition: coptionmenu.h:118
Base Object with reference counter.
Definition: vstguibase.h:276
Encapsulates various platform depended kinds of bitmaps.
Definition: cbitmap.h:21
Definition: customcontrols.cpp:8
holds an UTF8 encoded string and a platform representation of it
Definition: cstring.h:56
Point structure.
Definition: cpoint.h:17
a parameter display
Definition: cparamdisplay.h:24
The CFrame is the parent container of all views.
Definition: cframe.h:32
Definition: icontrollistener.h:14