xtd 0.2.0
main_menu.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "menu_item.hpp"
6#include "message.hpp"
7#include <xtd/collections/generic/list>
8#include <xtd/drawing/size>
9#include <xtd/iclonable>
10#include <memory>
11#include <vector>
12
14namespace xtd {
16 namespace forms {
18 class form;
20
42 class forms_export_ main_menu : public menu, public iclonable {
43 public:
45
51 explicit main_menu(const std::vector<menu_item_ref>& menu_items);
53
55 explicit main_menu(const std::initializer_list<const_menu_item_ref>& menu_items);
56 main_menu(main_menu&&) = default;
57 main_menu(const main_menu&) = default;
58 main_menu& operator =(const main_menu&) = default;
60
62
265
267 template<class on_click_type>
268 static xtd::forms::main_menu create_standard_items(on_click_type on_click) {return create_standard_items(xtd::event_handler(on_click));}
269 template<class on_click_type>
270 static xtd::forms::main_menu create_standard_items(const xtd::drawing::size& size, on_click_type on_click) {return create_standard_items(size, xtd::event_handler(on_click));}
271 template<class on_click_type>
272 static xtd::forms::main_menu create_standard_items(const xtd::string& theme, on_click_type on_click) {return create_standard_items(theme, xtd::event_handler(on_click));}
273 template<class on_click_type>
274 static xtd::forms::main_menu create_standard_items(const xtd::string& theme, const xtd::drawing::size& size, on_click_type on_click) {return create_standard_items(theme, size, xtd::event_handler(on_click));}
276
277 protected:
279
286
288 void destroy_menu_handle(intptr handle) override;
289 void on_item_added(size_t pos, menu_item_ref item) override;
290 void on_item_removed(size_t pos, menu_item_ref item) override;
292
293 private:
294 friend class form;
295 void wm_click(message& message);
297 };
298 }
299}
300
Represents text as a sequence of character units.
Definition basic_string.hpp:71
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:80
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
Represents the menu structure of a form.
Definition main_menu.hpp:42
static xtd::forms::main_menu create_standard_items(const xtd::string &theme, const xtd::drawing::size &size, const xtd::event_handler &on_click)
A factory to create a main menu with specified theme, image size and on click event handler.
static xtd::forms::main_menu create_standard_items(const xtd::string &theme, const xtd::event_handler &on_click)
A factory to create a main menu with specified theme and on click event handler.
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.
main_menu()
Initialize a new instance of main_menu class.
void destroy_menu_handle(intptr handle) override
Destroys the handle to the Menu.
intptr create_menu_handle() override
Creates a new handle to the Menu.
static xtd::forms::main_menu create_standard_items(const xtd::drawing::size &image_size, const xtd::event_handler &on_click)
A factory to create a main menu with specified image size and on click event handler.
xtd::uptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
main_menu(const std::vector< menu_item_ref > &menu_items)
Initialize a new instance of main_menu class.
Represents the base functionality for all menus. Although tool_strip_drop_down and tool_strip_drop_do...
Definition menu.hpp:37
Supports cloning, which creates a new instance of a class with the same value as an existing instance...
Definition iclonable.hpp:21
generic_event_handler< const xtd::event_args & > event_handler
Represents the method that will handle an event that has no event data.
Definition event_handler.hpp:24
#define forms_export_
Define shared library export.
Definition forms_export.hpp:13
xtd::forms::style_sheets::control form
The form data allows you to specify the box of a form control.
Definition form.hpp:23
std::unique_ptr< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
std::reference_wrapper< menu_item > menu_item_ref
Represents a menu item reference.
Definition menu_item_ref.hpp:23
Contains xtd::forms::menu_item menu.
Contains xtd::forms::message class.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.hpp:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Stores an ordered pair of integers, which specify a height and width.
Definition size.hpp:31
Implements a Windows message.
Definition message.hpp:33