#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.
Protected Attributes | |
friend | menu_item |
Alias | |
using | menu_item_collection = layout::arranged_element_collection< menu_item_ref > |
Represents a collection of menu_item objects. More... | |
Fields | |
static constexpr const int | find_handle = 0 |
Specifies that the find_menu_item(int32_t, intptr_t) method should search for a handle. More... | |
static constexpr const int | find_shortcut = 1 |
Specifies that the find_menu_item(int32_t, intptr_t) method should search for a shortcut. More... | |
Properties | |
intptr_t | handle () const |
Gets a value representing the window handle for the menu. More... | |
virtual bool | is_parent () const |
Gets a value indicating whether this menu contains any menu items. More... | |
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. More... | |
const menu_item_collection & | menu_items () const |
Gets a value indicating the collection of menu_item objects associated with the menu. More... | |
menu_item_collection & | menu_items () |
Gets a value indicating the collection of menu_item objects associated with the menu. More... | |
menu & | menu_items (const menu_item_collection &value) |
Sets a value indicating the collection of menu_item objects associated with the menu. More... | |
const xtd::ustring & | name () const |
Gets the name of the menu. More... | |
menu & | name (const xtd::ustring &value) |
Sets the name of the menu. More... | |
std::any | tag () const |
Gets user-defined data associated with the control. More... | |
menu & | tag (std::any value) |
Sets user-defined data associated with the control. More... | |
Methods | |
bool | equals (const menu &) const noexcept override |
bool | equals (const object &) const noexcept override |
Indicates whether the current object is equal to another object of the same type. More... | |
std::optional< std::reference_wrapper< context_menu > > | get_context_menu () const |
Gets the context_menu that contains this menu. More... | |
std::optional< std::reference_wrapper< main_menu > > | get_main_menu () const |
Gets the main_menu that contains this menu. More... | |
virtual void | merge_menu (const menu &menu_src) |
Merges the MenuItem objects of one menu with the current menu. More... | |
xtd::ustring | to_string () const noexcept override |
Returns a string that represents the menu control. More... | |
Protected constructors | |
menu () | |
Initializes a new instance of the Menu class. More... | |
menu (const menu_item_collection &items) | |
Initializes a new instance of the Menu class. More... | |
Protected methods | |
void | clone_menu (const menu &menu_src) |
Copies the menu that is passed as a parameter to the current menu. More... | |
virtual intptr_t | create_menu_handle ()=0 |
Creates a new handle to the Menu. More... | |
virtual void | destroy_menu_handle (intptr_t handle) |
Destroys the handle to the Menu. More... | |
virtual void | on_item_added (size_t pos, menu_item_ref item) |
virtual void | on_item_removed (size_t pos, menu_item_ref item) |
Additional Inherited Members | |
![]() | |
object ()=default | |
Create a new instance of the ultimate base class object. More... | |
virtual size_t | get_hash_code () const noexcept |
Serves as a hash function for a particular type. More... | |
template<typename object_t > | |
std::unique_ptr< object_t > | memberwise_clone () const |
Gets the type of the current instance. 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 ()=default | |
Initialises a new instance of the component class. More... | |
virtual bool | can_raise_events () const |
Gets a value indicating whether the component can raise an event. More... | |
bool | design_mode () const |
Gets a value that indicates whether the component is currently in design mode. More... | |
Represents a collection of menu_item objects.
|
protected |
Initializes a new instance of the Menu class.
|
explicitprotected |
Initializes a new instance of the Menu class.
items | An array of type MenuItem containing the objects to add to the menu. |
|
protected |
Copies the menu that is passed as a parameter to the current menu.
menu_src | The Menu to copy. |
|
protectedpure virtual |
Creates a new handle to the Menu.
Implemented in xtd::forms::menu_item, xtd::forms::main_menu, and xtd::forms::context_menu.
|
inlineprotectedvirtual |
Destroys the handle to the Menu.
handle | A handle to the menu. |
Reimplemented in xtd::forms::menu_item, xtd::forms::main_menu, and xtd::forms::context_menu.
|
overridevirtualnoexcept |
Indicates whether the current object is equal to another object of the same type.
obj | An object to compare with this object. |
Implements xtd::iequatable< menu >.
std::optional<std::reference_wrapper<context_menu> > xtd::forms::menu::get_context_menu | ( | ) | const |
Gets the context_menu that contains this menu.
std::optional<std::reference_wrapper<main_menu> > xtd::forms::menu::get_main_menu | ( | ) | const |
Gets the main_menu that contains this menu.
|
inline |
Gets a value representing the window handle for the menu.
|
virtual |
Gets a value indicating whether this menu contains any menu items.
Reimplemented in xtd::forms::menu_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.
|
inline |
Gets a value indicating the collection of menu_item objects associated with the menu.
|
inline |
Gets a value indicating the collection of menu_item objects associated with the menu.
menu& xtd::forms::menu::menu_items | ( | const menu_item_collection & | value | ) |
Sets a value indicating the collection of menu_item objects associated with the menu.
value | A menu::menu_item_collection that represents the list of menu_item objects stored in the menu. |
|
virtual |
Merges the MenuItem objects of one menu with the current menu.
menu_src | The menu whose menu items are merged with the menu items of the current menu. |
std::invalid_argument | It was attempted to merge the menu with itself. |
|
inline |
Gets the name of the menu.
|
inline |
Sets the name of the menu.
value | A string representing the name. |
|
inline |
Gets user-defined data associated with the control.
Sets user-defined data associated with the control.
value | An object representing the data. |
|
overridevirtualnoexcept |
Returns a string that represents the menu control.
Reimplemented from xtd::object.
Reimplemented in xtd::forms::menu_item.
|
static |
Specifies that the find_menu_item(int32_t, intptr_t) method should search for a handle.
|
static |
Specifies that the find_menu_item(int32_t, intptr_t) method should search for a shortcut.