diff options
author | fluxgen <fluxgen> | 2003-12-03 00:33:30 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-12-03 00:33:30 (GMT) |
commit | 5e9b6453f0d71c64f18e8082d53f9a42e2b3ae66 (patch) | |
tree | 6ac6f11bd46e55a5ce8f1e24e14ad4584d357c23 /src/Toolbar.cc | |
parent | 8971b068ac4ab9a74bccfee93b3314a83b3cbc15 (diff) | |
download | fluxbox-5e9b6453f0d71c64f18e8082d53f9a42e2b3ae66.zip fluxbox-5e9b6453f0d71c64f18e8082d53f9a42e2b3ae66.tar.bz2 |
removed ToolbarHandler
Diffstat (limited to 'src/Toolbar.cc')
-rw-r--r-- | src/Toolbar.cc | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 9b76ed6..23aab97 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.126 2003/10/31 10:37:09 rathnor Exp $ | 25 | // $Id: Toolbar.cc,v 1.127 2003/12/03 00:32:13 fluxgen Exp $ |
26 | 26 | ||
27 | #include "Toolbar.hh" | 27 | #include "Toolbar.hh" |
28 | 28 | ||
@@ -186,21 +186,23 @@ Toolbar::Frame::~Frame() { | |||
186 | evm.remove(window); | 186 | evm.remove(window); |
187 | } | 187 | } |
188 | 188 | ||
189 | Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t width): | 189 | Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width): |
190 | m_hidden(false), | 190 | m_hidden(false), |
191 | frame(*this, scrn.screenNumber()), | 191 | frame(*this, scrn.screenNumber()), |
192 | m_window_pm(0), | 192 | m_window_pm(0), |
193 | m_screen(scrn), | 193 | m_screen(scrn), |
194 | m_toolbarmenu(menu), | ||
195 | m_placementmenu(*scrn.menuTheme(), | ||
196 | scrn.screenNumber(), scrn.imageControl(), | ||
197 | *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), | ||
198 | m_layermenu(*scrn.menuTheme(), | 194 | m_layermenu(*scrn.menuTheme(), |
199 | scrn.screenNumber(), | 195 | scrn.screenNumber(), |
200 | scrn.imageControl(), | 196 | scrn.imageControl(), |
201 | *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), | 197 | *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), |
202 | this, | 198 | this, |
203 | true), | 199 | true), |
200 | m_placementmenu(*scrn.menuTheme(), | ||
201 | scrn.screenNumber(), scrn.imageControl(), | ||
202 | *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), | ||
203 | m_toolbarmenu(*scrn.menuTheme(), | ||
204 | scrn.screenNumber(), scrn.imageControl(), | ||
205 | *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), | ||
204 | m_theme(scrn.screenNumber()), | 206 | m_theme(scrn.screenNumber()), |
205 | m_layeritem(frame.window, layer), | 207 | m_layeritem(frame.window, layer), |
206 | m_tool_factory(scrn), | 208 | m_tool_factory(scrn), |
@@ -270,6 +272,10 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t wi | |||
270 | 272 | ||
271 | Toolbar::~Toolbar() { | 273 | Toolbar::~Toolbar() { |
272 | FbTk::EventManager::instance()->remove(window()); | 274 | FbTk::EventManager::instance()->remove(window()); |
275 | // remove menu items before we delete tools so we dont end up | ||
276 | // with dangling pointers to old submenu items (internal menus) | ||
277 | // from the tools | ||
278 | menu().removeAll(); | ||
273 | 279 | ||
274 | deleteItems(); | 280 | deleteItems(); |
275 | clearStrut(); | 281 | clearStrut(); |
@@ -445,7 +451,7 @@ void Toolbar::reconfigure() { | |||
445 | 451 | ||
446 | rearrangeItems(); | 452 | rearrangeItems(); |
447 | 453 | ||
448 | m_toolbarmenu.reconfigure(); | 454 | menu().reconfigure(); |
449 | // we're done with all resizing and stuff now we can request a new | 455 | // we're done with all resizing and stuff now we can request a new |
450 | // area to be reserved on screen | 456 | // area to be reserved on screen |
451 | updateStrut(); | 457 | updateStrut(); |
@@ -458,26 +464,26 @@ void Toolbar::buttonPressEvent(XButtonEvent &be) { | |||
458 | if (be.button != 3) | 464 | if (be.button != 3) |
459 | return; | 465 | return; |
460 | 466 | ||
461 | if (! m_toolbarmenu.isVisible()) { | 467 | if (! menu().isVisible()) { |
462 | int x, y; | 468 | int x, y; |
463 | 469 | ||
464 | x = be.x_root - (m_toolbarmenu.width() / 2); | 470 | x = be.x_root - (menu().width() / 2); |
465 | y = be.y_root - (m_toolbarmenu.height() / 2); | 471 | y = be.y_root - (menu().height() / 2); |
466 | 472 | ||
467 | if (x < 0) | 473 | if (x < 0) |
468 | x = 0; | 474 | x = 0; |
469 | else if (x + m_toolbarmenu.width() > screen().width()) | 475 | else if (x + menu().width() > screen().width()) |
470 | x = screen().width() - m_toolbarmenu.width(); | 476 | x = screen().width() - menu().width(); |
471 | 477 | ||
472 | if (y < 0) | 478 | if (y < 0) |
473 | y = 0; | 479 | y = 0; |
474 | else if (y + m_toolbarmenu.height() > screen().height()) | 480 | else if (y + menu().height() > screen().height()) |
475 | y = screen().height() - m_toolbarmenu.height(); | 481 | y = screen().height() - menu().height(); |
476 | 482 | ||
477 | m_toolbarmenu.move(x, y); | 483 | menu().move(x, y); |
478 | m_toolbarmenu.show(); | 484 | menu().show(); |
479 | } else | 485 | } else |
480 | m_toolbarmenu.hide(); | 486 | menu().hide(); |
481 | 487 | ||
482 | } | 488 | } |
483 | 489 | ||
@@ -512,7 +518,7 @@ void Toolbar::leaveNotifyEvent(XCrossingEvent ¬_used) { | |||
512 | if (isHidden()) { | 518 | if (isHidden()) { |
513 | if (m_hide_timer.isTiming()) | 519 | if (m_hide_timer.isTiming()) |
514 | m_hide_timer.stop(); | 520 | m_hide_timer.stop(); |
515 | } else if (! m_toolbarmenu.isVisible() && ! m_hide_timer.isTiming()) | 521 | } else if (! menu().isVisible() && ! m_hide_timer.isTiming()) |
516 | m_hide_timer.start(); | 522 | m_hide_timer.start(); |
517 | 523 | ||
518 | } | 524 | } |