diff options
Diffstat (limited to 'src/Toolbar.cc')
-rw-r--r-- | src/Toolbar.cc | 53 |
1 files changed, 50 insertions, 3 deletions
diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 544a1e3..c87e1ca 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.90 2003/06/13 05:04:14 fluxgen Exp $ | 25 | // $Id: Toolbar.cc,v 1.91 2003/06/18 13:50:40 fluxgen Exp $ |
26 | 26 | ||
27 | #include "Toolbar.hh" | 27 | #include "Toolbar.hh" |
28 | 28 | ||
@@ -43,6 +43,7 @@ | |||
43 | #include "BoolMenuItem.hh" | 43 | #include "BoolMenuItem.hh" |
44 | #include "FbWinFrameTheme.hh" | 44 | #include "FbWinFrameTheme.hh" |
45 | #include "Xinerama.hh" | 45 | #include "Xinerama.hh" |
46 | #include "Strut.hh" | ||
46 | 47 | ||
47 | // use GNU extensions | 48 | // use GNU extensions |
48 | #ifndef _GNU_SOURCE | 49 | #ifndef _GNU_SOURCE |
@@ -279,7 +280,8 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t wi | |||
279 | m_theme(scrn.screenNumber()), | 280 | m_theme(scrn.screenNumber()), |
280 | m_place(scrn.toolbarPlacement()), | 281 | m_place(scrn.toolbarPlacement()), |
281 | m_themelistener(*this), | 282 | m_themelistener(*this), |
282 | m_layeritem(frame.window, layer) { | 283 | m_layeritem(frame.window, layer), |
284 | m_strut(0) { | ||
283 | 285 | ||
284 | // we need to get notified when the theme is reloaded | 286 | // we need to get notified when the theme is reloaded |
285 | m_theme.addListener(m_themelistener); | 287 | m_theme.addListener(m_themelistener); |
@@ -339,6 +341,7 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t wi | |||
339 | 341 | ||
340 | 342 | ||
341 | Toolbar::~Toolbar() { | 343 | Toolbar::~Toolbar() { |
344 | clearStrut(); | ||
342 | FbTk::ImageControl &image_ctrl = screen().imageControl(); | 345 | FbTk::ImageControl &image_ctrl = screen().imageControl(); |
343 | if (frame.base) image_ctrl.removeImage(frame.base); | 346 | if (frame.base) image_ctrl.removeImage(frame.base); |
344 | if (frame.label) image_ctrl.removeImage(frame.label); | 347 | if (frame.label) image_ctrl.removeImage(frame.label); |
@@ -349,6 +352,48 @@ Toolbar::~Toolbar() { | |||
349 | 352 | ||
350 | } | 353 | } |
351 | 354 | ||
355 | void Toolbar::clearStrut() { | ||
356 | if (m_strut) { | ||
357 | screen().clearStrut(m_strut); | ||
358 | m_strut = 0; | ||
359 | } | ||
360 | } | ||
361 | |||
362 | void Toolbar::updateStrut() { | ||
363 | clearStrut(); | ||
364 | // we should request space if we're in autohide mode or | ||
365 | // if the user dont want to request space for toolbar. | ||
366 | if (doAutoHide()) | ||
367 | return; | ||
368 | |||
369 | // request area on screen | ||
370 | int top = 0, bottom = 0, left = 0, right = 0; | ||
371 | switch (m_place) { | ||
372 | case TOPLEFT: | ||
373 | case TOPCENTER: | ||
374 | case TOPRIGHT: | ||
375 | top = height(); | ||
376 | break; | ||
377 | case BOTTOMLEFT: | ||
378 | case BOTTOMCENTER: | ||
379 | case BOTTOMRIGHT: | ||
380 | bottom = height(); | ||
381 | break; | ||
382 | case RIGHTTOP: | ||
383 | case RIGHTCENTER: | ||
384 | case RIGHTBOTTOM: | ||
385 | right = width(); | ||
386 | break; | ||
387 | case LEFTTOP: | ||
388 | case LEFTCENTER: | ||
389 | case LEFTBOTTOM: | ||
390 | left = width(); | ||
391 | break; | ||
392 | }; | ||
393 | m_strut = screen().requestStrut(left, right, top, bottom); | ||
394 | screen().updateAvailableWorkspaceArea(); | ||
395 | } | ||
396 | |||
352 | bool Toolbar::isVertical() const { | 397 | bool Toolbar::isVertical() const { |
353 | return (m_place == RIGHTCENTER || | 398 | return (m_place == RIGHTCENTER || |
354 | m_place == RIGHTTOP || | 399 | m_place == RIGHTTOP || |
@@ -702,7 +747,9 @@ void Toolbar::reconfigure() { | |||
702 | checkClock(true); | 747 | checkClock(true); |
703 | 748 | ||
704 | m_toolbarmenu.reconfigure(); | 749 | m_toolbarmenu.reconfigure(); |
705 | 750 | // we're done with all resizing and stuff now we can request a new | |
751 | // area to be reserv on screen | ||
752 | updateStrut(); | ||
706 | } | 753 | } |
707 | 754 | ||
708 | 755 | ||