#include <menu.h>
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.
- Namespace
- xtd::forms
- Library
- xtd.forms
- Examples
- main_menu.cpp, and main_menu_create_standard_items.cpp.
Inherits xtd::forms::component.
Inherited by xtd::forms::context_menu, xtd::forms::main_menu, and xtd::forms::menu_item.
|
static constexpr const int | find_handle |
| Specifies that the find_menu_item(int32_t, intptr_t) method should search for a handle.
|
|
static constexpr const int | find_shortcut |
| Specifies that the find_menu_item(int32_t, intptr_t) method should search for a shortcut.
|
|
|
std::optional< context_menu > | get_context_menu () const |
| Gets the context_menu that contains this menu.
|
|
std::optional< main_menu > | get_main_menu () const |
| Gets the main_menu that contains this menu.
|
|
intptr_t | handle () const |
| Gets a value representing the window handle for the menu.
|
|
bool | is_parent () const |
| Gets a value indicating whether this menu contains any menu items.
|
|
const menu_item & | mdi_list_item () const |
| Gets a value indicating the menu_item that is used to display a list of multiple document interface (MDI) child forms.
|
|
menu_item_collection & | menu_items () |
| Gets a value indicating the collection of menu_item objects associated with the menu.
|
|
const menu_item_collection & | menu_items () const |
| Gets a value indicating the collection of menu_item objects associated with the menu.
|
|
menu & | menu_items (const menu_item_collection &value) |
| Sets a value indicating the collection of menu_item objects associated with the menu.
|
|
virtual void | merge_menu (const menu &menu_src) |
| Merges the MenuItem objects of one menu with the current menu.
|
|
const xtd::ustring & | name () const |
| Gets the name of the menu.
|
|
menu & | name (const xtd::ustring &value) |
| Sets the name of the menu.
|
|
std::any | tag () const |
| Gets user-defined data associated with the control.
|
|
menu & | tag (std::any value) |
| Sets user-defined data associated with the control.
|
|
xtd::ustring | to_string () const noexcept override |
| Returns a string that represents the menu control.
|
|
| object ()=default |
| Create a new instance of the ultimate base class object.
|
|
virtual bool | equals (const object &obj) const noexcept |
| Determines whether the specified object is equal to the current object.
|
|
virtual size_t | get_hash_code () const noexcept |
| Serves as a hash function for a particular type.
|
|
template<typename object_t > |
std::unique_ptr< object_t > | memberwise_clone () const |
| Gets the type of the current instance.
|
|
virtual xtd::ustring | to_string () const noexcept |
| Returns a std::string that represents the current object.
|
|
|
| menu () |
| Initializes a new instance of the Menu class.
|
|
| menu (const menu_item_collection &items) |
| Initializes a new instance of the Menu class.
|
|
void | clone_menu (const menu &menu_src) |
| Copies the menu that is passed as a parameter to the current menu.
|
|
virtual intptr_t | create_menu_handle ()=0 |
| Creates a new handle to the Menu.
|
|
virtual void | destroy_menu_handle (intptr_t handle)=0 |
| Destroy the handle to the Menu.
|
|
| component ()=default |
| Initialises a new instance of the component class.
|
|
virtual bool | can_raise_events () const |
| Gets a value indicating whether the component can raise an event.
|
|
bool | design_mode () const |
| Gets a value that indicates whether the component is currently in design mode.
|
|
|
static bool | equals (const object &object_a, const object &object_b) noexcept |
| Determines whether the specified object instances are considered equal.
|
|
static bool | reference_equals (const object &object_a, const object &object_b) noexcept |
| Determines whether the specified object instances are the same instance.
|
|
◆ 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_t xtd::forms::menu::create_menu_handle |
( |
| ) |
|
|
protectedpure virtual |
◆ destroy_menu_handle()
virtual void xtd::forms::menu::destroy_menu_handle |
( |
intptr_t |
handle | ) |
|
|
protectedpure virtual |
◆ get_context_menu()
std::optional< context_menu > xtd::forms::menu::get_context_menu |
( |
| ) |
const |
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< main_menu > xtd::forms::menu::get_main_menu |
( |
| ) |
const |
Gets the main_menu that contains this menu.
- Returns
- The main_menu that contains this menu. The default is has no value.
◆ handle()
intptr_t xtd::forms::menu::handle |
( |
| ) |
const |
|
inline |
Gets a value representing the window handle for the menu.
- Returns
- The HMENU value of the menu.
◆ is_parent()
bool xtd::forms::menu::is_parent |
( |
| ) |
const |
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.
◆ mdi_list_item()
const menu_item & xtd::forms::menu::mdi_list_item |
( |
| ) |
const |
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 |
|
inline |
Gets user-defined data associated with the control.
- Returns
- An object representing the data.
◆ tag() [2/2]
menu & xtd::forms::menu::tag |
( |
std::any |
value | ) |
|
|
inline |
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 const int xtd::forms::menu::find_handle |
|
staticconstexpr |
Specifies that the find_menu_item(int32_t, intptr_t) method should search for a handle.
◆ find_shortcut
constexpr const int xtd::forms::menu::find_shortcut |
|
staticconstexpr |
Specifies that the find_menu_item(int32_t, intptr_t) method should search for a shortcut.
The documentation for this class was generated from the following file:
- xtd.forms/include/xtd/forms/menu.h