aboutsummaryrefslogtreecommitdiff
path: root/src/BoolMenuItem.hh
diff options
context:
space:
mode:
authorsimonb <simonb>2007-01-07 11:55:14 (GMT)
committersimonb <simonb>2007-01-07 11:55:14 (GMT)
commit1cc7b60aa2c2e7a26f9ff6f1461ca0b8a97be8de (patch)
tree1de2b149b23e589a36c81bd2aa51092db7b6e190 /src/BoolMenuItem.hh
parentcfd33dd7a8f392253d8af9f418d86dc3083fc27d (diff)
downloadfluxbox_pavel-1cc7b60aa2c2e7a26f9ff6f1461ca0b8a97be8de.zip
fluxbox_pavel-1cc7b60aa2c2e7a26f9ff6f1461ca0b8a97be8de.tar.bz2
per-window transparency, including apps and menu support, plus some
infrastructure and related changes. Thanks for original patch from Julien Trolet, dmxen at sourceforge dot net
Diffstat (limited to 'src/BoolMenuItem.hh')
-rw-r--r--src/BoolMenuItem.hh29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/BoolMenuItem.hh b/src/BoolMenuItem.hh
index 914185d..29eef15 100644
--- a/src/BoolMenuItem.hh
+++ b/src/BoolMenuItem.hh
@@ -38,6 +38,7 @@ public:
38 BoolMenuItem(const FbTk::FbString &label, bool &item): 38 BoolMenuItem(const FbTk::FbString &label, bool &item):
39 FbTk::MenuItem(label), m_item(item) { 39 FbTk::MenuItem(label), m_item(item) {
40 FbTk::MenuItem::setSelected(m_item); 40 FbTk::MenuItem::setSelected(m_item);
41 setToggleItem(true);
41 } 42 }
42 bool isSelected() const { return m_item; } 43 bool isSelected() const { return m_item; }
43 // toggle state 44 // toggle state
@@ -50,4 +51,30 @@ private:
50 bool &m_item; 51 bool &m_item;
51}; 52};
52 53
53#endif // BOOLRESMENUITEM_HH 54/// a bool menu item
55template <typename Type>
56class BoolResMenuItem: public FbTk::MenuItem {
57public:
58 BoolResMenuItem(const FbTk::FbString &label, Type &res,
59 FbTk::RefCount<FbTk::Command> &cmd):
60 FbTk::MenuItem(label, cmd), m_res(res) {
61 FbTk::MenuItem::setSelected(*m_res);
62 setToggleItem(true);
63 }
64 BoolResMenuItem(const FbTk::FbString &label, Type &res):
65 FbTk::MenuItem(label), m_res(res) {
66 FbTk::MenuItem::setSelected(*m_res);
67 setToggleItem(true);
68 }
69 bool isSelected() const { return *m_res; }
70 // toggle state
71 void click(int button, int time) { setSelected(!*m_res); FbTk::MenuItem::click(button, time); }
72 void setSelected(bool value) {
73 m_res = value;
74 FbTk::MenuItem::setSelected(*m_res);
75 }
76private:
77 Type &m_res;
78};
79
80#endif // BOOLMENUITEM_HH