aboutsummaryrefslogtreecommitdiff
path: root/src/BoolMenuItem.hh
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2007-12-27 21:55:24 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2007-12-27 21:55:24 (GMT)
commitb5c354b994bc06667abe35e2d528c0f025703c4e (patch)
tree081fd3207053a06cb50931ccec3237bc614f10eb /src/BoolMenuItem.hh
parent1f5cd12facc662de240b36bf3c5c14f40adf391b (diff)
downloadfluxbox_paul-b5c354b994bc06667abe35e2d528c0f025703c4e.zip
fluxbox_paul-b5c354b994bc06667abe35e2d528c0f025703c4e.tar.bz2
architecture astronomy
Diffstat (limited to 'src/BoolMenuItem.hh')
-rw-r--r--src/BoolMenuItem.hh90
1 files changed, 0 insertions, 90 deletions
diff --git a/src/BoolMenuItem.hh b/src/BoolMenuItem.hh
deleted file mode 100644
index 03f6fb3..0000000
--- a/src/BoolMenuItem.hh
+++ /dev/null
@@ -1,90 +0,0 @@
1// BoolMenuItem.hh for Fluxbox Window Manager
2// Copyright (c) 2003 - 2006 Henrik Kinnunen (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// $Id$
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 FbTk::FbString &label, bool &item,
33 FbTk::RefCount<FbTk::Command> &cmd):
34 FbTk::MenuItem(label, cmd), m_item(item) {
35 FbTk::MenuItem::setSelected(m_item);
36 setToggleItem(true);
37 setCloseOnClick(false);
38 }
39 BoolMenuItem(const FbTk::FbString &label, bool &item):
40 FbTk::MenuItem(label), m_item(item) {
41 FbTk::MenuItem::setSelected(m_item);
42 setToggleItem(true);
43 setCloseOnClick(false);
44 }
45 bool isSelected() const { return m_item; }
46 // toggle state
47 void click(int button, int time, unsigned int mods) {
48 setSelected(!m_item);
49 FbTk::MenuItem::click(button, time, mods);
50 }
51 void setSelected(bool value) {
52 m_item = value;
53 FbTk::MenuItem::setSelected(m_item);
54 }
55private:
56 bool &m_item;
57};
58
59/// a bool menu item
60template <typename Type>
61class BoolResMenuItem: public FbTk::MenuItem {
62public:
63 BoolResMenuItem(const FbTk::FbString &label, Type &res,
64 FbTk::RefCount<FbTk::Command> &cmd):
65 FbTk::MenuItem(label, cmd), m_res(res) {
66 FbTk::MenuItem::setSelected(*m_res);
67 setToggleItem(true);
68 setCloseOnClick(false);
69 }
70 BoolResMenuItem(const FbTk::FbString &label, Type &res):
71 FbTk::MenuItem(label), m_res(res) {
72 FbTk::MenuItem::setSelected(*m_res);
73 setToggleItem(true);
74 setCloseOnClick(false);
75 }
76 bool isSelected() const { return *m_res; }
77 // toggle state
78 void click(int button, int time, unsigned int mods) {
79 setSelected(!*m_res);
80 FbTk::MenuItem::click(button, time, mods);
81 }
82 void setSelected(bool value) {
83 m_res = value;
84 FbTk::MenuItem::setSelected(*m_res);
85 }
86private:
87 Type &m_res;
88};
89
90#endif // BOOLMENUITEM_HH