aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ToolbarHandler.cc117
1 files changed, 17 insertions, 100 deletions
diff --git a/src/ToolbarHandler.cc b/src/ToolbarHandler.cc
index 6a3cd0b..59215e4 100644
--- a/src/ToolbarHandler.cc
+++ b/src/ToolbarHandler.cc
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: ToolbarHandler.cc,v 1.26 2003/07/25 10:03:55 rathnor Exp $ 23// $Id: ToolbarHandler.cc,v 1.27 2003/08/11 20:51:32 fluxgen Exp $
24 24
25/** 25/**
26 * The ToolbarHandler class acts as a rough interface to the toolbar. 26 * The ToolbarHandler class acts as a rough interface to the toolbar.
@@ -191,13 +191,11 @@ void ToolbarHandler::setMode(ToolbarMode newmode, bool initialise) {
191 191
192 192
193 if (newmode == NONE) { 193 if (newmode == NONE) {
194 // disableIconBar will clean up 194 //!! TODO disable iconbar
195 m_toolbar->disableIconBar();
196 } else { 195 } else {
197 // rebuild it 196 // rebuild it
198 // be sure the iconbar is on 197 // be sure the iconbar is on
199 m_toolbar->enableIconBar(); 198 //!! TODO enable iconbar
200 m_toolbar->delAllIcons();
201 } 199 }
202 200
203 if (initialise) 201 if (initialise)
@@ -208,75 +206,28 @@ void ToolbarHandler::initForScreen(BScreen &screen) {
208 if (&m_screen != &screen) 206 if (&m_screen != &screen)
209 return; 207 return;
210 208
211 if (m_toolbar.get() != 0)
212 m_toolbar->disableUpdates();
213
214 switch (mode()) { 209 switch (mode()) {
215 case OFF: 210 case OFF:
216 break; 211 break;
217 case NONE: 212 case NONE:
218 break; 213 break;
219 case ALLWINDOWS: { 214 case ALLWINDOWS:
220 BScreen::Workspaces::const_iterator workspace_it = m_screen.getWorkspacesList().begin(); 215 //!! TODO: change iconbar mode
221 BScreen::Workspaces::const_iterator workspace_it_end = m_screen.getWorkspacesList().end(); 216
222 for (; workspace_it != workspace_it_end; ++workspace_it) {
223 Workspace::Windows &wins = (*workspace_it)->windowList();
224 Workspace::Windows::iterator wit = wins.begin();
225 Workspace::Windows::iterator wit_end = wins.end();
226 for (; wit != wit_end; ++wit) {
227
228 if (!m_toolbar->containsIcon(**wit) && *wit != 0)
229 m_toolbar->addIcon(*wit);
230/*
231 FluxboxWindow::ClientList::iterator cit = (*wit)->clientList().begin();
232 FluxboxWindow::ClientList::iterator cit_end = (*wit)->clientList().end();
233 for (; cit != cit_end; ++cit)
234 m_toolbar->addIcon(*(*cit));
235*/
236 }
237 }
238 }
239 // fall through and add icons 217 // fall through and add icons
240 case LASTMODE: 218 case LASTMODE:
241 case ICONS: { 219 case ICONS:
242 BScreen::Icons &iconlist = m_screen.getIconList(); 220 //!! TODO: update iconbar mode
243 BScreen::Icons::iterator iconit = iconlist.begin();
244 BScreen::Icons::iterator iconit_end = iconlist.end();
245 for(; iconit != iconit_end; ++iconit) {
246 if (*iconit == 0)
247 continue;
248 m_toolbar->addIcon(*iconit);
249 }
250 }
251 break; 221 break;
252 case WORKSPACE: { 222 case WORKSPACE:
253 Workspace::Windows &wins = m_screen.currentWorkspace()->windowList(); 223 //!! TODO: update iconbar mode
254 Workspace::Windows::iterator wit = wins.begin(); 224
255 Workspace::Windows::iterator wit_end = wins.end();
256 for (; wit != wit_end; ++wit) {
257
258 if (!m_toolbar->containsIcon(**wit) && *wit != 0)
259 m_toolbar->addIcon(*wit);
260 }
261 }
262 // fall through and add icons for this workspace 225 // fall through and add icons for this workspace
263 case WORKSPACEICONS: { 226 case WORKSPACEICONS:
264 m_current_workspace = m_screen.currentWorkspaceID(); 227 //!! TODO: update iconbar mode
265
266 BScreen::Icons &wiconlist = m_screen.getIconList();
267 BScreen::Icons::iterator iconit = wiconlist.begin();
268 BScreen::Icons::iterator iconit_end = wiconlist.end();
269 for(; iconit != iconit_end; ++iconit) {
270 if ((*iconit)->workspaceNumber() == m_current_workspace)
271 m_toolbar->addIcon(*iconit);
272 }
273 }
274 break; 228 break;
275 } 229 }
276 230
277 if (m_toolbar.get() != 0)
278 m_toolbar->enableUpdates();
279
280} 231}
281 232
282void ToolbarHandler::setupFrame(FluxboxWindow &win) { 233void ToolbarHandler::setupFrame(FluxboxWindow &win) {
@@ -288,20 +239,14 @@ void ToolbarHandler::setupFrame(FluxboxWindow &win) {
288 case NONE: 239 case NONE:
289 break; 240 break;
290 case WORKSPACE: 241 case WORKSPACE:
291 if (win.workspaceNumber() == m_current_workspace)
292 m_toolbar->addIcon(&win);
293 break; 242 break;
294 case WORKSPACEICONS: 243 case WORKSPACEICONS:
295 if (win.workspaceNumber() != m_current_workspace) 244 break;
296 break;
297 // else fall through and add the icon 245 // else fall through and add the icon
298 case LASTMODE: 246 case LASTMODE:
299 case ICONS: 247 case ICONS:
300 if (win.isIconic())
301 m_toolbar->addIcon(&win);
302 break; 248 break;
303 case ALLWINDOWS: 249 case ALLWINDOWS:
304 m_toolbar->addIcon(&win);
305 break; 250 break;
306 } 251 }
307} 252}
@@ -321,16 +266,10 @@ void ToolbarHandler::updateFrameClose(FluxboxWindow &win) {
321 // else fall through and remove the icon 266 // else fall through and remove the icon
322 case LASTMODE: 267 case LASTMODE:
323 case ICONS: 268 case ICONS:
324 if (win.isIconic()) {
325 m_toolbar->delIcon(&win);
326 }
327 break; 269 break;
328 case WORKSPACE: 270 case WORKSPACE:
329 if (win.isStuck() || win.workspaceNumber() == m_current_workspace)
330 m_toolbar->delIcon(&win);
331 break; 271 break;
332 case ALLWINDOWS: 272 case ALLWINDOWS:
333 m_toolbar->delIcon(&win);
334 break; 273 break;
335 } 274 }
336} 275}
@@ -352,15 +291,6 @@ void ToolbarHandler::updateState(FluxboxWindow &win) {
352 // else fall through and do the same as icons (knowing it is the right ws) 291 // else fall through and do the same as icons (knowing it is the right ws)
353 case LASTMODE: 292 case LASTMODE:
354 case ICONS: 293 case ICONS:
355 // if the window is iconic (it mustn't have been before), then add it
356 // else remove it
357 if (win.isIconic()) {
358 if (!m_toolbar->containsIcon(win)) {
359 m_toolbar->addIcon(&win);
360 }
361 } else {
362 m_toolbar->delIcon(&win);
363 }
364 break; 294 break;
365 } 295 }
366} 296}
@@ -376,17 +306,9 @@ void ToolbarHandler::updateWorkspace(FluxboxWindow &win) {
376 return; 306 return;
377 307
378 if (win.workspaceNumber() == m_current_workspace) { 308 if (win.workspaceNumber() == m_current_workspace) {
379 //!! TODO 309
380 // this shouldn't be needed, but is until Workspaces get fixed so that
381 // you only move between them, you don't 'add' and 'remove'
382 // alternatively, fix reassocaiteWindow so that the iconic stuff is
383 // done elsewhere
384 if (!m_toolbar->containsIcon(win))
385 m_toolbar->addIcon(&win);
386 } else { 310 } else {
387 // relies on the fact that this runs but does nothing if window isn't contained. 311
388 if (!win.isStuck())
389 m_toolbar->delIcon(&win);
390 } 312 }
391} 313}
392 314
@@ -394,13 +316,8 @@ void ToolbarHandler::updateCurrentWorkspace(BScreen &screen) {
394 if (&screen != &m_screen || mode() == OFF) 316 if (&screen != &m_screen || mode() == OFF)
395 return; 317 return;
396 318
397 m_toolbar->redrawWorkspaceLabel(true); 319 if (mode() != NONE)
398 if (mode() != NONE) {
399 m_toolbar->disableUpdates();
400 m_toolbar->delAllIcons(true);
401 initForScreen(m_screen); 320 initForScreen(m_screen);
402 m_toolbar->enableUpdates();
403 }
404 321
405} 322}
406 323