aboutsummaryrefslogtreecommitdiff
path: root/src/WorkspaceNameTool.cc
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2010-09-08 18:17:21 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2010-09-08 18:17:21 (GMT)
commit690d926ac444243611cd875fb84fabb4e6db2cf2 (patch)
treec8ef84056b295071f9a9207ffea5393c6cf4ad4d /src/WorkspaceNameTool.cc
parent1e8fe2bc14856fa16508686a28a85e72cb0e422c (diff)
downloadfluxbox-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/WorkspaceNameTool.cc')
-rw-r--r--src/WorkspaceNameTool.cc10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/WorkspaceNameTool.cc b/src/WorkspaceNameTool.cc
index 579592f..fc944f9 100644
--- a/src/WorkspaceNameTool.cc
+++ b/src/WorkspaceNameTool.cc
@@ -34,7 +34,7 @@
34WorkspaceNameTool::WorkspaceNameTool(const FbTk::FbWindow &parent, 34WorkspaceNameTool::WorkspaceNameTool(const FbTk::FbWindow &parent,
35 FbTk::ThemeProxy<ToolTheme> &theme, BScreen &screen): 35 FbTk::ThemeProxy<ToolTheme> &theme, BScreen &screen):
36 ToolbarItem(ToolbarItem::FIXED), 36 ToolbarItem(ToolbarItem::FIXED),
37 m_button(parent, theme->font(), "a workspace name"), 37 m_button(parent, theme->font(), FbTk::BiDiString("a workspace name")),
38 m_theme(theme), 38 m_theme(theme),
39 m_screen(screen), 39 m_screen(screen),
40 m_pixmap(0) { 40 m_pixmap(0) {
@@ -93,9 +93,7 @@ unsigned int WorkspaceNameTool::width() const {
93 const BScreen::Workspaces& workspaces = m_screen.getWorkspacesList(); 93 const BScreen::Workspaces& workspaces = m_screen.getWorkspacesList();
94 BScreen::Workspaces::const_iterator it; 94 BScreen::Workspaces::const_iterator it;
95 for (it = workspaces.begin(); it != workspaces.end(); it++) { 95 for (it = workspaces.begin(); it != workspaces.end(); it++) {
96 const std::string &name = (*it)->name(); 96 max_size = std::max(m_theme->font().textWidth((*it)->name()), max_size);
97 max_size = std::max(m_theme->font().textWidth(name, name.size()),
98 max_size);
99 } 97 }
100 // so align text dont cut the last character 98 // so align text dont cut the last character
101 max_size += 2; 99 max_size += 2;
@@ -111,9 +109,7 @@ unsigned int WorkspaceNameTool::height() const {
111 const BScreen::Workspaces& workspaces = m_screen.getWorkspacesList(); 109 const BScreen::Workspaces& workspaces = m_screen.getWorkspacesList();
112 BScreen::Workspaces::const_iterator it; 110 BScreen::Workspaces::const_iterator it;
113 for (it = workspaces.begin(); it != workspaces.end(); it++) { 111 for (it = workspaces.begin(); it != workspaces.end(); it++) {
114 const std::string &name = (*it)->name(); 112 max_size = std::max(m_theme->font().textWidth((*it)->name()), max_size);
115 max_size = std::max(m_theme->font().textWidth(name, name.size()),
116 max_size);
117 } 113 }
118 // so align text dont cut the last character 114 // so align text dont cut the last character
119 max_size += 2; 115 max_size += 2;