changes to progress bar to make the percentage label optional

This commit is contained in:
Bart Cools 2014-05-21 10:07:25 +02:00
parent b94fe0fcde
commit 26967a41db
2 changed files with 8 additions and 4 deletions

View File

@ -30,9 +30,10 @@ using namespace irr;
// -----------------------------------------------------------------------------
ProgressBarWidget::ProgressBarWidget() : Widget(WTYPE_PROGRESS)
ProgressBarWidget::ProgressBarWidget(bool show_label) : Widget(WTYPE_PROGRESS)
{
m_value = 0;
m_show_label = show_label;
}
// -----------------------------------------------------------------------------
@ -52,7 +53,10 @@ void ProgressBarWidget::add()
void ProgressBarWidget::setValue(int value)
{
m_value = value;
setLabel(std::string(StringUtils::toString(value) + "%").c_str());
if (m_show_label)
{
setLabel(std::string(StringUtils::toString(value) + "%").c_str());
}
}
// -----------------------------------------------------------------------------

View File

@ -45,12 +45,12 @@ namespace GUIEngine
/** Change the label on the widget */
void setLabel(const irr::core::stringw label);
int m_value;
bool m_show_label;
public:
LEAK_CHECK()
ProgressBarWidget();
ProgressBarWidget(bool show_label = true);
virtual ~ProgressBarWidget() {}
/** Change the value of the widget, it must be a percent. */