xtd 0.2.0
context_menu.h
Go to the documentation of this file.
1 #pragma once
5 #include "menu.h"
6 #include "message.h"
7 #include <xtd/drawing/point>
8 
10 namespace xtd {
12  namespace forms {
14  class control;
16 
33  class forms_export_ context_menu : public menu {
34  public:
36 
39  context_menu();
42  explicit context_menu(const std::vector<menu_item_ref>& menu_items);
44 
46  explicit context_menu(const std::initializer_list<const_menu_item_ref>& menu_items);
47  ~context_menu();
49 
51 
57  void show(const xtd::forms::control& control, const xtd::drawing::point& pos);
60  protected:
62 
64  intptr create_menu_handle() override;
65  void destroy_menu_handle(intptr handle) override;
66  void on_item_added(size_t pos, menu_item_ref item) override;
67  void on_item_removed(size_t pos, menu_item_ref item) override;
69 
70  private:
71  friend class control;
72  bool on_item_click(intptr menu_id);
73  };
74  }
75 }
intmax_t intptr
Represent a pointer or a handle.
Definition: types.h:151
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition: point.h:54
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Contains xtd::forms::message class.
Represents the base functionality for all menus. Although tool_strip_drop_down and tool_strip_drop_do...
Definition: menu.h:35
Defines the base class for controls, which are components with visual representation.
Definition: control.h:78
Represents a shortcut menu.
Definition: context_menu.h:33
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
std::reference_wrapper< menu_item > menu_item_ref
Represents a menu item reference.
Definition: menu_item_ref.h:21
The left or right CTRL modifier key.