diff options
author | fluxgen <fluxgen> | 2003-12-03 00:32:58 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-12-03 00:32:58 (GMT) |
commit | 8971b068ac4ab9a74bccfee93b3314a83b3cbc15 (patch) | |
tree | 036880c1d7e4a5bbb2da59f178e0a973caf8bfa0 /src | |
parent | 82e72ab49336368284f38130c751e266338900a9 (diff) | |
download | fluxbox_paul-8971b068ac4ab9a74bccfee93b3314a83b3cbc15.zip fluxbox_paul-8971b068ac4ab9a74bccfee93b3314a83b3cbc15.tar.bz2 |
removed
Diffstat (limited to 'src')
-rw-r--r-- | src/ToolbarHandler.cc | 227 | ||||
-rw-r--r-- | src/ToolbarHandler.hh | 97 |
2 files changed, 0 insertions, 324 deletions
diff --git a/src/ToolbarHandler.cc b/src/ToolbarHandler.cc deleted file mode 100644 index 4a8ff3d..0000000 --- a/src/ToolbarHandler.cc +++ /dev/null | |||
@@ -1,227 +0,0 @@ | |||
1 | // ToolbarHandler for fluxbox | ||
2 | // Copyright (c) 2003 Simon Bowden (rathnor at fluxbox.org) | ||
3 | // and Henrik Kinnunen (fluxgen at fluxbox.org) | ||
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: ToolbarHandler.cc,v 1.29 2003/10/06 06:22:43 rathnor Exp $ | ||
24 | |||
25 | /** | ||
26 | * The ToolbarHandler class acts as a rough interface to the toolbar. | ||
27 | * It deals with whether it should be there or not, so anything that | ||
28 | * always needs to be accessible must come through the handler. | ||
29 | */ | ||
30 | |||
31 | #include "ToolbarHandler.hh" | ||
32 | #include "Window.hh" | ||
33 | #include "Screen.hh" | ||
34 | #include "Workspace.hh" | ||
35 | #include "MenuItem.hh" | ||
36 | #include "FbMenu.hh" | ||
37 | #include "FbCommands.hh" | ||
38 | #include "RefCount.hh" | ||
39 | #include "SimpleCommand.hh" | ||
40 | #include "MacroCommand.hh" | ||
41 | #include "IntResMenuItem.hh" | ||
42 | #include "BoolMenuItem.hh" | ||
43 | |||
44 | #include <string> | ||
45 | |||
46 | using namespace std; | ||
47 | |||
48 | ToolbarHandler::ToolbarHandler(BScreen &screen) | ||
49 | : m_screen(screen), | ||
50 | // no need to lock since only one resource | ||
51 | m_toolbar(0), | ||
52 | m_current_workspace(0), | ||
53 | m_modemenu(*screen.menuTheme(), | ||
54 | screen.screenNumber(), screen.imageControl(), | ||
55 | *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), | ||
56 | m_toolbarmenu(*screen.menuTheme(), | ||
57 | screen.screenNumber(), screen.imageControl(), | ||
58 | *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())) { | ||
59 | m_modemenu.setInternalMenu(); | ||
60 | m_toolbarmenu.setInternalMenu(); | ||
61 | |||
62 | m_mode = WORKSPACE; | ||
63 | m_toolbar.reset(new Toolbar(m_screen, | ||
64 | *m_screen.layerManager().getLayer(Fluxbox::instance()->getNormalLayer()), | ||
65 | m_toolbarmenu)); | ||
66 | // now add this to the config menus for the screen | ||
67 | // (we only want it done once, so it can't go in initforscreen) | ||
68 | |||
69 | screen.addConfigMenu("Toolbar", m_toolbarmenu); | ||
70 | enableUpdate(); | ||
71 | } | ||
72 | |||
73 | void ToolbarHandler::setMode(ToolbarMode newmode, bool initialise) { | ||
74 | if (newmode < 0 || newmode >= LASTMODE) | ||
75 | return; | ||
76 | |||
77 | |||
78 | if (newmode == OFF) { | ||
79 | m_toolbarmenu.removeAll(); | ||
80 | //TODO: nls | ||
81 | m_toolbarmenu.insert("Mode...", &m_modemenu); | ||
82 | m_toolbar.reset(0); | ||
83 | m_toolbarmenu.update(); | ||
84 | |||
85 | return; | ||
86 | } else if (!m_toolbar.get()) { | ||
87 | m_toolbarmenu.removeAll(); | ||
88 | m_toolbar.reset(new Toolbar(m_screen, | ||
89 | *m_screen.layerManager().getLayer(Fluxbox::instance()->getNormalLayer()), m_toolbarmenu)); | ||
90 | m_toolbar->reconfigure(); | ||
91 | |||
92 | m_toolbarmenu.insert("Mode...", &m_modemenu); | ||
93 | m_toolbarmenu.update(); | ||
94 | } | ||
95 | |||
96 | |||
97 | if (newmode == NONE) { | ||
98 | //!! TODO disable iconbar | ||
99 | } else { | ||
100 | // rebuild it | ||
101 | // be sure the iconbar is on | ||
102 | //!! TODO enable iconbar | ||
103 | } | ||
104 | |||
105 | if (initialise) | ||
106 | initForScreen(m_screen); | ||
107 | } | ||
108 | |||
109 | void ToolbarHandler::initForScreen(BScreen &screen) { | ||
110 | if (&m_screen != &screen) | ||
111 | return; | ||
112 | |||
113 | switch (mode()) { | ||
114 | case OFF: | ||
115 | break; | ||
116 | case NONE: | ||
117 | break; | ||
118 | case ALLWINDOWS: | ||
119 | //!! TODO: change iconbar mode | ||
120 | |||
121 | // fall through and add icons | ||
122 | case LASTMODE: | ||
123 | case ICONS: | ||
124 | //!! TODO: update iconbar mode | ||
125 | break; | ||
126 | case WORKSPACE: | ||
127 | //!! TODO: update iconbar mode | ||
128 | |||
129 | // fall through and add icons for this workspace | ||
130 | case WORKSPACEICONS: | ||
131 | //!! TODO: update iconbar mode | ||
132 | break; | ||
133 | } | ||
134 | |||
135 | } | ||
136 | |||
137 | void ToolbarHandler::setupFrame(FluxboxWindow &win) { | ||
138 | if (&win.screen() != &m_screen) | ||
139 | return; | ||
140 | |||
141 | switch (mode()) { | ||
142 | case OFF: | ||
143 | case NONE: | ||
144 | break; | ||
145 | case WORKSPACE: | ||
146 | break; | ||
147 | case WORKSPACEICONS: | ||
148 | break; | ||
149 | // else fall through and add the icon | ||
150 | case LASTMODE: | ||
151 | case ICONS: | ||
152 | break; | ||
153 | case ALLWINDOWS: | ||
154 | break; | ||
155 | } | ||
156 | } | ||
157 | |||
158 | void ToolbarHandler::updateFrameClose(FluxboxWindow &win) { | ||
159 | if (&win.screen() != &m_screen) | ||
160 | return; | ||
161 | |||
162 | // check status of window (in current workspace, etc) and remove if necessary | ||
163 | switch (mode()) { | ||
164 | case OFF: | ||
165 | case NONE: | ||
166 | break; | ||
167 | case WORKSPACEICONS: | ||
168 | if (win.workspaceNumber() != m_current_workspace) | ||
169 | break; | ||
170 | // else fall through and remove the icon | ||
171 | case LASTMODE: | ||
172 | case ICONS: | ||
173 | break; | ||
174 | case WORKSPACE: | ||
175 | break; | ||
176 | case ALLWINDOWS: | ||
177 | break; | ||
178 | } | ||
179 | } | ||
180 | |||
181 | void ToolbarHandler::updateState(FluxboxWindow &win) { | ||
182 | if (&win.screen() != &m_screen) | ||
183 | return; | ||
184 | |||
185 | // this function only relevant for icons | ||
186 | switch (mode()) { | ||
187 | case OFF: | ||
188 | case NONE: | ||
189 | case WORKSPACE: | ||
190 | case ALLWINDOWS: | ||
191 | break; | ||
192 | case WORKSPACEICONS: | ||
193 | if (win.workspaceNumber() != m_current_workspace) | ||
194 | break; | ||
195 | // else fall through and do the same as icons (knowing it is the right ws) | ||
196 | case LASTMODE: | ||
197 | case ICONS: | ||
198 | break; | ||
199 | } | ||
200 | } | ||
201 | |||
202 | |||
203 | void ToolbarHandler::updateWorkspace(FluxboxWindow &win) { | ||
204 | if (&win.screen() != &m_screen) | ||
205 | return; | ||
206 | |||
207 | // don't care about current workspace except if in workspace mode | ||
208 | if (!(mode() == WORKSPACE || | ||
209 | (mode() == WORKSPACEICONS && win.isIconic()))) | ||
210 | return; | ||
211 | |||
212 | if (win.workspaceNumber() == m_current_workspace) { | ||
213 | |||
214 | } else { | ||
215 | |||
216 | } | ||
217 | } | ||
218 | |||
219 | void ToolbarHandler::updateCurrentWorkspace(BScreen &screen) { | ||
220 | if (&screen != &m_screen || mode() == OFF) | ||
221 | return; | ||
222 | |||
223 | if (mode() != NONE) | ||
224 | initForScreen(m_screen); | ||
225 | |||
226 | } | ||
227 | |||
diff --git a/src/ToolbarHandler.hh b/src/ToolbarHandler.hh deleted file mode 100644 index 538ac78..0000000 --- a/src/ToolbarHandler.hh +++ /dev/null | |||
@@ -1,97 +0,0 @@ | |||
1 | // ToolbarHandler for fluxbox | ||
2 | // Copyright (c) 2003 Simon Bowden (rathnor at fluxbox.org) | ||
3 | // and Henrik Kinnunen (fluxgen at fluxbox.org) | ||
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: ToolbarHandler.hh,v 1.9 2003/10/06 06:22:43 rathnor Exp $ | ||
24 | |||
25 | #ifndef TOOLBARHANDLER_HH | ||
26 | #define TOOLBARHANDLER_HH | ||
27 | |||
28 | #include "AtomHandler.hh" | ||
29 | #include "Menu.hh" | ||
30 | #include "Toolbar.hh" | ||
31 | #include "Resource.hh" | ||
32 | |||
33 | class BScreen; | ||
34 | class FluxboxWindow; | ||
35 | |||
36 | class ToolbarHandler : public AtomHandler { | ||
37 | public: | ||
38 | enum ToolbarMode { | ||
39 | OFF=0, | ||
40 | NONE, | ||
41 | ICONS, | ||
42 | WORKSPACEICONS, | ||
43 | WORKSPACE, | ||
44 | ALLWINDOWS, | ||
45 | LASTMODE | ||
46 | }; | ||
47 | |||
48 | explicit ToolbarHandler(BScreen &screen); | ||
49 | ~ToolbarHandler() { } | ||
50 | |||
51 | void setMode(ToolbarMode mode, bool initialise = true); | ||
52 | |||
53 | inline const Toolbar *toolbar() const { return m_toolbar.get(); } | ||
54 | inline Toolbar *toolbar() { return m_toolbar.get(); } | ||
55 | |||
56 | |||
57 | void initForScreen(BScreen &screen); | ||
58 | void setupFrame(FluxboxWindow &win); | ||
59 | // TODO: add setupClient and configure option to show groups or indiv. clients | ||
60 | void setupClient(WinClient &winclient) {} | ||
61 | |||
62 | void updateState(FluxboxWindow &win); | ||
63 | void updateFrameClose(FluxboxWindow &win); | ||
64 | void updateClientClose(WinClient &winclient) {} | ||
65 | void updateWorkspace(FluxboxWindow &win); | ||
66 | void updateCurrentWorkspace(BScreen &screen); | ||
67 | |||
68 | // these ones don't affect us | ||
69 | void updateWorkspaceNames(BScreen &screen) {} | ||
70 | void updateWorkspaceCount(BScreen &screen) {} | ||
71 | void updateClientList(BScreen &screen) {} | ||
72 | void updateHints(FluxboxWindow &win) {} | ||
73 | void updateLayer(FluxboxWindow &win) {} | ||
74 | |||
75 | bool checkClientMessage(const XClientMessageEvent &ce, | ||
76 | BScreen * screen, WinClient * const winclient) { return false; } | ||
77 | |||
78 | bool propertyNotify(WinClient &winclient, Atom the_atom) { return false; } | ||
79 | |||
80 | inline FbTk::Menu &getModeMenu() { return m_modemenu; } | ||
81 | inline const FbTk::Menu &getModeMenu() const { return m_modemenu; } | ||
82 | inline FbTk::Menu &getToolbarMenu() { return m_toolbarmenu; } | ||
83 | inline const FbTk::Menu &getToolbarMenu() const { return m_toolbarmenu; } | ||
84 | |||
85 | inline BScreen &screen() { return m_screen; } | ||
86 | inline const BScreen &screen() const { return m_screen; } | ||
87 | ToolbarMode mode() const { return m_mode; } | ||
88 | private: | ||
89 | BScreen &m_screen; | ||
90 | std::auto_ptr<Toolbar> m_toolbar; | ||
91 | unsigned int m_current_workspace; | ||
92 | ToolbarMode m_mode; | ||
93 | FbMenu m_modemenu; | ||
94 | FbMenu m_toolbarmenu; | ||
95 | }; | ||
96 | |||
97 | #endif // TOOLBARHANDLER_HH | ||