avoid constructing new strings implicit
This commit is contained in:
parent
83656fc0e8
commit
8feb0b8c83
4 changed files with 7 additions and 7 deletions
|
@ -255,7 +255,7 @@ void ClockTool::update(FbTk::Subject *subj) {
|
|||
unsigned int new_width = m_button.width();
|
||||
unsigned int new_height = m_button.height();
|
||||
translateSize(orientation(), new_width, new_height);
|
||||
new_width = m_theme->font().textWidth(text.c_str(), text.size());
|
||||
new_width = m_theme->font().textWidth(text, text.size());
|
||||
translateSize(orientation(), new_width, new_height);
|
||||
if (new_width != m_button.width() || new_height != m_button.height()) {
|
||||
resize(new_width, new_height);
|
||||
|
|
|
@ -54,12 +54,12 @@ void MenuItem::drawLine(FbDrawable &draw,
|
|||
int bottom = height - bevelW - 1;
|
||||
|
||||
text_y += bottom > underline_height ? underline_height : bottom;
|
||||
int text_w = theme->frameFont().textWidth(m_label.c_str(), m_label.size());
|
||||
int text_w = theme->frameFont().textWidth(m_label, m_label.size());
|
||||
|
||||
// width of the searchstring
|
||||
size = size > m_label.length() ? m_label.length() : size;
|
||||
std::string search_string = m_label.substr(0,size);
|
||||
int search_string_w = theme->frameFont().textWidth(search_string.c_str(), size);
|
||||
int search_string_w = theme->frameFont().textWidth(search_string, size);
|
||||
|
||||
// pay attention to the text justification
|
||||
switch(theme->frameFontJustify()) {
|
||||
|
@ -157,7 +157,7 @@ void MenuItem::draw(FbDrawable &draw,
|
|||
//
|
||||
int text_y = y, text_x = x;
|
||||
|
||||
int text_w = theme->frameFont().textWidth(label().c_str(), label().size());
|
||||
int text_w = theme->frameFont().textWidth(label(), label().size());
|
||||
|
||||
int height_offset = theme->itemHeight() - (theme->frameFont().height() + 2*theme->bevelWidth());
|
||||
text_y = y + theme->bevelWidth() + theme->frameFont().ascent() + height_offset/2;
|
||||
|
|
|
@ -369,7 +369,7 @@ void TextBox::adjustEndPos() {
|
|||
|
||||
void TextBox::adjustStartPos() {
|
||||
|
||||
int text_width = font().textWidth(text().c_str(), m_end_pos);
|
||||
int text_width = font().textWidth(text(), m_end_pos);
|
||||
if (text_width < static_cast<signed>(width()))
|
||||
return;
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ void TextButton::clearArea(int x, int y,
|
|||
|
||||
|
||||
unsigned int TextButton::textWidth() const {
|
||||
return font().textWidth(text().data(), text().size());
|
||||
return font().textWidth(text(), text().size());
|
||||
}
|
||||
|
||||
void TextButton::renderForeground(FbWindow &win, FbDrawable &drawable) {
|
||||
|
@ -161,7 +161,7 @@ void TextButton::drawText(int x_offset, int y_offset, FbDrawable *drawable) {
|
|||
font().drawText(*drawable,
|
||||
screenNumber(),
|
||||
gc(), // graphic context
|
||||
text().data(), textlen, // string and string size
|
||||
text(), textlen, // string and string size
|
||||
textx, texty, m_orientation); // position
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue