diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2010-09-08 18:17:21 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2010-09-08 18:17:21 (GMT) |
commit | 690d926ac444243611cd875fb84fabb4e6db2cf2 (patch) | |
tree | c8ef84056b295071f9a9207ffea5393c6cf4ad4d /src/FbTk/Menu.cc | |
parent | 1e8fe2bc14856fa16508686a28a85e72cb0e422c (diff) | |
download | fluxbox-690d926ac444243611cd875fb84fabb4e6db2cf2.zip fluxbox-690d926ac444243611cd875fb84fabb4e6db2cf2.tar.bz2 |
introduced FbTk::BidiString
a 'BidiString' holds both the logical content and the visual reordered
version of the content of a string. this helps to reduce the number of
calls to reorder the string before drawing it (as introduced in the patch
from Ken Bloom) and to be more consistent in menus and textboxes (drawing
cursors and underlining text).
Diffstat (limited to 'src/FbTk/Menu.cc')
-rw-r--r-- | src/FbTk/Menu.cc | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index ded5dab..811964c 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc | |||
@@ -375,8 +375,7 @@ void Menu::enableTitle() { | |||
375 | 375 | ||
376 | void Menu::updateMenu() { | 376 | void Menu::updateMenu() { |
377 | if (m_title_vis) { | 377 | if (m_title_vis) { |
378 | menu.item_w = theme()->titleFont().textWidth(menu.label, | 378 | menu.item_w = theme()->titleFont().textWidth(menu.label); |
379 | menu.label.size()); | ||
380 | menu.item_w += (theme()->bevelWidth() * 2); | 379 | menu.item_w += (theme()->bevelWidth() * 2); |
381 | } else | 380 | } else |
382 | menu.item_w = 1; | 381 | menu.item_w = 1; |
@@ -669,8 +668,7 @@ void Menu::redrawTitle(FbDrawable &drawable) { | |||
669 | 668 | ||
670 | const FbTk::Font &font = theme()->titleFont(); | 669 | const FbTk::Font &font = theme()->titleFont(); |
671 | int dx = theme()->bevelWidth(); | 670 | int dx = theme()->bevelWidth(); |
672 | size_t len = menu.label.size(); | 671 | unsigned int l = font.textWidth(menu.label) + theme()->bevelWidth()*2; |
673 | unsigned int l = font.textWidth(menu.label, len) + theme()->bevelWidth()*2; | ||
674 | 672 | ||
675 | switch (theme()->titleFontJustify()) { | 673 | switch (theme()->titleFontJustify()) { |
676 | case FbTk::RIGHT: | 674 | case FbTk::RIGHT: |
@@ -686,10 +684,7 @@ void Menu::redrawTitle(FbDrawable &drawable) { | |||
686 | 684 | ||
687 | // difference between height based on font, and style-set height | 685 | // difference between height based on font, and style-set height |
688 | int height_offset = theme()->titleHeight() - (font.height() + 2*theme()->bevelWidth()); | 686 | int height_offset = theme()->titleHeight() - (font.height() + 2*theme()->bevelWidth()); |
689 | font.drawText(drawable, // drawable | 687 | font.drawText(drawable, screenNumber(), theme()->titleTextGC().gc(), menu.label, |
690 | screenNumber(), | ||
691 | theme()->titleTextGC().gc(), // graphic context | ||
692 | menu.label, len, // text string with length | ||
693 | dx, font.ascent() + theme()->bevelWidth() + height_offset/2); // position | 688 | dx, font.ascent() + theme()->bevelWidth() + height_offset/2); // position |
694 | } | 689 | } |
695 | 690 | ||
@@ -795,7 +790,7 @@ int Menu::drawItem(FbDrawable &drawable, unsigned int index, | |||
795 | return item_y; | 790 | return item_y; |
796 | } | 791 | } |
797 | 792 | ||
798 | void Menu::setLabel(const FbString &labelstr) { | 793 | void Menu::setLabel(const FbTk::BiDiString &labelstr) { |
799 | //make sure we don't send 0 to std::string | 794 | //make sure we don't send 0 to std::string |
800 | menu.label = labelstr; | 795 | menu.label = labelstr; |
801 | reconfigure(); | 796 | reconfigure(); |