xtd 0.2.0
Loading...
Searching...
No Matches

◆ create_standard_items() [3/4]

static xtd::forms::main_menu xtd::forms::main_menu::create_standard_items ( const xtd::ustring theme,
const xtd::event_handler on_click 
)
static

A factory to create a main menu with specified theme and on click event handler.

Parameters
menu_itemsan array xtd::forms::menu_item which will contain the created menu items.
themeThe theme of menu item image.
on_clickan event handler to respond on lick event.
Returns
new main menu instance.
Remarks
The following table shows the items contained in the menu_items array and sub menu_items array :
menu_index sub_menu_index menu_item sub_menu_item
0 file
0 0 file new
0 1 file open
0 2 file separator1
0 3 file save
0 4 file save_as
0 5 file separator2
0 6 file print
0 7 file print_preview
0 8 file separator3
0 9 file exit
1 edit
1 0 edit undo
1 1 edit redo
1 2 edit separator1
1 3 edit cut
1 4 edit copy
1 6 edit paste
1 6 edit separator2
1 7 edit select_all
2 tools
2 0 tools customize
2 1 tools options
3 help
3 0 help contents
3 1 help index
3 2 help search
3 3 help separator1
3 4 help about
Examples
The following example shows how to access to edit menu item.
auto main_menu = create_standard_items(on_click_menu_items);
auto& edit_menu = main_menu.menu_items()[1].get();
static xtd::forms::main_menu create_standard_items(const xtd::event_handler &on_click)
A factory to create a main menu with specified on click event handler.
Represents the menu structure of a form.
Definition main_menu.h:41
const menu_item_collection & menu_items() const noexcept
Gets a value indicating the collection of menu_item objects associated with the menu.
The following example shows how to access to search help menu item.
auto main_menu = create_standard_items(on_click_menu_items);
auto& search_help_menu = main_menu.menu_items()[3].get()[2].get();