Fixed one of the glitches introduced in previous commit

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@4291 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2009-12-14 20:43:49 +00:00
parent 68ba369ff4
commit ffc5d397e8
4 changed files with 11 additions and 3 deletions

View File

@@ -580,9 +580,13 @@ void DynamicRibbonWidget::updateItemDisplay()
icon->setImage( item_icon.c_str() );
icon->m_properties[PROP_ID] = m_items[icon_id].m_code_name;
icon->setLabel(m_items[icon_id].m_user_name);
icon->m_text = m_items[icon_id].m_user_name;
icon->m_lock_badge = m_items[icon_id].m_locked;
std::wcout << L"Setting widget text '" << icon->m_text.c_str() << L"'\n";
// if the ribbon has no "ribbon-wide" label, call will do nothing
row.setLabel(i, m_items[icon_id].m_user_name);
}
else

View File

@@ -91,9 +91,10 @@ void IconButtonWidget::setImage(const char* path_to_texture)
m_texture_h = m_texture->getSize().Height;
}
// -----------------------------------------------------------------------------
void IconButtonWidget::setLabel(std::string new_label)
void IconButtonWidget::setLabel(stringw new_label)
{
// FIXME: does not update m_text. Is this a behaviour we want?
if (m_label == NULL) return;
m_label->setText( stringw(new_label.c_str()).c_str() );
m_label->setText( new_label.c_str() );
}

View File

@@ -46,7 +46,7 @@ namespace GUIEngine
virtual void add();
/** Change the text label if there is a label (label won't be added if there initially wasn't one) */
void setLabel(std::string new_label);
void setLabel(irr::core::stringw new_label);
/** Change the texture used for this icon. The path is relative to the data directory, just like PROP_ICON. */
void setImage(const char* path_to_texture);

View File

@@ -144,6 +144,7 @@ void RibbonWidget::add()
m_children[i].m_element = subbtn;
}
// ---- non-tabs ribbons
else if (m_children[i].m_type == WTYPE_ICON_BUTTON)
{
// how much space to keep for the label under the button
@@ -172,6 +173,8 @@ void RibbonWidget::add()
m_children[i].w = image_w*zoom;
m_children[i].h = image_h*zoom;
std::wcout << L"Widget has text '" << m_children[i].m_text.c_str() << "'\n";
m_children.get(i)->m_parent = btn;
m_children.get(i)->add();