aboutsummaryrefslogtreecommitdiff
path: root/src/Toolbar.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-03-03 21:51:13 (GMT)
committerrathnor <rathnor>2003-03-03 21:51:13 (GMT)
commit19875e5a5ba474387971ede597cdc4aa7454d4c0 (patch)
tree99d672abcffa86d74734deacbd888eccde02ffd2 /src/Toolbar.cc
parent824fd0db7a4b8117fecba9bb46053bdd38691803 (diff)
downloadfluxbox-19875e5a5ba474387971ede597cdc4aa7454d4c0.zip
fluxbox-19875e5a5ba474387971ede597cdc4aa7454d4c0.tar.bz2
Add code for toolbar modes
Diffstat (limited to 'src/Toolbar.cc')
-rw-r--r--src/Toolbar.cc75
1 files changed, 44 insertions, 31 deletions
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index 38e4bc3..1aa8764 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Toolbar.cc,v 1.64 2003/02/23 19:13:22 fluxgen Exp $ 25// $Id: Toolbar.cc,v 1.65 2003/03/03 21:51:07 rathnor Exp $
26 26
27#include "Toolbar.hh" 27#include "Toolbar.hh"
28 28
@@ -84,6 +84,7 @@ private:
84 Toolbar::Placement m_place; 84 Toolbar::Placement m_place;
85}; 85};
86 86
87
87void setupMenus(Toolbar &tbar) { 88void setupMenus(Toolbar &tbar) {
88 I18n *i18n = I18n::instance(); 89 I18n *i18n = I18n::instance();
89 using namespace FBNLS; 90 using namespace FBNLS;
@@ -213,7 +214,7 @@ Toolbar::Frame::~Frame() {
213 evm.remove(clock); 214 evm.remove(clock);
214} 215}
215 216
216Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width): 217Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t width):
217 editing(false), 218 editing(false),
218 hidden(scrn.doToolbarAutoHide()), 219 hidden(scrn.doToolbarAutoHide()),
219 do_auto_hide(scrn.doToolbarAutoHide()), 220 do_auto_hide(scrn.doToolbarAutoHide()),
@@ -222,8 +223,7 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width):
222 image_ctrl(*scrn.getImageControl()), 223 image_ctrl(*scrn.getImageControl()),
223 clock_timer(this), // get the clock updating every minute 224 clock_timer(this), // get the clock updating every minute
224 hide_timer(&hide_handler), 225 hide_timer(&hide_handler),
225 m_toolbarmenu(*scrn.menuTheme(), 226 m_toolbarmenu(menu),
226 scrn.getScreenNumber(), *scrn.getImageControl()),
227 m_placementmenu(*scrn.menuTheme(), 227 m_placementmenu(*scrn.menuTheme(),
228 scrn.getScreenNumber(), *scrn.getImageControl()), 228 scrn.getScreenNumber(), *scrn.getImageControl()),
229 m_layermenu(*scrn.menuTheme(), 229 m_layermenu(*scrn.menuTheme(),
@@ -267,9 +267,9 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width):
267 frame.base = frame.label = frame.wlabel = frame.clk = frame.button = 267 frame.base = frame.label = frame.wlabel = frame.clk = frame.button =
268 frame.pbutton = None; 268 frame.pbutton = None;
269 269
270 270 //DEL/fix -> remove useIconBar resource
271 if (Fluxbox::instance()->useIconBar()) 271// if (Fluxbox::instance()->useIconBar())
272 m_iconbar.reset(new IconBar(&screen(), frame.window_label.window(), m_theme.font())); 272 m_iconbar.reset(new IconBar(&screen(), frame.window_label.window(), m_theme.font()));
273 273
274 274
275 XMapSubwindows(display, frame.window.window()); 275 XMapSubwindows(display, frame.window.window());
@@ -325,7 +325,43 @@ void Toolbar::delIcon(FluxboxWindow *w) {
325 if (m_iconbar.get() != 0) 325 if (m_iconbar.get() != 0)
326 FbTk::EventManager::instance()->remove(m_iconbar->delIcon(w)); 326 FbTk::EventManager::instance()->remove(m_iconbar->delIcon(w));
327} 327}
328 328
329void Toolbar::delAllIcons() {
330 if (m_iconbar.get() == 0)
331 return;
332
333 IconBar::WindowList *deleted = m_iconbar->delAllIcons();
334 IconBar::WindowList::iterator it = deleted->begin();
335 IconBar::WindowList::iterator it_end = deleted->end();
336 for (; it != it_end; ++it) {
337 FbTk::EventManager::instance()->remove(*it);
338 }
339 delete deleted;
340}
341
342bool Toolbar::containsIcon(FluxboxWindow &win) {
343 return (m_iconbar->findIcon(&win) != 0);
344}
345
346void Toolbar::enableIconBar() {
347 // already on
348 if (m_iconbar.get() != 0)
349 return;
350 m_iconbar.reset(new IconBar(&screen(), frame.window_label.window(), m_theme.font()));
351}
352
353void Toolbar::disableIconBar() {
354 // already off
355 if (m_iconbar.get() == 0)
356 return;
357
358 delAllIcons();
359
360 m_iconbar.reset(0); // destroy iconbar
361
362}
363
364
329void Toolbar::reconfigure() { 365void Toolbar::reconfigure() {
330 366
331 if (do_auto_hide == false && 367 if (do_auto_hide == false &&
@@ -592,29 +628,6 @@ void Toolbar::reconfigure() {
592 628
593 m_toolbarmenu.reconfigure(); 629 m_toolbarmenu.reconfigure();
594 630
595 if (Fluxbox::instance()->useIconBar()) {
596 if (m_iconbar.get() == 0) { // create new iconbar if we don't have one
597 m_iconbar.reset(new IconBar(&screen(), frame.window_label.window(), m_theme.font()));
598 if (screen().getIconCount()) {
599 BScreen::Icons & l = screen().getIconList();
600 BScreen::Icons::iterator it = l.begin();
601 BScreen::Icons::iterator it_end = l.end();
602 for(; it != it_end; ++it) {
603 addIcon(*it);
604 }
605 }
606
607 } else
608 m_iconbar->reconfigure();
609 } else if (m_iconbar.get() != 0) {
610 BScreen::Icons & l = screen().getIconList();
611 BScreen::Icons::iterator it = l.begin();
612 BScreen::Icons::iterator it_end = l.end();
613 for(; it != it_end; ++it)
614 delIcon(*it);
615
616 m_iconbar.reset(0); // destroy iconbar
617 }
618} 631}
619 632
620 633