Boost.UI
User Interface Boost library
boost
ui
menu.hpp
Go to the documentation of this file.
1
// Copyright (c) 2017, 2018 Kolya Kosenko
2
3
// Distributed under the Boost Software License, Version 1.0.
4
// See http://www.boost.org/LICENSE_1_0.txt
5
7
8
#ifndef BOOST_UI_MENU_HPP
9
#define BOOST_UI_MENU_HPP
10
11
#include <
boost/ui/config.hpp
>
12
13
#ifdef BOOST_HAS_PRAGMA_ONCE
14
#pragma once
15
#endif
16
17
#include <
boost/ui/widget.hpp
>
18
#include <boost/ui/detail/shared_count.hpp>
19
#include <boost/ui/detail/event.hpp>
20
21
#include <boost/noncopyable.hpp>
22
23
namespace
boost
{
24
namespace
ui {
25
28
29
class
BOOST_UI_DECL
separator
30
{
31
};
32
33
class
frame
;
34
class
menu
;
35
40
41
class
BOOST_UI_DECL
menu_bar
42
{
43
menu_bar
();
44
void
create();
45
46
public
:
48
menu_bar
(
const
menu_bar
& other);
49
~
menu_bar
();
50
52
menu_bar
& append(
const
menu
& i);
53
menu_bar
&
operator<<
(
const
menu
& i)
54
{
return
append(i); }
56
58
typedef
void
*
native_handle_type
;
59
61
native_handle_type
native_handle
() {
return
m_impl; }
62
const
native_handle_type
native_handle
()
const
{
return
m_impl; }
64
65
private
:
66
class
native_impl;
67
native_impl* m_impl;
68
69
#ifndef DOXYGEN
70
friend
class
frame
;
71
friend
class
menu
;
72
#endif
73
};
74
78
79
class
BOOST_UI_DECL
menu
80
{
81
public
:
82
class
item
;
83
84
menu
();
85
~
menu
();
86
89
menu
(
const
uistring
& text);
90
92
menu
& append(
const
item
& i);
93
menu
&
operator<<
(
const
item
& i)
94
{
return
append(i); }
96
98
menu
& append(
const
menu
& i);
99
menu
&
operator<<
(
const
menu
& i)
100
{
return
append(i); }
102
104
menu
& append(
const
separator
& i);
105
menu
&
operator<<
(
const
separator
& i)
106
{
return
append(i); }
108
112
void
popup(
widget
& w);
113
115
typedef
void
*
native_handle_type
;
116
118
native_handle_type
native_handle
() {
return
m_impl; }
119
const
native_handle_type
native_handle
()
const
{
return
m_impl; }
121
122
private
:
123
class
native_impl;
124
native_impl* m_impl;
125
126
mutable
detail::shared_count m_shared_count;
127
128
#ifndef DOXYGEN
129
friend
class
menu_bar::native_impl;
130
#endif
131
};
132
135
136
class
BOOST_UI_DECL
menu
::
item
:
private
boost::noncopyable
137
{
138
public
:
141
item
(
const
uistring
& text);
142
144
BOOST_UI_DETAIL_HANDLER(press,
item
);
145
147
typedef
void
*
native_handle_type
;
148
150
native_handle_type
native_handle
() {
return
m_impl; }
151
const
native_handle_type
native_handle
()
const
{
return
m_impl; }
153
154
private
:
155
void
on_press_raw(
const
boost::function<
void
()>& handler);
156
157
class
native_impl;
158
native_impl* m_impl;
159
160
#ifndef DOXYGEN
161
friend
class
menu
;
162
#endif
163
};
164
165
}
// namespace ui
166
}
// namespace boost
167
168
#endif // BOOST_UI_MENU_HPP
boost::ui::menu::native_handle
const native_handle_type native_handle() const
Returns the implementation-defined underlying menu handle.
Definition:
menu.hpp:119
boost::ui::uistring
Helper class to convert string between UI and application logic only.
Definition:
string.hpp:49
boost::ui::menu_bar::operator<<
menu_bar & operator<<(const menu &i)
Appends menu as subitem.
Definition:
menu.hpp:53
boost::ui::menu::item::native_handle
const native_handle_type native_handle() const
Returns the implementation-defined underlying menu item handle.
Definition:
menu.hpp:151
config.hpp
Configuration options.
widget.hpp
Widget class.
boost::ui::menu::item
Menu item.
Definition:
menu.hpp:136
boost::ui::menu_bar::native_handle
const native_handle_type native_handle() const
Returns the implementation-defined underlying menu bar handle.
Definition:
menu.hpp:62
boost
Boost C++ libraries namespace.
Definition:
window.hpp:19
boost::ui::menu::operator<<
menu & operator<<(const item &i)
Appends menu item as subitem.
Definition:
menu.hpp:93
boost::ui::menu::operator<<
menu & operator<<(const menu &i)
Appends menu as subitem.
Definition:
menu.hpp:99
boost::ui::menu::item::native_handle_type
void * native_handle_type
Implementation-defined menu item type.
Definition:
menu.hpp:147
boost::ui::menu
Menu (list of commands) class.
Definition:
menu.hpp:79
boost::ui::menu::native_handle_type
void * native_handle_type
Implementation-defined menu type.
Definition:
menu.hpp:115
boost::ui::menu::native_handle
native_handle_type native_handle()
Returns the implementation-defined underlying menu handle.
Definition:
menu.hpp:118
boost::ui::frame
Top level widget that hosts other widgets and supports menu bar.
Definition:
frame.hpp:31
boost::ui::menu_bar::native_handle_type
void * native_handle_type
Implementation-defined menu bar type.
Definition:
menu.hpp:58
boost::ui::menu::operator<<
menu & operator<<(const separator &i)
Appends separator.
Definition:
menu.hpp:105
boost::ui::menu::item::native_handle
native_handle_type native_handle()
Returns the implementation-defined underlying menu item handle.
Definition:
menu.hpp:150
boost::ui::widget
Base class for all widgets.
Definition:
widget.hpp:45
boost::ui::menu_bar::native_handle
native_handle_type native_handle()
Returns the implementation-defined underlying menu bar handle.
Definition:
menu.hpp:61
boost::ui::menu_bar
Menu bar class.
Definition:
menu.hpp:41
boost::ui::separator
Pseudo class that separates menu items.
Definition:
menu.hpp:29
Generated by