diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2010-09-05 08:49:05 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2010-09-05 08:49:05 (GMT) |
commit | 8feb0b8c83559e44bc6b2fc418c9cf7b6b46a03c (patch) | |
tree | f6a2ba871afcf5dd16ca9ea2754938cc66c1310a /src/FbTk | |
parent | 83656fc0e817c2a00a315176e651881cdfc804eb (diff) | |
download | fluxbox_paul-8feb0b8c83559e44bc6b2fc418c9cf7b6b46a03c.zip fluxbox_paul-8feb0b8c83559e44bc6b2fc418c9cf7b6b46a03c.tar.bz2 |
avoid constructing new strings implicit
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/MenuItem.cc | 6 | ||||
-rw-r--r-- | src/FbTk/TextBox.cc | 2 | ||||
-rw-r--r-- | src/FbTk/TextButton.cc | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/FbTk/MenuItem.cc b/src/FbTk/MenuItem.cc index dcd7dd7..f995666 100644 --- a/src/FbTk/MenuItem.cc +++ b/src/FbTk/MenuItem.cc | |||
@@ -54,12 +54,12 @@ void MenuItem::drawLine(FbDrawable &draw, | |||
54 | int bottom = height - bevelW - 1; | 54 | int bottom = height - bevelW - 1; |
55 | 55 | ||
56 | text_y += bottom > underline_height ? underline_height : bottom; | 56 | text_y += bottom > underline_height ? underline_height : bottom; |
57 | int text_w = theme->frameFont().textWidth(m_label.c_str(), m_label.size()); | 57 | int text_w = theme->frameFont().textWidth(m_label, m_label.size()); |
58 | 58 | ||
59 | // width of the searchstring | 59 | // width of the searchstring |
60 | size = size > m_label.length() ? m_label.length() : size; | 60 | size = size > m_label.length() ? m_label.length() : size; |
61 | std::string search_string = m_label.substr(0,size); | 61 | std::string search_string = m_label.substr(0,size); |
62 | int search_string_w = theme->frameFont().textWidth(search_string.c_str(), size); | 62 | int search_string_w = theme->frameFont().textWidth(search_string, size); |
63 | 63 | ||
64 | // pay attention to the text justification | 64 | // pay attention to the text justification |
65 | switch(theme->frameFontJustify()) { | 65 | switch(theme->frameFontJustify()) { |
@@ -157,7 +157,7 @@ void MenuItem::draw(FbDrawable &draw, | |||
157 | // | 157 | // |
158 | int text_y = y, text_x = x; | 158 | int text_y = y, text_x = x; |
159 | 159 | ||
160 | int text_w = theme->frameFont().textWidth(label().c_str(), label().size()); | 160 | int text_w = theme->frameFont().textWidth(label(), label().size()); |
161 | 161 | ||
162 | int height_offset = theme->itemHeight() - (theme->frameFont().height() + 2*theme->bevelWidth()); | 162 | int height_offset = theme->itemHeight() - (theme->frameFont().height() + 2*theme->bevelWidth()); |
163 | text_y = y + theme->bevelWidth() + theme->frameFont().ascent() + height_offset/2; | 163 | text_y = y + theme->bevelWidth() + theme->frameFont().ascent() + height_offset/2; |
diff --git a/src/FbTk/TextBox.cc b/src/FbTk/TextBox.cc index 87ad609..87e18e8 100644 --- a/src/FbTk/TextBox.cc +++ b/src/FbTk/TextBox.cc | |||
@@ -369,7 +369,7 @@ void TextBox::adjustEndPos() { | |||
369 | 369 | ||
370 | void TextBox::adjustStartPos() { | 370 | void TextBox::adjustStartPos() { |
371 | 371 | ||
372 | int text_width = font().textWidth(text().c_str(), m_end_pos); | 372 | int text_width = font().textWidth(text(), m_end_pos); |
373 | if (text_width < static_cast<signed>(width())) | 373 | if (text_width < static_cast<signed>(width())) |
374 | return; | 374 | return; |
375 | 375 | ||
diff --git a/src/FbTk/TextButton.cc b/src/FbTk/TextButton.cc index 380537e..04aa367 100644 --- a/src/FbTk/TextButton.cc +++ b/src/FbTk/TextButton.cc | |||
@@ -126,7 +126,7 @@ void TextButton::clearArea(int x, int y, | |||
126 | 126 | ||
127 | 127 | ||
128 | unsigned int TextButton::textWidth() const { | 128 | unsigned int TextButton::textWidth() const { |
129 | return font().textWidth(text().data(), text().size()); | 129 | return font().textWidth(text(), text().size()); |
130 | } | 130 | } |
131 | 131 | ||
132 | void TextButton::renderForeground(FbWindow &win, FbDrawable &drawable) { | 132 | void TextButton::renderForeground(FbWindow &win, FbDrawable &drawable) { |
@@ -161,7 +161,7 @@ void TextButton::drawText(int x_offset, int y_offset, FbDrawable *drawable) { | |||
161 | font().drawText(*drawable, | 161 | font().drawText(*drawable, |
162 | screenNumber(), | 162 | screenNumber(), |
163 | gc(), // graphic context | 163 | gc(), // graphic context |
164 | text().data(), textlen, // string and string size | 164 | text(), textlen, // string and string size |
165 | textx, texty, m_orientation); // position | 165 | textx, texty, m_orientation); // position |
166 | } | 166 | } |
167 | 167 | ||