#include <xtd/drawing/texts>
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/list_box>
#include <xtd/forms/main_menu>
#include <xtd/forms/menu_images>
#include <xtd/forms/message_box>
namespace main_menu_example {
class form1 :
public form {
public:
form1() {
text(
"Main menu example");
list_box1.parent(*this);
}
protected:
};
private:
void on_menu_click(
object& sender,
const event_args&
e) {
list_box1.items().push_back(string::format(
"{} clicked",
as<menu_item>(sender).
text()));
list_box1.selected_index(list_box1.items().size() - 1);
}
menu_item file_open_recent_file1_menu_item {
"Path/File1", {*
this, &form1::on_menu_click}};
menu_item file_open_recent_file2_menu_item {
"Path/File2", {*
this, &form1::on_menu_click}};
menu_item file_open_recent_file3_menu_item {
"Path/File3", {*
this, &form1::on_menu_click}};
menu_item file_open_recent_file4_menu_item {
"Path/File4", {*
this, &form1::on_menu_click}};
menu_item file_open_recent_menu_item {
"Open recent", {file_open_recent_file1_menu_item, file_open_recent_file2_menu_item, file_open_recent_file3_menu_item, file_open_recent_file4_menu_item}};
menu_item file_page_setup_menu_item {
"Page &Seup...", {*
this, &form1::on_menu_click}};
menu_item view_show_menu_item {
"Show", {*
this, &form1::on_menu_click}};
menu_item view_hide_menu_item {
"Hide", {*
this, &form1::on_menu_click}};
menu_item options_separator1_menu_item {
"-"};
menu_item options_separator2_menu_item {
"-"};
menu_item file_menu_item {
texts::file(), {file_new_menu_item, file_separator1_menu_item, file_open_menu_item, file_open_recent_menu_item, file_close_menu_item, file_separator2_menu_item, file_save_menu_item, file_save_as_menu_item, file_separator3_menu_item, file_page_setup_menu_item, file_print_menu_item, file_print_preview_menu_item, file_separator4_menu_item, file_exit_menu_item}};
menu_item edit_menu_item {
texts::edit(), {edit_undo_menu_item, edit_redo_menu_item, edit_separator1_menu_item, edit_cut_menu_item, edit_copy_menu_item, edit_paste_menu_item, edit_separator2_menu_item, edit_select_all_menu_item, edit_separator3_menu_item, edit_options_menu_item}};
menu_item view_menu_item {
texts::view(), {view_back_menu_item, view_forward_menu_item, view_separator1_menu_item, view_show_menu_item, view_hide_menu_item}};
menu_item options_menu_item {
texts::options(), {options_value_a_menu_item, options_value_b_menu_item, options_value_c_menu_item, options_separator1_menu_item, options_value_d_menu_item, options_value_e_menu_item, options_value_f_menu_item, options_separator2_menu_item, options_value_g_menu_item, options_value_h_menu_item, options_value_i_menu_item}};
main_menu main_menu1 {file_menu_item, edit_menu_item, view_menu_item, options_menu_item, help_menu_item};
list_box list_box1;
};
}
auto main() -> int {
}
static xtd::string help()
Gets a system-defined text that has a string value of "&Help". This field is constant.
static xtd::string undo()
Gets a system-defined text that has a string value of "&Undo". This field is constant.
static xtd::string new_()
Gets a system-defined text that has a string value of "&New". This field is constant.
static xtd::string save_as()
Gets a system-defined text that has a string value of "Save &As...". This field is constant.
static xtd::string print_preview()
Gets a system-defined text that has a string value of "Print Re&view". This field is constant.
static xtd::string redo()
Gets a system-defined text that has a string value of "&Redo". This field is constant.
static xtd::string edit()
Gets a system-defined text that has a string value of "&Edit". This field is constant.
static xtd::string print()
Gets a system-defined text that has a string value of "&Print...". This field is constant.
static xtd::string save()
Gets a system-defined text that has a string value of "&Save". This field is constant.
static xtd::string close()
Gets a system-defined text that has a string value of "&Close". This field is constant.
static xtd::string cut()
Gets a system-defined text that has a string value of "Cu&t". This field is constant.
static xtd::string forward()
Gets a system-defined text that has a string value of "&Forward". This field is constant.
static xtd::string file()
Gets a system-defined text that has a string value of "&File". This field is constant.
static xtd::string options()
Gets a system-defined text that has a string value of "&Options". This field is constant.
static xtd::string copy()
Gets a system-defined text that has a string value of "&Copy". This field is constant.
static xtd::string exit()
Gets a system-defined text that has a string value of "E&xit". This field is constant.
static xtd::string open()
Gets a system-defined text that has a string value of "&Open...". This field is constant.
static xtd::string paste()
Gets a system-defined text that has a string value of "&Paste". This field is constant.
static xtd::string view()
Gets a system-defined text that has a string value of "&View". This field is constant.
static xtd::string select_all()
Gets a system-defined text that has a string value of "Select &All". This field is constant.
static xtd::string back()
Gets a system-defined text that has a string value of "&Back". This field is constant.
static xtd::string about()
Gets a system-defined text that has a string value of "&About". This field is constant.
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
Represents the menu structure of a form.
Definition main_menu.hpp:42
@ menu
The system-defined color of a menu's background.
Definition known_color.hpp:489
type_t as(any_object &o)
Casts a type into another type.
Definition __as_any_object.hpp:59
@ e
The E key.
Definition console_key.hpp:96
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
Contains classes that represent ASCII and Unicode character encodings; abstract base classes for conv...
Definition basic_string_builder.hpp:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8