00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "IconbarTool.hh"
00026
00027 #include "Screen.hh"
00028 #include "IconbarTheme.hh"
00029 #include "Window.hh"
00030 #include "IconButton.hh"
00031 #include "Workspace.hh"
00032 #include "fluxbox.hh"
00033 #include "FbMenu.hh"
00034 #include "BoolMenuItem.hh"
00035 #include "CommandParser.hh"
00036 #include "WinClient.hh"
00037
00038 #include "FbTk/Menu.hh"
00039 #include "FbTk/MenuItem.hh"
00040 #include "FbTk/RefCount.hh"
00041 #include "FbTk/SimpleCommand.hh"
00042 #include "FbTk/ImageControl.hh"
00043 #include "FbTk/MacroCommand.hh"
00044
00045 #include <typeinfo>
00046 #include <string>
00047 #include <iterator>
00048 using namespace std;
00049
00050 template<>
00051 void FbTk::Resource<IconbarTool::Mode>::setFromString(const char *strval) {
00052 if (strcasecmp(strval, "None") == 0)
00053 m_value = IconbarTool::NONE;
00054 else if (strcasecmp(strval, "Icons") == 0)
00055 m_value = IconbarTool::ICONS;
00056 else if (strcasecmp(strval, "WorkspaceIcons") == 0)
00057 m_value = IconbarTool::WORKSPACEICONS;
00058 else if (strcasecmp(strval, "Workspace") == 0)
00059 m_value = IconbarTool::WORKSPACE;
00060 else if (strcasecmp(strval, "AllWindows") == 0)
00061 m_value = IconbarTool::ALLWINDOWS;
00062 else
00063 setDefaultValue();
00064 }
00065
00066 template<>
00067 void FbTk::Resource<Container::Alignment>::setDefaultValue() {
00068 m_value = Container::RELATIVE;
00069 }
00070
00071 template<>
00072 string FbTk::Resource<Container::Alignment>::getString() {
00073 switch (m_value) {
00074 case Container::LEFT:
00075 return string("Left");
00076 case Container::RIGHT:
00077 return string("Right");
00078 case Container::RELATIVE:
00079 return string("Relative");
00080 }
00081 return string("Left");
00082 }
00083
00084 template<>
00085 void FbTk::Resource<Container::Alignment>::setFromString(const char *str) {
00086 if (strcasecmp(str, "Left") == 0)
00087 m_value = Container::LEFT;
00088 else if (strcasecmp(str, "Right") == 0)
00089 m_value = Container::RIGHT;
00090 else if (strcasecmp(str, "RELATIVE") == 0)
00091 m_value = Container::RELATIVE;
00092 else
00093 setDefaultValue();
00094 }
00095
00096 template<>
00097 string FbTk::Resource<IconbarTool::Mode>::getString() {
00098
00099 switch (m_value) {
00100 case IconbarTool::NONE:
00101 return string("None");
00102 break;
00103 case IconbarTool::ICONS:
00104 return string("Icons");
00105 break;
00106 case IconbarTool::WORKSPACEICONS:
00107 return string("WorkspaceIcons");
00108 break;
00109 case IconbarTool::WORKSPACE:
00110 return string("Workspace");
00111 break;
00112 case IconbarTool::ALLWINDOWS:
00113 return string("AllWindows");
00114 break;
00115 }
00116
00117 return string("Icons");
00118 }
00119
00120 namespace {
00121
00122 class ToolbarModeMenuItem : public FbTk::MenuItem {
00123 public:
00124 ToolbarModeMenuItem(const char *label, IconbarTool &handler,
00125 IconbarTool::Mode mode,
00126 FbTk::RefCount<FbTk::Command> &cmd):
00127 FbTk::MenuItem(label, cmd), m_handler(handler), m_mode(mode) {
00128 }
00129 bool isEnabled() const { return m_handler.mode() != m_mode; }
00130 void click(int button, int time) {
00131 m_handler.setMode(m_mode);
00132 FbTk::MenuItem::click(button, time);
00133 }
00134
00135 private:
00136 IconbarTool &m_handler;
00137 IconbarTool::Mode m_mode;
00138 };
00139
00140 class ToolbarAlignMenuItem: public FbTk::MenuItem {
00141 public:
00142 ToolbarAlignMenuItem(const char *label, IconbarTool &handler,
00143 Container::Alignment mode,
00144 FbTk::RefCount<FbTk::Command> &cmd):
00145 FbTk::MenuItem(label, cmd), m_handler(handler), m_mode(mode) {
00146 }
00147 bool isEnabled() const { return m_handler.alignment() != m_mode; }
00148 void click(int button, int time) {
00149 m_handler.setAlignment(m_mode);
00150 FbTk::MenuItem::click(button, time);
00151 }
00152
00153 private:
00154 IconbarTool &m_handler;
00155 Container::Alignment m_mode;
00156 };
00157
00158 void setupModeMenu(FbTk::Menu &menu, IconbarTool &handler) {
00159 using namespace FbTk;
00160
00161
00162 menu.setLabel("Iconbar Mode");
00163
00164 RefCount<Command> saverc_cmd(new SimpleCommand<Fluxbox>(
00165 *Fluxbox::instance(),
00166 &Fluxbox::save_rc));
00167
00168
00169 menu.insert(new ToolbarModeMenuItem("None", handler,
00170 IconbarTool::NONE, saverc_cmd));
00171 menu.insert(new ToolbarModeMenuItem("Icons", handler,
00172 IconbarTool::ICONS, saverc_cmd));
00173 menu.insert(new ToolbarModeMenuItem("Workspace Icons", handler,
00174 IconbarTool::WORKSPACEICONS, saverc_cmd));
00175 menu.insert(new ToolbarModeMenuItem("Workspace", handler,
00176 IconbarTool::WORKSPACE, saverc_cmd));
00177 menu.insert(new ToolbarModeMenuItem("All Windows", handler,
00178 IconbarTool::ALLWINDOWS, saverc_cmd));
00179 menu.insert("---");
00180 menu.insert(new ToolbarAlignMenuItem("Left", handler,
00181 Container::LEFT, saverc_cmd));
00182 menu.insert(new ToolbarAlignMenuItem("Relative", handler,
00183 Container::RELATIVE, saverc_cmd));
00184 menu.insert(new ToolbarAlignMenuItem("Right", handler,
00185 Container::RIGHT, saverc_cmd));
00186 menu.insert("---");
00187 menu.update();
00188 }
00189
00190 inline bool checkAddWindow(IconbarTool::Mode mode, const FluxboxWindow &win) {
00191
00192
00193 switch (mode) {
00194 case IconbarTool::NONE:
00195 break;
00196 case IconbarTool::ICONS:
00197 if (win.isIconic())
00198 return true;
00199 break;
00200 case IconbarTool::WORKSPACEICONS:
00201 if(win.workspaceNumber() == win.screen().currentWorkspaceID() &&
00202 win.isIconic())
00203 return true;
00204 break;
00205 case IconbarTool::WORKSPACE:
00206 if (win.workspaceNumber() == win.screen().currentWorkspaceID())
00207 return true;
00208 break;
00209 case IconbarTool::ALLWINDOWS:
00210 return true;
00211 break;
00212 }
00213
00214 return false;
00215 }
00216
00217 void removeDuplicate(const IconbarTool::IconList &iconlist, std::list<FluxboxWindow *> &windowlist) {
00218 IconbarTool::IconList::const_iterator win_it = iconlist.begin();
00219 IconbarTool::IconList::const_iterator win_it_end = iconlist.end();
00220 std::list<FluxboxWindow *>::iterator remove_it = windowlist.end();
00221 for (; win_it != win_it_end; ++win_it)
00222 remove_it = remove(windowlist.begin(), remove_it, &(*win_it)->win());
00223
00224
00225 windowlist.erase(remove_it, windowlist.end());
00226
00227 }
00228
00229 };
00230
00231 IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, BScreen &screen,
00232 FbTk::Menu &menu):
00233 ToolbarItem(ToolbarItem::RELATIVE),
00234 m_screen(screen),
00235 m_icon_container(parent),
00236 m_theme(theme),
00237 m_focused_pm(0),
00238 m_unfocused_pm(0),
00239 m_focused_err_pm(0),
00240 m_unfocused_err_pm(0),
00241 m_empty_pm(0),
00242 m_rc_mode(screen.resourceManager(), WORKSPACE,
00243 screen.name() + ".iconbar.mode", screen.altName() + ".Iconbar.Mode"),
00244 m_rc_alignment(screen.resourceManager(), Container::LEFT,
00245 screen.name() + ".iconbar.alignment", screen.altName() + ".Iconbar.Alignment"),
00246 m_rc_client_width(screen.resourceManager(), 70,
00247 screen.name() + ".iconbar.clientWidth", screen.altName() + ".Iconbar.ClientWidth"),
00248 m_rc_use_pixmap(screen.resourceManager(), true,
00249 screen.name() + ".iconbar.usePixmap", screen.altName() + ".Iconbar.UsePixmap"),
00250 m_menu(screen.menuTheme(), screen.imageControl(),
00251 *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())) {
00252
00253
00254 setupModeMenu(m_menu, *this);
00255
00256 using namespace FbTk;
00257
00258 MacroCommand *save_and_reconfig = new MacroCommand();
00259 RefCount<Command> reconfig(new SimpleCommand<IconbarTool>(*this, &IconbarTool::renderTheme));
00260 RefCount<Command> save(CommandParser::instance().parseLine("saverc"));
00261 save_and_reconfig->add(reconfig);
00262 save_and_reconfig->add(save);
00263 RefCount<Command> s_and_reconfig(save_and_reconfig);
00264 m_menu.insert(new BoolMenuItem("Show Pictures", *m_rc_use_pixmap, s_and_reconfig));
00265 m_menu.update();
00266
00267 m_menu.setInternalMenu();
00268
00269
00270 menu.insert(m_menu.label().c_str(), &m_menu);
00271
00272
00273 theme.reconfigSig().attach(this);
00274 screen.clientListSig().attach(this);
00275 screen.iconListSig().attach(this);
00276 screen.currentWorkspaceSig().attach(this);
00277
00278 FbTk::RefCount<FbTk::Command> timer_cmd(new FbTk::SimpleCommand<IconbarTool>(*this, &IconbarTool::timedRender));
00279 timeval to;
00280 to.tv_sec = 0;
00281 to.tv_usec = 1;
00282 m_focus_timer.setCommand(timer_cmd);
00283 m_focus_timer.setTimeout(to);
00284 m_focus_timer.fireOnce(true);
00285
00286 update(0);
00287 }
00288
00289 IconbarTool::~IconbarTool() {
00290 deleteIcons();
00291
00292
00293 if (m_focused_pm)
00294 m_screen.imageControl().removeImage(m_focused_pm);
00295 if (m_unfocused_pm)
00296 m_screen.imageControl().removeImage(m_unfocused_pm);
00297 if (m_focused_err_pm)
00298 m_screen.imageControl().removeImage(m_focused_err_pm);
00299 if (m_unfocused_err_pm)
00300 m_screen.imageControl().removeImage(m_unfocused_err_pm);
00301 if (m_empty_pm)
00302 m_screen.imageControl().removeImage(m_empty_pm);
00303
00304 }
00305
00306 void IconbarTool::move(int x, int y) {
00307 m_icon_container.move(x, y);
00308 }
00309
00310 void IconbarTool::resize(unsigned int width, unsigned int height) {
00311 m_icon_container.resize(width, height);
00312 renderTheme();
00313 }
00314
00315 void IconbarTool::moveResize(int x, int y,
00316 unsigned int width, unsigned int height) {
00317
00318 m_icon_container.moveResize(x, y, width, height);
00319 renderTheme();
00320 }
00321
00322 void IconbarTool::show() {
00323 m_icon_container.show();
00324 }
00325
00326 void IconbarTool::hide() {
00327 m_icon_container.hide();
00328 }
00329
00330 void IconbarTool::setAlignment(Container::Alignment align) {
00331 *m_rc_alignment = align;
00332 update(0);
00333 }
00334
00335 void IconbarTool::setMode(Mode mode) {
00336 if (mode == *m_rc_mode)
00337 return;
00338
00339 *m_rc_mode = mode;
00340
00341
00342 m_icon_container.setUpdateLock(true);
00343
00344 deleteIcons();
00345
00346
00347 switch (mode) {
00348 case NONE:
00349 break;
00350 case ICONS:
00351 case WORKSPACEICONS:
00352 updateIcons();
00353 break;
00354 case WORKSPACE:
00355 updateWorkspace();
00356 break;
00357 case ALLWINDOWS:
00358 updateAllWindows();
00359 break;
00360 };
00361
00362
00363 m_icon_container.setUpdateLock(false);
00364 m_icon_container.update();
00365 m_icon_container.showSubwindows();
00366
00367 renderTheme();
00368 }
00369
00370 unsigned int IconbarTool::width() const {
00371 return m_icon_container.width();
00372 }
00373
00374 unsigned int IconbarTool::height() const {
00375 return m_icon_container.height();
00376 }
00377
00378 unsigned int IconbarTool::borderWidth() const {
00379 return m_icon_container.borderWidth();
00380 }
00381
00382 void IconbarTool::update(FbTk::Subject *subj) {
00383
00384 if (m_screen.isShuttingdown()) {
00385 m_screen.clientListSig().detach(this);
00386 m_screen.iconListSig().detach(this);
00387 m_screen.currentWorkspaceSig().detach(this);
00388 if (!m_icon_list.empty())
00389 deleteIcons();
00390 return;
00391 }
00392
00393 m_icon_container.setAlignment(*m_rc_alignment);
00394
00395 if (*m_rc_client_width < 1)
00396 *m_rc_client_width = 10;
00397 else if (*m_rc_client_width > 400)
00398 *m_rc_client_width = 400;
00399
00400 m_icon_container.setMaxSizePerClient(*m_rc_client_width);
00401
00402
00403 if (mode() == NONE) {
00404 if (subj != 0 && typeid(*subj) == typeid(IconbarTheme))
00405 renderTheme();
00406
00407 return;
00408 }
00409
00410
00411 if (subj != 0 && typeid(*subj) == typeid(FluxboxWindow::WinSubject)) {
00412
00413 FluxboxWindow::WinSubject *winsubj = static_cast<FluxboxWindow::WinSubject *>(subj);
00414 if (subj == &(winsubj->win().focusSig())) {
00415
00416 m_focus_timer.start();
00417
00418
00419 return;
00420 } else if (subj == &(winsubj->win().workspaceSig())) {
00421
00422 if (mode() == ALLWINDOWS)
00423 return;
00424
00425
00426 if (m_screen.currentWorkspaceID() != winsubj->win().workspaceNumber()) {
00427 removeWindow(winsubj->win());
00428 renderTheme();
00429 }
00430 return;
00431 } else if (subj == &(winsubj->win().dieSig())) {
00432 removeWindow(winsubj->win());
00433 renderTheme();
00434 return;
00435 } else if (subj == &(winsubj->win().stateSig())) {
00436 if (mode() == ICONS || mode() == WORKSPACEICONS) {
00437 if (!winsubj->win().isIconic()) {
00438 removeWindow(winsubj->win());
00439 renderTheme();
00440 }
00441 } else if (mode() != WORKSPACE) {
00442 if (winsubj->win().isIconic() && mode() != ALLWINDOWS) {
00443 removeWindow(winsubj->win());
00444 renderTheme();
00445 }
00446 }
00447 return;
00448
00449 } else if (subj == &(winsubj->win().titleSig())) {
00450 renderWindow(winsubj->win());
00451 return;
00452 } else {
00453
00454 return;
00455 }
00456 }
00457
00458 bool remove_all = false;
00459
00460 if (subj != 0 && typeid(*subj) == typeid(BScreen::ScreenSubject) && mode() != ALLWINDOWS) {
00461 BScreen::ScreenSubject *screen_subj = static_cast<BScreen::ScreenSubject *>(subj);
00462
00463 if (&m_screen.currentWorkspaceSig() == screen_subj &&
00464 mode() != ALLWINDOWS && mode() != ICONS) {
00465 remove_all = true;
00466 }
00467
00468
00469
00470 }
00471
00472
00473 m_icon_container.setUpdateLock(true);
00474
00475 if (remove_all)
00476 deleteIcons();
00477
00478
00479 switch (mode()) {
00480 case NONE:
00481 return;
00482 break;
00483 case ICONS:
00484 case WORKSPACEICONS:
00485 updateIcons();
00486 break;
00487 case WORKSPACE:
00488 updateWorkspace();
00489 break;
00490 case ALLWINDOWS:
00491 updateAllWindows();
00492 break;
00493 }
00494
00495
00496 m_icon_container.setUpdateLock(false);
00497 m_icon_container.update();
00498 m_icon_container.showSubwindows();
00499
00500 renderTheme();
00501 }
00502
00503 IconButton *IconbarTool::findButton(FluxboxWindow &win) {
00504
00505 IconList::iterator icon_it = m_icon_list.begin();
00506 IconList::iterator icon_it_end = m_icon_list.end();
00507 for (; icon_it != icon_it_end; ++icon_it) {
00508 if (&(*icon_it)->win() == &win)
00509 return *icon_it;
00510 }
00511
00512 return 0;
00513 }
00514
00515 void IconbarTool::renderWindow(FluxboxWindow &win) {
00516 IconButton *button = findButton(win);
00517 if (button == 0)
00518 return;
00519 renderButton(*button);
00520 }
00521
00522 void IconbarTool::renderTheme() {
00523 Pixmap tmp = m_focused_pm;
00524 Pixmap err_tmp = m_focused_err_pm;
00525 unsigned int icon_width = m_icon_container.maxWidthPerClient();
00526 if (!m_theme.focusedTexture().usePixmap()) {
00527 m_focused_pm = 0;
00528 m_focused_err_pm = 0;
00529 } else {
00530 m_focused_pm = m_screen.imageControl().renderImage(icon_width,
00531 m_icon_container.height(),
00532 m_theme.focusedTexture());
00533 m_focused_err_pm = m_screen.imageControl().renderImage(icon_width+1,
00534 m_icon_container.height(),
00535 m_theme.focusedTexture());
00536 }
00537
00538 if (tmp)
00539 m_screen.imageControl().removeImage(tmp);
00540 if (err_tmp)
00541 m_screen.imageControl().removeImage(err_tmp);
00542
00543 tmp = m_unfocused_pm;
00544 err_tmp = m_unfocused_err_pm;
00545
00546 if (!m_theme.unfocusedTexture().usePixmap()) {
00547 m_unfocused_pm = 0;
00548 m_unfocused_err_pm = 0;
00549 } else {
00550 m_unfocused_pm = m_screen.imageControl().renderImage(icon_width,
00551 m_icon_container.height(),
00552 m_theme.unfocusedTexture());
00553 m_unfocused_err_pm = m_screen.imageControl().renderImage(icon_width+1,
00554 m_icon_container.height(),
00555 m_theme.unfocusedTexture());
00556 }
00557 if (tmp)
00558 m_screen.imageControl().removeImage(tmp);
00559 if (err_tmp)
00560 m_screen.imageControl().removeImage(err_tmp);
00561
00562
00563 tmp = m_empty_pm;
00564 if (!m_theme.emptyTexture().usePixmap()) {
00565 m_empty_pm = 0;
00566 m_icon_container.setBackgroundColor(m_theme.emptyTexture().color());
00567 } else {
00568 m_empty_pm = m_screen.imageControl().renderImage(m_icon_container.width(),
00569 m_icon_container.height(),
00570 m_theme.emptyTexture());
00571 m_icon_container.setBackgroundPixmap(m_empty_pm);
00572 }
00573
00574 if (tmp)
00575 m_screen.imageControl().removeImage(tmp);
00576
00577 m_icon_container.setBorderWidth(m_theme.border().width());
00578 m_icon_container.setBorderColor(m_theme.border().color());
00579 m_icon_container.setAlpha(m_theme.alpha());
00580
00581
00582 IconList::iterator icon_it = m_icon_list.begin();
00583 IconList::iterator icon_it_end = m_icon_list.end();
00584 for (; icon_it != icon_it_end; ++icon_it)
00585 renderButton(*(*icon_it));
00586 }
00587
00588 void IconbarTool::renderButton(IconButton &button) {
00589
00590 button.setPixmap(*m_rc_use_pixmap);
00591 button.setAlpha(m_theme.alpha());
00592
00593
00594
00595 bool wider_button = (button.width() != m_icon_container.back()->width());
00596
00597 if (button.win().isFocused()) {
00598 m_icon_container.setSelected(m_icon_container.find(&button));
00599 button.setGC(m_theme.focusedText().textGC());
00600 button.setFont(m_theme.focusedText().font());
00601 button.setJustify(m_theme.focusedText().justify());
00602
00603 if (!wider_button && m_focused_pm != 0)
00604 button.setBackgroundPixmap(m_focused_pm);
00605 else if (wider_button && m_focused_err_pm != 0)
00606 button.setBackgroundPixmap(m_focused_err_pm);
00607 else
00608 button.setBackgroundColor(m_theme.focusedTexture().color());
00609
00610 button.setBorderWidth(m_theme.focusedBorder().width());
00611 button.setBorderColor(m_theme.focusedBorder().color());
00612
00613 } else {
00614 if (m_icon_container.selected() == &button)
00615 m_icon_container.setSelected(-1);
00616
00617 button.setGC(m_theme.unfocusedText().textGC());
00618 button.setFont(m_theme.unfocusedText().font());
00619 button.setJustify(m_theme.unfocusedText().justify());
00620
00621 if (!wider_button && m_unfocused_pm != 0)
00622 button.setBackgroundPixmap(m_unfocused_pm);
00623 else if (wider_button && m_unfocused_err_pm != 0)
00624 button.setBackgroundPixmap(m_unfocused_err_pm);
00625 else
00626 button.setBackgroundColor(m_theme.unfocusedTexture().color());
00627
00628 button.setBorderWidth(m_theme.unfocusedBorder().width());
00629 button.setBorderColor(m_theme.unfocusedBorder().color());
00630 }
00631
00632 button.clear();
00633 button.updateTransparent();
00634 }
00635
00636 void IconbarTool::deleteIcons() {
00637 m_icon_container.removeAll();
00638 while (!m_icon_list.empty()) {
00639 delete m_icon_list.back();
00640 m_icon_list.pop_back();
00641 }
00642 }
00643
00644 void IconbarTool::removeWindow(FluxboxWindow &win) {
00645
00646 IconList::iterator it = m_icon_list.begin();
00647 IconList::iterator it_end = m_icon_list.end();
00648 for (; it != it_end; ++it) {
00649 if (&(*it)->win() == &win)
00650 break;
00651 }
00652
00653 if (it == m_icon_list.end())
00654 return;
00655
00656
00657 win.focusSig().detach(this);
00658 win.dieSig().detach(this);
00659 win.workspaceSig().detach(this);
00660 win.stateSig().detach(this);
00661 win.titleSig().detach(this);
00662
00663
00664
00665 IconButton *button = *it;
00666
00667 m_icon_container.removeItem(m_icon_container.find(*it));
00668 m_icon_list.erase(it);
00669
00670 delete button;
00671
00672 }
00673
00674 void IconbarTool::addWindow(FluxboxWindow &win) {
00675
00676 if (win.clientList().size() == 0)
00677 return;
00678
00679 IconButton *button = new IconButton(m_icon_container, m_theme.focusedText().font(), win);
00680 m_icon_container.insertItem(button);
00681 m_icon_list.push_back(button);
00682
00683
00684 win.focusSig().attach(this);
00685 win.dieSig().attach(this);
00686 win.workspaceSig().attach(this);
00687 win.stateSig().attach(this);
00688 win.titleSig().attach(this);
00689 }
00690
00691 void IconbarTool::updateIcons() {
00692 std::list<FluxboxWindow *> itemlist;
00693
00694 BScreen::Icons::iterator icon_it = m_screen.getIconList().begin();
00695 BScreen::Icons::iterator icon_it_end = m_screen.getIconList().end();
00696 for (; icon_it != icon_it_end; ++icon_it) {
00697 if (mode() == ICONS)
00698 itemlist.push_back(*icon_it);
00699 else if (mode() == WORKSPACEICONS && (*icon_it)->workspaceNumber() == m_screen.currentWorkspaceID())
00700 itemlist.push_back(*icon_it);
00701 }
00702 removeDuplicate(m_icon_list, itemlist);
00703 addList(itemlist);
00704 }
00705
00706 void IconbarTool::updateWorkspace() {
00707 std::list<FluxboxWindow *> itemlist;
00708
00709 Workspace &space = *m_screen.currentWorkspace();
00710 Workspace::Windows::iterator win_it = space.windowList().begin();
00711 Workspace::Windows::iterator win_it_end = space.windowList().end();
00712 for (; win_it != win_it_end; ++win_it) {
00713 if (checkAddWindow(mode(), **win_it))
00714 itemlist.push_back(*win_it);
00715 }
00716
00717 BScreen::Icons::iterator icon_it = m_screen.getIconList().begin();
00718 BScreen::Icons::iterator icon_it_end = m_screen.getIconList().end();
00719 for (; icon_it != icon_it_end; ++icon_it) {
00720 if ((*icon_it)->workspaceNumber() == m_screen.currentWorkspaceID())
00721 itemlist.push_back(*icon_it);
00722 }
00723
00724 removeDuplicate(m_icon_list, itemlist);
00725 addList(itemlist);
00726 }
00727
00728
00729 void IconbarTool::updateAllWindows() {
00730 std::list<FluxboxWindow *> full_list;
00731
00732 BScreen::Workspaces::iterator workspace_it = m_screen.getWorkspacesList().begin();
00733 BScreen::Workspaces::iterator workspace_it_end = m_screen.getWorkspacesList().end();
00734 for (; workspace_it != workspace_it_end; ++workspace_it) {
00735 full_list.insert(full_list.end(),
00736 (*workspace_it)->windowList().begin(),
00737 (*workspace_it)->windowList().end());
00738 }
00739
00740 full_list.insert(full_list.end(),
00741 m_screen.getIconList().begin(),
00742 m_screen.getIconList().end());
00743
00744 removeDuplicate(m_icon_list, full_list);
00745 addList(full_list);
00746 }
00747
00748 void IconbarTool::addList(std::list<FluxboxWindow *> &winlist) {
00749
00750 std::list<FluxboxWindow *>::iterator it = winlist.begin();
00751 std::list<FluxboxWindow *>::iterator it_end = winlist.end();
00752 for (; it != it_end; ++it)
00753 addWindow(**it);
00754 }
00755
00756 void IconbarTool::timedRender() {
00757 WinClient *client = Fluxbox::instance()->getFocusedWindow();
00758 if (client == 0 || client->fbwindow() == 0)
00759 return;
00760
00761 IconButton *button = findButton(*client->fbwindow());
00762 IconButton *current_button = static_cast<IconButton *>(m_icon_container.selected());
00763
00764
00765 if (button == current_button)
00766 return;
00767 if (button != 0)
00768 renderButton(*button);
00769 if (current_button != 0)
00770 renderButton(*current_button);
00771
00772 }
00773