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 |
Public Aliases | |
| using | menu_item_collection |
| Represents a collection of menu_item objects. | |
Public Fields | |
| static constexpr int32 | find_handle |
| Specifies that the find_menu_item(int32, intptr) method should search for a handle. | |
| static constexpr int32 | find_shortcut |
| Specifies that the find_menu_item(int32, intptr) method should search for a shortcut. | |
Public Properties | |
| intptr | handle () const noexcept |
| Gets a value representing the window handle for the menu. | |
| virtual bool | is_parent () const noexcept |
| Gets a value indicating whether this menu contains any menu items. | |
| const menu_item & | 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. | |
| const menu_item_collection & | menu_items () const noexcept |
| Gets a value indicating the collection of menu_item objects associated with the menu. | |
| menu_item_collection & | menu_items () noexcept |
| 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. | |
| const xtd::string & | name () const noexcept |
| Gets the name of the menu. | |
| menu & | name (const xtd::string &value) |
| Sets the name of the menu. | |
| const xtd::any_object & | tag () const noexcept |
| Gets user-defined data associated with the control. | |
| menu & | tag (const xtd::any_object &value) |
| Sets user-defined data associated with the control. | |
Public Methods | |
| bool | equals (const xtd::object &obj) const noexcept override |
| Determines whether the specified object is equal to the current object. | |
| bool | equals (const menu &other) const noexcept override |
| Determines whether the specified object is equal to the current object. | |
| xtd::size | get_hash_code () const noexcept override |
| Serves as a hash function for a particular type. | |
| std::optional< xtd::ref< context_menu > > | get_context_menu () const noexcept |
| Gets the context_menu that contains this menu. | |
| std::optional< xtd::ref< main_menu > > | get_main_menu () const noexcept |
| Gets the main_menu that contains this menu. | |
| virtual void | merge_menu (const menu &menu_src) |
| Merges the MenuItem objects of one menu with the current menu. | |
| xtd::string | to_string () const noexcept override |
| Returns a string that represents the menu control. | |
Protected constructors | |
| menu () | |
| Initializes a new instance of the Menu class. | |
| menu (const menu_item_collection &items) | |
| Initializes a new instance of the Menu class. | |
Protected Methods | |
| void | clone_menu (const menu &menu_src) |
| Copies the menu that is passed as a parameter to the current menu. | |
| virtual intptr | create_menu_handle ()=0 |
| Creates a new handle to the Menu. | |
| virtual void | destroy_menu_handle (intptr handle) |
| Destroys the handle to the Menu. | |
| 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. | |
| virtual type_object | get_type () const noexcept |
| Gets the type of the current instance. | |
| template<class object_t> | |
| xtd::unique_ptr_object< object_t > | memberwise_clone () const |
| Creates a shallow copy of the current object. | |
| virtual bool | equals (const menu &) const noexcept=0 |
| Indicates whether the current object is equal to another object of the same type. | |
| template<class object_a_t, class object_b_t> | |
| static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are considered equal. | |
| template<class object_a_t, class object_b_t> | |
| static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are the same instance. | |
| component () | |
| Initialises a new instance of the component class. | |
| virtual bool | can_raise_events () const noexcept |
| Gets a value indicating whether the component can raise an event. | |
| bool | design_mode () const noexcept |
| Gets a value that indicates whether the component is currently in design mode. | |
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. |
|
noexcept |
Gets a value representing the window handle for the menu.
|
virtualnoexcept |
Gets a value indicating whether this menu contains any menu items.
true if this menu contains menu_item objects; otherwise, false. The default is false. Reimplemented in xtd::forms::menu_item.
|
noexcept |
Gets a value indicating the menu_item that is used to display a list of multiple document interface (MDI) child forms.
|
noexcept |
Gets a value indicating the collection of menu_item objects associated with the menu.
|
noexcept |
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. |
|
noexcept |
Gets the name of the menu.
| menu & xtd::forms::menu::name | ( | const xtd::string & | value | ) |
Sets the name of the menu.
| value | A string representing the name. |
|
noexcept |
Gets user-defined data associated with the control.
| menu & xtd::forms::menu::tag | ( | const xtd::any_object & | value | ) |
Sets user-defined data associated with the control.
| value | An object representing the data. |
|
overridevirtualnoexcept |
Determines whether the specified object is equal to the current object.
| obj | The object to compare with the current object. |
true if the specified object is equal to the current object. otherwise, false. Reimplemented from xtd::object.
|
overridenoexcept |
Determines whether the specified object is equal to the current object.
| other | The object to compare with the current object. |
true if the specified object is equal to the current object. otherwise, false.
|
overridevirtualnoexcept |
Serves as a hash function for a particular type.
Reimplemented from xtd::object.
|
noexcept |
Gets the context_menu that contains this menu.
Gets the main_menu that contains this 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. |
|
overridevirtualnoexcept |
Returns a string that represents the menu control.
Reimplemented from xtd::object.
Reimplemented in xtd::forms::menu_item.
|
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::context_menu, xtd::forms::main_menu, and xtd::forms::menu_item.
|
protectedvirtual |
Destroys the handle to the Menu.
| handle | A handle to the menu. |
Reimplemented in xtd::forms::context_menu, xtd::forms::main_menu, and xtd::forms::menu_item.
|
staticconstexpr |
Specifies that the find_menu_item(int32, intptr) method should search for a handle.
|
staticconstexpr |
Specifies that the find_menu_item(int32, intptr) method should search for a shortcut.