summaryrefslogtreecommitdiff
path: root/src
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
parent0688816d11e1fbd5576197f39f949ead687101d9 (diff)
downloadfluxbox_lack-797038823815f446c25d191837e63a022209641d.zip
fluxbox_lack-797038823815f446c25d191837e63a022209641d.tar.bz2
add selection box to various "choose one of these" menu items
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/RadioMenuItem.hh63
-rw-r--r--src/FocusModelMenuItem.hh18
-rw-r--r--src/IconbarTool.cc18
-rw-r--r--src/LayerMenu.hh12
-rw-r--r--src/Screen.cc9
-rw-r--r--src/Slit.cc11
-rw-r--r--src/StyleMenuItem.cc2
-rw-r--r--src/StyleMenuItem.hh4
-rw-r--r--src/Toolbar.cc25
-rw-r--r--src/Xinerama.hh12
10 files changed, 122 insertions, 52 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
diff --git a/src/FocusModelMenuItem.hh b/src/FocusModelMenuItem.hh
index d75e8a0..7541659 100644
--- a/src/FocusModelMenuItem.hh
+++ b/src/FocusModelMenuItem.hh
@@ -24,7 +24,7 @@
24#define FOCUSMODELMENUITEM_HH 24#define FOCUSMODELMENUITEM_HH
25 25
26 26
27#include "FbTk/MenuItem.hh" 27#include "FbTk/RadioMenuItem.hh"
28#include "FbTk/RefCount.hh" 28#include "FbTk/RefCount.hh"
29 29
30namespace FbTk { 30namespace FbTk {
@@ -33,22 +33,22 @@ template <class T> class Command;
33 33
34#include "FocusControl.hh" 34#include "FocusControl.hh"
35 35
36class FocusModelMenuItem : public FbTk::MenuItem { 36class FocusModelMenuItem : public FbTk::RadioMenuItem {
37public: 37public:
38 FocusModelMenuItem(const FbTk::FbString &label, FocusControl &focus_control, 38 FocusModelMenuItem(const FbTk::FbString &label, FocusControl &focus_control,
39 FocusControl::FocusModel model, 39 FocusControl::FocusModel model,
40 FbTk::RefCount<FbTk::Command<void> > &cmd): 40 FbTk::RefCount<FbTk::Command<void> > &cmd):
41 FbTk::MenuItem(label, cmd), 41 FbTk::RadioMenuItem(label, cmd),
42 m_focus_control(focus_control), 42 m_focus_control(focus_control),
43 m_focusmodel(model) { 43 m_focusmodel(model) {
44 setCloseOnClick(false); 44 setCloseOnClick(false);
45 } 45 }
46 46
47 bool isEnabled() const { return m_focus_control.focusModel() != m_focusmodel; } 47 bool isSelected() const { return m_focus_control.focusModel() == m_focusmodel; }
48 48
49 void click(int button, int time, unsigned int mods) { 49 void click(int button, int time, unsigned int mods) {
50 m_focus_control.setFocusModel(m_focusmodel); 50 m_focus_control.setFocusModel(m_focusmodel);
51 FbTk::MenuItem::click(button, time, mods); 51 FbTk::RadioMenuItem::click(button, time, mods);
52 } 52 }
53 53
54private: 54private:
@@ -56,23 +56,23 @@ private:
56 FocusControl::FocusModel m_focusmodel; 56 FocusControl::FocusModel m_focusmodel;
57}; 57};
58 58
59class TabFocusModelMenuItem : public FbTk::MenuItem { 59class TabFocusModelMenuItem : public FbTk::RadioMenuItem {
60public: 60public:
61 TabFocusModelMenuItem(const FbTk::FbString &label, 61 TabFocusModelMenuItem(const FbTk::FbString &label,
62 FocusControl &focus_control, 62 FocusControl &focus_control,
63 FocusControl::TabFocusModel model, 63 FocusControl::TabFocusModel model,
64 FbTk::RefCount<FbTk::Command<void> > &cmd): 64 FbTk::RefCount<FbTk::Command<void> > &cmd):
65 FbTk::MenuItem(label, cmd), 65 FbTk::RadioMenuItem(label, cmd),
66 m_focus_control(focus_control), 66 m_focus_control(focus_control),
67 m_tabfocusmodel(model) { 67 m_tabfocusmodel(model) {
68 setCloseOnClick(false); 68 setCloseOnClick(false);
69 } 69 }
70 70
71 bool isEnabled() const { return m_focus_control.tabFocusModel() != m_tabfocusmodel; } 71 bool isSelected() const { return m_focus_control.tabFocusModel() == m_tabfocusmodel; }
72 72
73 void click(int button, int time, unsigned int mods) { 73 void click(int button, int time, unsigned int mods) {
74 m_focus_control.setTabFocusModel(m_tabfocusmodel); 74 m_focus_control.setTabFocusModel(m_tabfocusmodel);
75 FbTk::MenuItem::click(button, time, mods); 75 FbTk::RadioMenuItem::click(button, time, mods);
76 } 76 }
77 77
78private: 78private:
diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc
index b6e2900..f2ed082 100644
--- a/src/IconbarTool.cc
+++ b/src/IconbarTool.cc
@@ -39,7 +39,7 @@
39#include "FbTk/STLUtil.hh" 39#include "FbTk/STLUtil.hh"
40#include "FbTk/I18n.hh" 40#include "FbTk/I18n.hh"
41#include "FbTk/Menu.hh" 41#include "FbTk/Menu.hh"
42#include "FbTk/MenuItem.hh" 42#include "FbTk/RadioMenuItem.hh"
43#include "FbTk/BoolMenuItem.hh" 43#include "FbTk/BoolMenuItem.hh"
44#include "FbTk/RefCount.hh" 44#include "FbTk/RefCount.hh"
45#include "FbTk/SimpleCommand.hh" 45#include "FbTk/SimpleCommand.hh"
@@ -99,18 +99,18 @@ void FbTk::Resource<FbTk::Container::Alignment>::setFromString(const char *str)
99 99
100namespace { 100namespace {
101 101
102class ToolbarModeMenuItem : public FbTk::MenuItem { 102class ToolbarModeMenuItem : public FbTk::RadioMenuItem {
103public: 103public:
104 ToolbarModeMenuItem(const FbTk::FbString &label, IconbarTool &handler, 104 ToolbarModeMenuItem(const FbTk::FbString &label, IconbarTool &handler,
105 string mode, 105 string mode,
106 FbTk::RefCount<FbTk::Command<void> > &cmd): 106 FbTk::RefCount<FbTk::Command<void> > &cmd):
107 FbTk::MenuItem(label, cmd), m_handler(handler), m_mode(mode) { 107 FbTk::RadioMenuItem(label, cmd), m_handler(handler), m_mode(mode) {
108 setCloseOnClick(false); 108 setCloseOnClick(false);
109 } 109 }
110 bool isEnabled() const { return m_handler.mode() != m_mode; } 110 bool isSelected() const { return m_handler.mode() == m_mode; }
111 void click(int button, int time, unsigned int mods) { 111 void click(int button, int time, unsigned int mods) {
112 m_handler.setMode(m_mode); 112 m_handler.setMode(m_mode);
113 FbTk::MenuItem::click(button, time, mods); 113 FbTk::RadioMenuItem::click(button, time, mods);
114 } 114 }
115 115
116private: 116private:
@@ -118,18 +118,18 @@ private:
118 string m_mode; 118 string m_mode;
119}; 119};
120 120
121class ToolbarAlignMenuItem: public FbTk::MenuItem { 121class ToolbarAlignMenuItem: public FbTk::RadioMenuItem {
122public: 122public:
123 ToolbarAlignMenuItem(const FbTk::FbString &label, IconbarTool &handler, 123 ToolbarAlignMenuItem(const FbTk::FbString &label, IconbarTool &handler,
124 FbTk::Container::Alignment mode, 124 FbTk::Container::Alignment mode,
125 FbTk::RefCount<FbTk::Command<void> > &cmd): 125 FbTk::RefCount<FbTk::Command<void> > &cmd):
126 FbTk::MenuItem(label, cmd), m_handler(handler), m_mode(mode) { 126 FbTk::RadioMenuItem(label, cmd), m_handler(handler), m_mode(mode) {
127 setCloseOnClick(false); 127 setCloseOnClick(false);
128 } 128 }
129 bool isEnabled() const { return m_handler.alignment() != m_mode; } 129 bool isSelected() const { return m_handler.alignment() == m_mode; }
130 void click(int button, int time, unsigned int mods) { 130 void click(int button, int time, unsigned int mods) {
131 m_handler.setAlignment(m_mode); 131 m_handler.setAlignment(m_mode);
132 FbTk::MenuItem::click(button, time, mods); 132 FbTk::RadioMenuItem::click(button, time, mods);
133 } 133 }
134 134
135private: 135private:
diff --git a/src/LayerMenu.hh b/src/LayerMenu.hh
index 8de0eba..40e934c 100644
--- a/src/LayerMenu.hh
+++ b/src/LayerMenu.hh
@@ -26,7 +26,7 @@
26 26
27#include "ToggleMenu.hh" 27#include "ToggleMenu.hh"
28 28
29#include "FbTk/MenuItem.hh" 29#include "FbTk/RadioMenuItem.hh"
30 30
31class LayerObject { 31class LayerObject {
32public: 32public:
@@ -37,20 +37,20 @@ public:
37 37
38 38
39/// this class holds the layermenu items 39/// this class holds the layermenu items
40class LayerMenuItem : public FbTk::MenuItem { 40class LayerMenuItem : public FbTk::RadioMenuItem {
41public: 41public:
42 LayerMenuItem(const FbTk::FbString &label, LayerObject *object, 42 LayerMenuItem(const FbTk::FbString &label, LayerObject *object,
43 int layernum, FbTk::RefCount<FbTk::Command<void> > &cmd): 43 int layernum, FbTk::RefCount<FbTk::Command<void> > &cmd):
44 FbTk::MenuItem(label, cmd), m_object(object), m_layernum(layernum) {} 44 FbTk::RadioMenuItem(label, cmd), m_object(object), m_layernum(layernum) {}
45 45
46 LayerMenuItem(const FbTk::FbString &label, LayerObject *object, 46 LayerMenuItem(const FbTk::FbString &label, LayerObject *object,
47 int layernum): 47 int layernum):
48 FbTk::MenuItem(label), m_object(object), m_layernum(layernum) {} 48 FbTk::RadioMenuItem(label), m_object(object), m_layernum(layernum) {}
49 49
50 bool isEnabled() const { return m_object->layerNumber() != m_layernum; } 50 bool isSelected() const { return m_object->layerNumber() == m_layernum; }
51 void click(int button, int time, unsigned int mods) { 51 void click(int button, int time, unsigned int mods) {
52 m_object->moveToLayer(m_layernum); 52 m_object->moveToLayer(m_layernum);
53 FbTk::MenuItem::click(button, time, mods); 53 FbTk::RadioMenuItem::click(button, time, mods);
54 } 54 }
55 55
56private: 56private:
diff --git a/src/Screen.cc b/src/Screen.cc
index 658252b..838a313 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -38,6 +38,7 @@
38#include "FbTk/BoolMenuItem.hh" 38#include "FbTk/BoolMenuItem.hh"
39#include "FbTk/IntMenuItem.hh" 39#include "FbTk/IntMenuItem.hh"
40#include "FocusModelMenuItem.hh" 40#include "FocusModelMenuItem.hh"
41#include "RadioMenuItem.hh"
41 42
42// menus 43// menus
43#include "FbMenu.hh" 44#include "FbMenu.hh"
@@ -174,21 +175,21 @@ int anotherWMRunning(Display *display, XErrorEvent *) {
174} 175}
175 176
176 177
177class TabPlacementMenuItem: public FbTk::MenuItem { 178class TabPlacementMenuItem: public FbTk::RadioMenuItem {
178public: 179public:
179 TabPlacementMenuItem(FbTk::FbString & label, BScreen &screen, 180 TabPlacementMenuItem(FbTk::FbString & label, BScreen &screen,
180 FbWinFrame::TabPlacement place, 181 FbWinFrame::TabPlacement place,
181 FbTk::RefCount<FbTk::Command<void> > &cmd): 182 FbTk::RefCount<FbTk::Command<void> > &cmd):
182 FbTk::MenuItem(label, cmd), 183 FbTk::RadioMenuItem(label, cmd),
183 m_screen(screen), 184 m_screen(screen),
184 m_place(place) { 185 m_place(place) {
185 setCloseOnClick(false); 186 setCloseOnClick(false);
186 } 187 }
187 188
188 bool isEnabled() const { return m_screen.getTabPlacement() != m_place; } 189 bool isSelected() const { return m_screen.getTabPlacement() == m_place; }
189 void click(int button, int time, unsigned int mods) { 190 void click(int button, int time, unsigned int mods) {
190 m_screen.saveTabPlacement(m_place); 191 m_screen.saveTabPlacement(m_place);
191 FbTk::MenuItem::click(button, time, mods); 192 FbTk::RadioMenuItem::click(button, time, mods);
192 } 193 }
193 194
194 195
diff --git a/src/Slit.cc b/src/Slit.cc
index ecd8280..20b86d6 100644
--- a/src/Slit.cc
+++ b/src/Slit.cc
@@ -57,6 +57,7 @@
57#include "FbTk/I18n.hh" 57#include "FbTk/I18n.hh"
58#include "FbTk/BoolMenuItem.hh" 58#include "FbTk/BoolMenuItem.hh"
59#include "FbTk/IntMenuItem.hh" 59#include "FbTk/IntMenuItem.hh"
60#include "FbTk/RadioMenuItem.hh"
60 61
61#ifdef HAVE_SYS_STAT_H 62#ifdef HAVE_SYS_STAT_H
62#include <sys/types.h> 63#include <sys/types.h>
@@ -236,16 +237,16 @@ private:
236 string m_label; 237 string m_label;
237}; 238};
238 239
239class PlaceSlitMenuItem: public FbTk::MenuItem { 240class PlaceSlitMenuItem: public FbTk::RadioMenuItem {
240public: 241public:
241 PlaceSlitMenuItem(const FbTk::FbString &label, Slit &slit, Slit::Placement place, FbTk::RefCount<FbTk::Command<void> > &cmd): 242 PlaceSlitMenuItem(const FbTk::FbString &label, Slit &slit, Slit::Placement place, FbTk::RefCount<FbTk::Command<void> > &cmd):
242 FbTk::MenuItem(label, cmd), m_slit(slit), m_place(place) { 243 FbTk::RadioMenuItem(label, cmd), m_slit(slit), m_place(place) {
243 setCloseOnClick(false); 244 setCloseOnClick(false);
244 } 245 }
245 bool isEnabled() const { return m_slit.placement() != m_place; } 246 bool isSelected() const { return m_slit.placement() == m_place; }
246 void click(int button, int time, unsigned int mods) { 247 void click(int button, int time, unsigned int mods) {
247 m_slit.setPlacement(m_place); 248 m_slit.setPlacement(m_place);
248 FbTk::MenuItem::click(button, time, mods); 249 FbTk::RadioMenuItem::click(button, time, mods);
249 } 250 }
250private: 251private:
251 Slit &m_slit; 252 Slit &m_slit;
@@ -1291,7 +1292,7 @@ void Slit::setupMenu() {
1291 1292
1292 m_slitmenu.insert(alpha_menuitem); 1293 m_slitmenu.insert(alpha_menuitem);
1293 1294
1294 m_slitmenu.insert(new SlitDirMenuItem(_FB_XTEXT(Slit, Direction, "Slit Direction", "Orientation of slit"), 1295 m_slitmenu.insert(new SlitDirMenuItem(_FB_XTEXT(Slit, Direction, "Slit Direction:", "Orientation of slit"),
1295 *this, 1296 *this,
1296 save_and_reconfigure)); 1297 save_and_reconfigure));
1297 m_slitmenu.insert(_FB_XTEXT(Slit, ClientsMenu, "Clients", "Slit client menu"), &m_clientlist_menu); 1298 m_slitmenu.insert(_FB_XTEXT(Slit, ClientsMenu, "Clients", "Slit client menu"), &m_clientlist_menu);
diff --git a/src/StyleMenuItem.cc b/src/StyleMenuItem.cc
index 628935d..8e557a7 100644
--- a/src/StyleMenuItem.cc
+++ b/src/StyleMenuItem.cc
@@ -28,7 +28,7 @@
28#include "FbTk/StringUtil.hh" 28#include "FbTk/StringUtil.hh"
29 29
30StyleMenuItem::StyleMenuItem(const FbTk::FbString &label, const std::string &filename): 30StyleMenuItem::StyleMenuItem(const FbTk::FbString &label, const std::string &filename):
31 FbTk::MenuItem(label), 31 FbTk::RadioMenuItem(label),
32 m_filename(filename) { 32 m_filename(filename) {
33 // perform shell style ~ home directory expansion 33 // perform shell style ~ home directory expansion
34 // and insert style 34 // and insert style
diff --git a/src/StyleMenuItem.hh b/src/StyleMenuItem.hh
index d918432..3c0c8ac 100644
--- a/src/StyleMenuItem.hh
+++ b/src/StyleMenuItem.hh
@@ -23,9 +23,9 @@
23#ifndef STYLEMENUITEM_HH 23#ifndef STYLEMENUITEM_HH
24#define STYLEMENUITEM_HH 24#define STYLEMENUITEM_HH
25 25
26#include "FbTk/MenuItem.hh" 26#include "FbTk/RadioMenuItem.hh"
27 27
28class StyleMenuItem: public FbTk::MenuItem { 28class StyleMenuItem: public FbTk::RadioMenuItem {
29public: 29public:
30 StyleMenuItem(const FbTk::FbString &label, const std::string &filename); 30 StyleMenuItem(const FbTk::FbString &label, const std::string &filename);
31 bool isSelected() const; 31 bool isSelected() const;
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index 540ceb9..440eff5 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -156,16 +156,22 @@ getString() const {
156} // end namespace FbTk 156} // end namespace FbTk
157 157
158namespace { 158namespace {
159class SetToolbarPlacementCmd: public FbTk::Command<void> { 159
160class PlaceToolbarMenuItem: public FbTk::RadioMenuItem {
160public: 161public:
161 SetToolbarPlacementCmd(Toolbar &tbar, Toolbar::Placement place):m_tbar(tbar), m_place(place) { } 162 PlaceToolbarMenuItem(const FbTk::FbString &label, Toolbar &toolbar,
162 void execute() { 163 Toolbar::Placement place):
163 m_tbar.setPlacement(m_place); 164 FbTk::RadioMenuItem(label), m_toolbar(toolbar), m_place(place) {
164 m_tbar.reconfigure(); 165 setCloseOnClick(false);
166 }
167 bool isSelected() const { return m_toolbar.placement() == m_place; }
168 void click(int button, int time, unsigned int mods) {
169 m_toolbar.setPlacement(m_place);
170 m_toolbar.reconfigure();
165 Fluxbox::instance()->save_rc(); 171 Fluxbox::instance()->save_rc();
166 } 172 }
167private: 173private:
168 Toolbar &m_tbar; 174 Toolbar &m_toolbar;
169 Toolbar::Placement m_place; 175 Toolbar::Placement m_place;
170}; 176};
171 177
@@ -909,11 +915,10 @@ void Toolbar::setupMenus(bool skip_new_placement) {
909 if (str == "") { 915 if (str == "") {
910 placementMenu().insert(""); 916 placementMenu().insert("");
911 placementMenu().setItemEnabled(i, false); 917 placementMenu().setItemEnabled(i, false);
912 } else { 918 } else
913 RefCommand setplace(new SetToolbarPlacementCmd(*this, placement)); 919 placementMenu().insert(new PlaceToolbarMenuItem(str, *this,
914 placementMenu().insert(str, setplace); 920 placement));
915 921
916 }
917 place_menu.pop_front(); 922 place_menu.pop_front();
918 } 923 }
919 } 924 }
diff --git a/src/Xinerama.hh b/src/Xinerama.hh
index eab2e37..876005f 100644
--- a/src/Xinerama.hh
+++ b/src/Xinerama.hh
@@ -29,7 +29,7 @@
29 29
30#include "FbTk/RefCount.hh" 30#include "FbTk/RefCount.hh"
31#include "FbTk/SimpleCommand.hh" 31#include "FbTk/SimpleCommand.hh"
32#include "FbTk/MenuItem.hh" 32#include "FbTk/RadioMenuItem.hh"
33 33
34// provides a generic way for giving an object a xinerama head menu 34// provides a generic way for giving an object a xinerama head menu
35// The object must have two functions: 35// The object must have two functions:
@@ -38,18 +38,18 @@
38 38
39/// this class holds the xinerama items 39/// this class holds the xinerama items
40template <typename ItemType> 40template <typename ItemType>
41class XineramaHeadMenuItem : public FbTk::MenuItem { 41class XineramaHeadMenuItem : public FbTk::RadioMenuItem {
42public: 42public:
43 XineramaHeadMenuItem(const FbTk::FbString &label, ItemType &object, int headnum, 43 XineramaHeadMenuItem(const FbTk::FbString &label, ItemType &object, int headnum,
44 FbTk::RefCount<FbTk::Command<void> > &cmd): 44 FbTk::RefCount<FbTk::Command<void> > &cmd):
45 FbTk::MenuItem(label,cmd), m_object(object), m_headnum(headnum) {} 45 FbTk::RadioMenuItem(label,cmd), m_object(object), m_headnum(headnum) {}
46 XineramaHeadMenuItem(const FbTk::FbString &label, ItemType &object, int headnum): 46 XineramaHeadMenuItem(const FbTk::FbString &label, ItemType &object, int headnum):
47 FbTk::MenuItem(label), m_object(object), m_headnum(headnum) {} 47 FbTk::RadioMenuItem(label), m_object(object), m_headnum(headnum) {}
48 48
49 bool isEnabled() const { return m_object.getOnHead() != m_headnum; } 49 bool isSelected() const { return m_object.getOnHead() == m_headnum; }
50 void click(int button, int time, unsigned int mods) { 50 void click(int button, int time, unsigned int mods) {
51 m_object.saveOnHead(m_headnum); 51 m_object.saveOnHead(m_headnum);
52 FbTk::MenuItem::click(button, time, mods); 52 FbTk::RadioMenuItem::click(button, time, mods);
53 } 53 }
54 54
55private: 55private: