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
34 class forms_export_ context_menu : public menu, public iclonable {
35 public:
37
43 explicit context_menu(const std::vector<menu_item_ref>& menu_items);
45
47 explicit context_menu(const std::initializer_list<const_menu_item_ref>& menu_items);
48 context_menu(context_menu&&) = default;
49 context_menu(const context_menu&) = default;
50 context_menu& operator =(const context_menu&) = default;
53
55
64 protected:
66
72 std::unique_ptr<xtd::object> clone() const override;
73
75 void destroy_menu_handle(intptr handle) override;
76 void on_item_added(size_t pos, menu_item_ref item) override;
77 void on_item_removed(size_t pos, menu_item_ref item) override;
79
80 private:
81 friend class control;
82 bool on_item_click(intptr menu_id);
83 };
84 }
85}
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:34
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.
void destroy_menu_handle(intptr handle) override
Destroys the handle to the Menu.
context_menu()
Initialize context_menu class.
std::unique_ptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
Defines the base class for controls, which are components with visual representation.
Definition control.h:79
Represents the base functionality for all menus. Although tool_strip_drop_down and tool_strip_drop_do...
Definition menu.h:35
Supports cloning, which creates a new instance of a class with the same value as an existing instance...
Definition iclonable.h:19
#define forms_export_
Define shared library export.
Definition forms_export.h:13
intmax_t intptr
Represent a pointer or a handle.
Definition types.h:153
@ 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:21
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