aboutsummaryrefslogtreecommitdiff
path: root/src/WindowCmd.hh
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-05-28 09:32:57 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-05-28 09:32:57 (GMT)
commit467fefaae453e0c1eae0340f1d1d7d89eafd3e22 (patch)
treed0dfbeae07795965a27a860adb8f1fe65ab0b57c /src/WindowCmd.hh
parent130012c01056250e969d02bc82a26e4a28899e1a (diff)
downloadfluxbox_pavel-467fefaae453e0c1eae0340f1d1d7d89eafd3e22.zip
fluxbox_pavel-467fefaae453e0c1eae0340f1d1d7d89eafd3e22.tar.bz2
more more fun with the window menu
Diffstat (limited to 'src/WindowCmd.hh')
-rw-r--r--src/WindowCmd.hh45
1 files changed, 0 insertions, 45 deletions
diff --git a/src/WindowCmd.hh b/src/WindowCmd.hh
index f979f2b..34699ad 100644
--- a/src/WindowCmd.hh
+++ b/src/WindowCmd.hh
@@ -63,49 +63,4 @@ private:
63 Action m_action; 63 Action m_action;
64}; 64};
65 65
66/// accesses values in current window
67template <typename Ret, typename Def=Ret>
68class WindowAccessor: public FbTk::Accessor<Ret> {
69public:
70 typedef Ret (FluxboxWindow:: *Getter)() const;
71 typedef void (FluxboxWindow:: *Setter)(Ret);
72 WindowAccessor(Getter g, Setter s, Def def):
73 m_getter(g), m_setter(s), m_def(def) { }
74
75 operator Ret() const {
76 FluxboxWindow *fbwin = WindowCmd<void>::window();
77 return fbwin ? (fbwin->*m_getter)() : m_def;
78 }
79 FbTk::Accessor<Ret> &operator =(const Ret &val) {
80 FluxboxWindow *fbwin = WindowCmd<void>::window();
81 if (fbwin)
82 (fbwin->*m_setter)(val);
83 return *this;
84 }
85
86private:
87 Getter m_getter;
88 Setter m_setter;
89 Def m_def;
90};
91
92/// same as above but only reads
93template <typename Ret, typename Def=Ret>
94class ConstWindowAccessor: public FbTk::Accessor<Ret> {
95public:
96 typedef Ret (FluxboxWindow:: *Getter)() const;
97 ConstWindowAccessor(Getter g, Def def):
98 m_getter(g), m_def(def) { }
99
100 operator Ret() const {
101 FluxboxWindow *fbwin = WindowCmd<void>::window();
102 return fbwin ? (fbwin->*m_getter)() : m_def;
103 }
104 FbTk::Accessor<Ret> &operator =(const Ret &val) { return *this; }
105
106private:
107 Getter m_getter;
108 Def m_def;
109};
110
111#endif // WINDOWCMD_HH 66#endif // WINDOWCMD_HH