aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-08-04 04:59:14 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-08-04 04:59:14 (GMT)
commit797038823815f446c25d191837e63a022209641d (patch)
treebc8f39dc91c182c538fa541cb29d29964b15ac8f /src/FbTk
parent0688816d11e1fbd5576197f39f949ead687101d9 (diff)
downloadfluxbox-797038823815f446c25d191837e63a022209641d.zip
fluxbox-797038823815f446c25d191837e63a022209641d.tar.bz2
add selection box to various "choose one of these" menu items
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/RadioMenuItem.hh63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/FbTk/RadioMenuItem.hh b/src/FbTk/RadioMenuItem.hh
new file mode 100644
index 0000000..ddd2274
--- /dev/null
+++ b/src/FbTk/RadioMenuItem.hh
@@ -0,0 +1,63 @@
1// RadioMenuItem.hh
2// Copyright (c) 2008 Fluxbox Team (fluxgen at fluxbox dot org)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22#ifndef FBTK_RADIOMENUITEM_HH
23#define FBTK_RADIOMENUITEM_HH
24
25#include "MenuItem.hh"
26
27namespace FbTk {
28
29class RadioMenuItem: public MenuItem {
30public:
31 RadioMenuItem(): MenuItem() { setToggleItem(true); }
32
33 explicit RadioMenuItem(const FbString &label):
34 MenuItem(label) {
35 setToggleItem(true);
36 }
37
38 RadioMenuItem(const FbString &label, Menu &host_menu):
39 MenuItem(label, host_menu) {
40 setToggleItem(true);
41 }
42
43 /// create a menu item with a specific command to be executed on click
44 RadioMenuItem(const FbString &label, RefCount<Command<void> > &cmd,
45 Menu *menu = 0):
46 MenuItem(label, cmd, menu) {
47 setToggleItem(true);
48 }
49
50 RadioMenuItem(const FbString &label, Menu *submenu, Menu *host_menu = 0):
51 MenuItem(label, submenu, host_menu) {
52 setToggleItem(true);
53 }
54
55 virtual ~RadioMenuItem() { }
56
57 virtual bool isSelected() const = 0;
58 bool isEnabled() const { return !isSelected(); }
59};
60
61} // end namespace FbTk
62
63#endif // FBTK_RADIOMENUITEM_HH