Represents the base functionality for all menus. Although tool_strip_drop_down and tool_strip_drop_down_menu replace and add functionality to the menu control of previous versions, menu is retained for both backward compatibility and future use if you choose.
- Header
#include <xtd/forms/menu>
- Namespace
- xtd::forms
- Library
- xtd.forms
- Examples:
- application_enable_dark_mode.cpp, application_enable_light_mode.cpp, main_menu_create_standard_items.cpp, minesweeper.cpp, some_controls.cpp, some_system_controls.cpp, and themes.cpp.
|
| static constexpr int32 | find_handle = 0 |
| | Specifies that the find_menu_item(int32, intptr) method should search for a handle. More...
|
| |
| static constexpr int32 | find_shortcut = 1 |
| | Specifies that the find_menu_item(int32, intptr) method should search for a shortcut. More...
|
| |
|
| | object ()=default |
| | Create a new instance of the ultimate base class object. More...
|
| |
| bool | equals (const object &obj) const noexcept |
| | Determines whether the specified object is equal to the current object. More...
|
| |
| virtual size_t | get_hash_code () const noexcept |
| | Serves as a hash function for a particular type. More...
|
| |
| virtual type_object | get_type () const noexcept |
| | Gets the type of the current instance. More...
|
| |
| template<typename object_t > |
| std::unique_ptr< object_t > | memberwise_clone () const noexcept |
| | Creates a shallow copy of the current object. More...
|
| |
| virtual bool | equals (const menu &) const noexcept=0 |
| | Indicates whether the current object is equal to another object of the same type. More...
|
| |
| static bool | equals (const object &object_a, const object &object_b) noexcept |
| | Determines whether the specified object instances are considered equal. More...
|
| |
| static bool | reference_equals (const object &object_a, const object &object_b) noexcept |
| | Determines whether the specified object instances are the same instance. More...
|
| |
| | component () |
| | Initialises a new instance of the component class. More...
|
| |
| virtual bool | can_raise_events () const noexcept |
| | Gets a value indicating whether the component can raise an event. More...
|
| |
| bool | design_mode () const noexcept |
| | Gets a value that indicates whether the component is currently in design mode. More...
|
| |
◆ menu_item_collection
Represents a collection of menu_item objects.
◆ menu() [1/2]
| xtd::forms::menu::menu |
( |
| ) |
|
|
protected |
Initializes a new instance of the Menu class.
◆ menu() [2/2]
Initializes a new instance of the Menu class.
- Parameters
-
| items | An array of type MenuItem containing the objects to add to the menu. |
◆ clone_menu()
| void xtd::forms::menu::clone_menu |
( |
const menu & |
menu_src | ) |
|
|
protected |
Copies the menu that is passed as a parameter to the current menu.
- Parameters
-
| menu_src | The Menu to copy. |
◆ create_menu_handle()
| virtual intptr xtd::forms::menu::create_menu_handle |
( |
| ) |
|
|
protectedpure virtual |
◆ destroy_menu_handle()
| virtual void xtd::forms::menu::destroy_menu_handle |
( |
intptr |
handle | ) |
|
|
protectedvirtual |
◆ get_context_menu()
| std::optional<std::reference_wrapper<context_menu> > xtd::forms::menu::get_context_menu |
( |
| ) |
const |
|
noexcept |
Gets the context_menu that contains this menu.
- Returns
- The context_menu that contains this menu. The default is no value.
◆ get_main_menu()
| std::optional<std::reference_wrapper<main_menu> > xtd::forms::menu::get_main_menu |
( |
| ) |
const |
|
noexcept |
Gets the main_menu that contains this menu.
- Returns
- The main_menu that contains this menu. The default is has no value.
◆ handle()
| intptr xtd::forms::menu::handle |
( |
| ) |
const |
|
noexcept |
Gets a value representing the window handle for the menu.
- Returns
- The HMENU value of the menu.
◆ is_parent()
| virtual bool xtd::forms::menu::is_parent |
( |
| ) |
const |
|
virtualnoexcept |
Gets a value indicating whether this menu contains any menu items.
- Returns
- true if this menu contains menu_item objects; otherwise, false. The default is false.
Reimplemented in xtd::forms::menu_item.
◆ mdi_list_item()
| const menu_item& xtd::forms::menu::mdi_list_item |
( |
| ) |
const |
|
noexcept |
Gets a value indicating the menu_item that is used to display a list of multiple document interface (MDI) child forms.
- Returns
- A MenuItem that represents the menu item displaying a list of MDI child forms that are open in the application.
◆ menu_items() [1/3]
◆ menu_items() [2/3]
◆ menu_items() [3/3]
Sets a value indicating the collection of menu_item objects associated with the menu.
- Parameters
-
- Returns
- Current menu class.
◆ merge_menu()
| virtual void xtd::forms::menu::merge_menu |
( |
const menu & |
menu_src | ) |
|
|
virtual |
Merges the MenuItem objects of one menu with the current menu.
- Parameters
-
| menu_src | The menu whose menu items are merged with the menu items of the current menu. |
- Exceptions
-
| std::invalid_argument | It was attempted to merge the menu with itself. |
◆ name() [1/2]
Gets the name of the menu.
- Returns
- A string representing the name.
◆ name() [2/2]
Sets the name of the menu.
- Parameters
-
| value | A string representing the name. |
- Returns
- Current menu class.
◆ tag() [1/2]
| std::any xtd::forms::menu::tag |
( |
| ) |
const |
|
noexcept |
Gets user-defined data associated with the control.
- Returns
- An object representing the data.
◆ tag() [2/2]
Sets user-defined data associated with the control.
- Parameters
-
| value | An object representing the data. |
- Returns
- Current menu class.
◆ to_string()
Returns a string that represents the menu control.
- Returns
- A string that represents the current menu.
Reimplemented from xtd::object.
Reimplemented in xtd::forms::menu_item.
◆ find_handle
| constexpr int32 xtd::forms::menu::find_handle = 0 |
|
static |
Specifies that the find_menu_item(int32, intptr) method should search for a handle.
◆ find_shortcut
| constexpr int32 xtd::forms::menu::find_shortcut = 1 |
|
static |
Specifies that the find_menu_item(int32, intptr) method should search for a shortcut.
The documentation for this class was generated from the following file:
- xtd.forms/include/xtd/forms/menu.h