xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
main_menu.h
Go to the documentation of this file.
1 #pragma once
5 #include <memory>
6 #include <vector>
7 #include "menu_item.h"
8 #include "message.h"
9 #include "theme_images.h"
10 #include <xtd/drawing/size.h>
11 
13 namespace xtd {
15  namespace forms {
17  class form;
19 
32  class forms_export_ main_menu : public menu {
33  public:
35  main_menu();
38  main_menu(const std::vector<menu_item_ref>& menu_items);
40  main_menu(const std::initializer_list<const_menu_item_ref>& menu_items);
42 
79  static std::unique_ptr<xtd::forms::main_menu> create_standard_items(std::vector<std::unique_ptr<menu_item>>& menu_items, const xtd::event_handler& on_click);
117  static std::unique_ptr<xtd::forms::main_menu> create_standard_items(std::vector<std::unique_ptr<menu_item>>& menu_items, const xtd::drawing::size& image_size, const xtd::event_handler& on_click);
155  static std::unique_ptr<xtd::forms::main_menu> create_standard_items(std::vector<std::unique_ptr<menu_item>>& menu_items, const xtd::ustring& theme, const xtd::event_handler& on_click);
194  static std::unique_ptr<xtd::forms::main_menu> create_standard_items(std::vector<std::unique_ptr<menu_item>>& menu_items, const xtd::ustring& theme, const xtd::drawing::size& size, const xtd::event_handler& on_click);
233  static std::unique_ptr<xtd::forms::main_menu> create_standard_items(std::vector<std::unique_ptr<menu_item>>& menu_items, const xtd::forms::theme_images& theme, const xtd::drawing::size& size, const xtd::event_handler& on_click);
234 
236  template<typename on_click_type>
237  static std::unique_ptr<xtd::forms::main_menu> create_standard_items(std::vector<std::unique_ptr<menu_item>>& menu_items, on_click_type on_click) {return create_standard_items(menu_items, xtd::event_handler(on_click));}
238  template<typename on_click_type>
239  static std::unique_ptr<xtd::forms::main_menu> create_standard_items(std::vector<std::unique_ptr<menu_item>>& menu_items, const xtd::drawing::size& size, on_click_type on_click) {return create_standard_items(menu_items, size, xtd::event_handler(on_click));}
240  template<typename on_click_type>
241  static std::unique_ptr<xtd::forms::main_menu> create_standard_items(std::vector<std::unique_ptr<menu_item>>& menu_items, const xtd::ustring& theme, on_click_type on_click) {return create_standard_items(menu_items, theme, xtd::event_handler(on_click));}
242  template<typename on_click_type>
243  static std::unique_ptr<xtd::forms::main_menu> create_standard_items(std::vector<std::unique_ptr<menu_item>>& menu_items, const xtd::ustring& theme, const xtd::drawing::size& size, on_click_type on_click) {return create_standard_items(menu_items, theme, size, xtd::event_handler(on_click));}
244  template<typename on_click_type>
245  static std::unique_ptr<xtd::forms::main_menu> create_standard_items(std::vector<std::unique_ptr<menu_item>>& menu_items, const xtd::forms::theme_images& theme, const xtd::drawing::size& size, on_click_type on_click) {return create_standard_items(menu_items, theme, size, xtd::event_handler(on_click));}
247 
248  protected:
249  intptr_t create_menu_handle() override;
250  void destroy_menu_handle(intptr_t handle) override;
251  void on_item_added(size_t pos, menu_item_ref item) override;
252  void on_item_removed(size_t pos, menu_item_ref item) override;
253 
254  private:
255  friend class form;
256  void wm_click(message& message);
257  };
258  }
259 }
260 
generic_event_handler<> event_handler
Represents the method that will handle an event that has no event data.
Definition: event_handler.h:33
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:25
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Definition: theme_images.h:14
Contains xtd::forms::message class.
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
Definition: theme.h:14
Represents a window or dialog box that makes up an application&#39;s user interface.
Definition: form.h:40
Contains xtd::drawing::size class.
Implements a Windows message.
Definition: message.h:25
Represents the base functionality for all menus. Although tool_strip_drop_down and tool_strip_drop_do...
Definition: menu.h:49
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
Represents the menu structure of a form.
Definition: main_menu.h:32
std::reference_wrapper< menu_item > menu_item_ref
Represents a menu item reference.
Definition: menu.h:29
size_t size
Represents a size of any object in bytes.
Definition: types.h:171
Contains xtd::forms::theme_images class.