diff options
Diffstat (limited to 'src/CurrentWindowCmd.hh')
-rw-r--r-- | src/CurrentWindowCmd.hh | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/src/CurrentWindowCmd.hh b/src/CurrentWindowCmd.hh new file mode 100644 index 0000000..7927add --- /dev/null +++ b/src/CurrentWindowCmd.hh | |||
@@ -0,0 +1,128 @@ | |||
1 | // CurrentWindowCmd.hh for Fluxbox - an X11 Window manager | ||
2 | // Copyright (c) 2003 Henrik Kinnunen (fluxgen{<a*t>}users.sourceforge.net) | ||
3 | // and Simon Bowden (rathnor at users.sourceforge.net) | ||
4 | // | ||
5 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
6 | // copy of this software and associated documentation files (the "Software"), | ||
7 | // to deal in the Software without restriction, including without limitation | ||
8 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
9 | // and/or sell copies of the Software, and to permit persons to whom the | ||
10 | // Software is furnished to do so, subject to the following conditions: | ||
11 | // | ||
12 | // The above copyright notice and this permission notice shall be included in | ||
13 | // all copies or substantial portions of the Software. | ||
14 | // | ||
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
18 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
21 | // DEALINGS IN THE SOFTWARE. | ||
22 | |||
23 | // $Id: CurrentWindowCmd.hh,v 1.3 2003/08/19 23:37:31 fluxgen Exp $ | ||
24 | |||
25 | #ifndef CURRENTWINDOWCMD_HH | ||
26 | #define CURRENTWINDOWCMD_HH | ||
27 | |||
28 | #include "Command.hh" | ||
29 | |||
30 | class FluxboxWindow; | ||
31 | class WinClient; | ||
32 | |||
33 | /// command that calls FluxboxWindow::<the function> on execute() | ||
34 | /// similar to FbTk::SimpleCommand<T> | ||
35 | class CurrentWindowCmd: public FbTk::Command { | ||
36 | public: | ||
37 | typedef void (FluxboxWindow::* Action)(); | ||
38 | explicit CurrentWindowCmd(Action action); | ||
39 | void execute(); | ||
40 | private: | ||
41 | Action m_action; | ||
42 | }; | ||
43 | |||
44 | /// helper class for window commands | ||
45 | /// calls real_execute if there's a focused window or a window in button press/release window | ||
46 | class WindowHelperCmd: public FbTk::Command { | ||
47 | public: | ||
48 | void execute(); | ||
49 | |||
50 | protected: | ||
51 | |||
52 | WinClient &winclient(); | ||
53 | FluxboxWindow &fbwindow(); | ||
54 | virtual void real_execute() = 0; | ||
55 | |||
56 | }; | ||
57 | |||
58 | class KillWindowCmd: public WindowHelperCmd { | ||
59 | protected: | ||
60 | void real_execute(); | ||
61 | }; | ||
62 | |||
63 | class SendToWorkspaceCmd: public WindowHelperCmd { | ||
64 | public: | ||
65 | explicit SendToWorkspaceCmd(int workspace_num):m_workspace_num(workspace_num) { } | ||
66 | protected: | ||
67 | void real_execute(); | ||
68 | private: | ||
69 | const int m_workspace_num; | ||
70 | }; | ||
71 | |||
72 | class MoveHelper: public WindowHelperCmd { | ||
73 | public: | ||
74 | explicit MoveHelper(int step_size):m_step_size(step_size) { } | ||
75 | protected: | ||
76 | int stepSize() const { return m_step_size; } | ||
77 | |||
78 | private: | ||
79 | const int m_step_size; | ||
80 | }; | ||
81 | /// move window to left | ||
82 | class MoveLeftCmd: public MoveHelper { | ||
83 | public: | ||
84 | explicit MoveLeftCmd(int step_size); | ||
85 | protected: | ||
86 | void real_execute(); | ||
87 | }; | ||
88 | |||
89 | /// move window to right | ||
90 | class MoveRightCmd: public MoveHelper { | ||
91 | public: | ||
92 | explicit MoveRightCmd(int step_size); | ||
93 | protected: | ||
94 | void real_execute(); | ||
95 | }; | ||
96 | |||
97 | /// move window up | ||
98 | class MoveUpCmd: public MoveHelper { | ||
99 | public: | ||
100 | explicit MoveUpCmd(int step_size); | ||
101 | protected: | ||
102 | void real_execute(); | ||
103 | }; | ||
104 | |||
105 | /// move window down | ||
106 | class MoveDownCmd: public MoveHelper { | ||
107 | public: | ||
108 | explicit MoveDownCmd(int step_size); | ||
109 | protected: | ||
110 | void real_execute(); | ||
111 | }; | ||
112 | |||
113 | // resize vertical | ||
114 | class ResizeVerticalCmd: public MoveHelper { | ||
115 | public: | ||
116 | explicit ResizeVerticalCmd(int step_size); | ||
117 | protected: | ||
118 | void real_execute(); | ||
119 | }; | ||
120 | |||
121 | // resize horizontal | ||
122 | class ResizeHorizontalCmd: public MoveHelper{ | ||
123 | public: | ||
124 | explicit ResizeHorizontalCmd(int step_size); | ||
125 | protected: | ||
126 | void real_execute(); | ||
127 | }; | ||
128 | #endif // CURRENTWINDOWCMD_HH | ||