aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/BoolMenuItem.hh52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/BoolMenuItem.hh b/src/BoolMenuItem.hh
new file mode 100644
index 0000000..050d5cf
--- /dev/null
+++ b/src/BoolMenuItem.hh
@@ -0,0 +1,52 @@
1// BoolMenuItem.hh for Fluxbox Window Manager
2// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
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// $Id: BoolMenuItem.hh,v 1.1 2003/01/12 18:15:23 fluxgen Exp $
23
24#ifndef BOOLMENUITEM_HH
25#define BOOLMENUITEM_HH
26
27#include "MenuItem.hh"
28
29/// a bool menu item
30class BoolMenuItem: public FbTk::MenuItem {
31public:
32 BoolMenuItem(const char *label, bool &item,
33 FbTk::RefCount<FbTk::Command> &cmd):
34 FbTk::MenuItem(label, cmd), m_item(item) {
35 FbTk::MenuItem::setSelected(m_item);
36 }
37 BoolMenuItem(const char *label, bool &item):
38 FbTk::MenuItem(label), m_item(item) {
39 FbTk::MenuItem::setSelected(m_item);
40 }
41 bool isSelected() const { return m_item; }
42 // toggle state
43 void click(int button, int time) { setSelected(!m_item); FbTk::MenuItem::click(button, time); }
44 void setSelected(bool value) {
45 m_item = value;
46 FbTk::MenuItem::setSelected(m_item);
47 }
48private:
49 bool &m_item;
50};
51
52#endif // BOOLRESMENUITEM_HH