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, hello_world_xtd.cpp, main_menu.cpp, main_menu_create_standard_items.cpp, minesweeper.cpp, some_controls.cpp, some_system_controls.cpp, and themes.cpp.
|
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.
|
|
|
bool | equals (const menu &) const noexcept override |
|
std::optional< std::reference_wrapper< context_menu > > | get_context_menu () const noexcept |
| Gets the context_menu that contains this menu.
|
|
std::optional< std::reference_wrapper< 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.
|
|
virtual bool | equals (const object &obj) const noexcept |
| Determines whether the specified object is equal to the current object.
|
|
template<typename object_a_t , typename 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.
|
|
|
| menu () |
| Initializes a new instance of the Menu class.
|
|
| menu (const menu_item_collection &items) |
| Initializes a new instance of the Menu class.
|
|
|
| object ()=default |
| Create a new instance of the ultimate base class object.
|
|
virtual size_t | get_hash_code () const noexcept |
| Serves as a hash function for a particular type.
|
|
virtual type_object | get_type () const noexcept |
| Gets the type of the current instance.
|
|
template<typename object_t > |
xtd::uptr< 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<typename object_a_t , typename 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<typename object_a_t , typename 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.
|
|
◆ 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. |
◆ 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.
◆ 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]
menu & xtd::forms::menu::tag |
( |
std::any |
value | ) |
|
Sets user-defined data associated with the control.
- Parameters
-
value | An object representing the data. |
- Returns
- Current menu class.
◆ 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.
◆ 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. |
◆ 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.
◆ 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 |
◆ equals() [1/2]
virtual bool xtd::object::equals |
( |
const object & |
obj | ) |
const |
|
virtualnoexcept |
Determines whether the specified object is equal to the current object.
- Parameters
-
obj | The object to compare with the current object. |
- Returns
- true if the specified object is equal to the current object. otherwise, false.
- Examples
- The following code example compares the current instance with another object.
#include <xtd/console>
auto main() -> int {
auto object1 = new_ptr<object>();
auto object2 = new_ptr<object>();
auto object3 = object2;
object3 = object1;
}
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Reimplemented from xtd::object.
◆ equals() [2/2]
template<typename object_a_t , typename object_b_t >
static bool xtd::object::equals |
( |
const object_a_t & |
object_a, |
|
|
const object_b_t & |
object_b |
|
) |
| |
|
inlinestaticnoexcept |
Determines whether the specified object instances are considered equal.
- Parameters
-
object_a | The first object to compare. |
object_b | The second object to compare. |
- Returns
- true if object_a is the same instance as object_b or if both are null references or if object_a(object_b) returns true. otherwise, false.
- Examples
- The following code example compares different objects.
#include <xtd/console>
auto main() -> int {
string s1 = "Tom";
string s2 = "Carol";
s1 = "Tom";
s2 = "Tom";
s1 = "";
s2 = "Tom";
s1 = "Carol";
s2 = "";
s1 = "";
s2 = "";
}
virtual bool equals(const object &obj) const noexcept
Determines whether the specified object is equal to the current object.
◆ find_handle
constexpr int32 xtd::forms::menu::find_handle |
|
staticconstexpr |
Specifies that the find_menu_item(int32, intptr) method should search for a handle.
◆ find_shortcut
constexpr int32 xtd::forms::menu::find_shortcut |
|
staticconstexpr |
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: