Mercurial > foo_out_sdl
comparison foosdk/sdk/foobar2000/SDK/menu_common.h @ 1:20d02a178406 default tip
*: check in everything else
yay
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 05 Jan 2026 02:15:46 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:e9bb126753e7 | 1:20d02a178406 |
|---|---|
| 1 #pragma once | |
| 2 #include "image.h" | |
| 3 | |
| 4 class menu_flags { | |
| 5 public: | |
| 6 enum { | |
| 7 disabled = 1 << 0, | |
| 8 checked = 1 << 1, | |
| 9 radiochecked = 1 << 2, | |
| 10 defaulthidden = 1 << 3, | |
| 11 disclosure = 1 << 4, // mobile platform specific, indicates whether to show a disclosure mark next to a command | |
| 12 }; | |
| 13 }; | |
| 14 | |
| 15 //! Type referring to a combination of menu_flags::* values | |
| 16 typedef uint32_t menu_flags_t; | |
| 17 | |
| 18 typedef fb2k::image menu_glyph; | |
| 19 | |
| 20 //! \since 2.0 | |
| 21 //! Menu manager's tree item object; see mainmenu_manager and contextmenu_manager. | |
| 22 class menu_tree_item : public service_base { | |
| 23 FB2K_MAKE_SERVICE_INTERFACE(menu_tree_item, service_base); | |
| 24 public: | |
| 25 enum type_t { | |
| 26 itemSeparator = 0, | |
| 27 itemCommand, | |
| 28 itemSubmenu | |
| 29 }; | |
| 30 | |
| 31 | |
| 32 virtual type_t type() = 0; | |
| 33 virtual size_t childCount() = 0; | |
| 34 virtual menu_tree_item::ptr childAt(size_t at) = 0; | |
| 35 virtual uint32_t commandID() = 0; | |
| 36 virtual const char* name() = 0; | |
| 37 virtual menu_flags_t flags() = 0; // menu_flags::* | |
| 38 virtual void execute(service_ptr ctx) = 0; | |
| 39 virtual bool get_description(pfc::string_base& strOut) = 0; | |
| 40 //! Refreshes the item's state. Returns true if either of the following properties has changed: flags, name, glyph, description. Currently does not allow the item's children to change. | |
| 41 virtual bool refreshState() { return false; } | |
| 42 | |
| 43 //! Command GUID for registering yourself for menu refresh notifications. May be null GUID if this item has no valid command GUID. | |
| 44 virtual GUID commandGuid() { return pfc::guid_null; } | |
| 45 //! Sub-command GUID for dynamically created items. Typically null GUID as simple items do not have sub command GUIDs. | |
| 46 virtual GUID subCommandGuid() { return pfc::guid_null; } | |
| 47 | |
| 48 virtual bool get_icon(fb2k::imageLocation_t& outLoc) { (void)outLoc; return false; } | |
| 49 | |
| 50 bool isSeparator() { return type() == itemSeparator; } | |
| 51 bool isCommand() { return type() == itemCommand; } | |
| 52 bool isSubmenu() { return type() == itemSubmenu; } | |
| 53 bool isDisclosure() { return (flags() & menu_flags::disclosure) != 0; } | |
| 54 }; | |
| 55 | |
| 56 | |
| 57 typedef menu_tree_item mainmenu_tree_item; | |
| 58 | |
| 59 #define FB2K_MENU_CAPS_TITLE 1 | |
| 60 #define FB2K_MENU_CAPS_SENTENCE 2 | |
| 61 | |
| 62 #ifdef _WIN32 | |
| 63 #define FB2K_MENU_CAPS FB2K_MENU_CAPS_SENTENCE | |
| 64 #else | |
| 65 #define FB2K_MENU_CAPS FB2K_MENU_CAPS_TITLE | |
| 66 #endif |
