aboutsummaryrefslogtreecommitdiff
path: root/src/WindowCmd.hh
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2005-06-23 02:57:24 (GMT)
committerfluxgen <fluxgen>2005-06-23 02:57:24 (GMT)
commit18cf5862495aa6f37110c90286bb6c315a145526 (patch)
treef3c87373e0ce215ec4cbe7fb854859a78c2bb3cf /src/WindowCmd.hh
parentc912f7a32aae713f24ab32464cd1f443043ad59f (diff)
downloadfluxbox-18cf5862495aa6f37110c90286bb6c315a145526.zip
fluxbox-18cf5862495aa6f37110c90286bb6c315a145526.tar.bz2
new files
Diffstat (limited to 'src/WindowCmd.hh')
-rw-r--r--src/WindowCmd.hh32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/WindowCmd.hh b/src/WindowCmd.hh
new file mode 100644
index 0000000..309e62b
--- /dev/null
+++ b/src/WindowCmd.hh
@@ -0,0 +1,32 @@
1#ifndef WINDOWCMD_HH
2#define WINDOWCMD_HH
3
4#include "FbTk/Command.hh"
5#include "Window.hh"
6
7/// holds context for WindowCmd
8class WindowCmd_base {
9public:
10 static void setWindow(FluxboxWindow *win) { s_win = win; }
11 static FluxboxWindow *window() { return s_win; }
12protected:
13 static FluxboxWindow *s_win;
14};
15
16
17/// executes action for a dynamic context set in WindowCmd_base
18template <typename ReturnType=void>
19class WindowCmd: public WindowCmd_base, public FbTk::Command {
20public:
21 typedef ReturnType (FluxboxWindow::* Action)();
22 WindowCmd(Action a):m_action(a) {}
23 void execute() {
24 if (window() != 0)
25 (*window().*m_action)();
26 }
27private:
28 Action m_action;
29};
30
31
32#endif // WINDOWCMD_HH