xtd 0.2.0
Loading...
Searching...
No Matches
context_menu.h
Go to the documentation of this file.
1
4#pragma once
5#include "menu.h"
6#include "message.h"
7#include <xtd/drawing/point>
8#include <xtd/iclonable>
9
11namespace xtd {
13 namespace forms {
15 class control;
17
36 class forms_export_ context_menu : public menu, public iclonable {
37 public:
39
45 explicit context_menu(const std::vector<menu_item_ref>& menu_items);
47
49 explicit context_menu(const std::initializer_list<const_menu_item_ref>& menu_items);
50 context_menu(context_menu&&) = default;
51 context_menu(const context_menu&) = default;
52 context_menu& operator =(const context_menu&) = default;
55
57
66 protected:
68
74 xtd::uptr<xtd::object> clone() const override;
75
77 void destroy_menu_handle(intptr handle) override;
78 void on_item_added(size_t pos, menu_item_ref item) override;
79 void on_item_removed(size_t pos, menu_item_ref item) override;
81
82 private:
83 friend class control;
84 bool on_item_click(intptr menu_id);
85 };
86 }
87}
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition point.h:54
Represents a shortcut menu.
Definition context_menu.h:36
intptr create_menu_handle() override
Creates a new handle to the Menu.
context_menu(const std::vector< menu_item_ref > &menu_items)
Initialize a new instance of context_menu class.
void show(const xtd::forms::control &control, const xtd::drawing::point &pos)
Displays the shortcut menu at the specified position.
xtd::uptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
void destroy_menu_handle(intptr handle) override
Destroys the handle to the Menu.
context_menu()
Initialize context_menu class.
Defines the base class for controls, which are components with visual representation.
Definition control.h:81
Represents the base functionality for all menus. Although tool_strip_drop_down and tool_strip_drop_do...
Definition menu.h:37
Supports cloning, which creates a new instance of a class with the same value as an existing instance...
Definition iclonable.h:21
#define forms_export_
Define shared library export.
Definition forms_export.h:13
std::unique_ptr< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.h:25
intmax_t intptr
Represent a pointer or a handle.
Definition intptr.h:23
@ control
The left or right CTRL modifier key.
std::reference_wrapper< menu_item > menu_item_ref
Represents a menu item reference.
Definition menu_item_ref.h:23
Contains xtd::forms::menu 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.h:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10