diff --git a/src/ui/base.h b/src/ui/base.h index 68e20f798..608fdc72c 100644 --- a/src/ui/base.h +++ b/src/ui/base.h @@ -56,6 +56,7 @@ namespace ui { #define JI_DECORATIVE 0x0200 // To decorate windows. #define JI_INITIALIZED 0x0400 // The widget was already initialized by a theme. #define JI_DIRTY 0x0800 // The widget (or one child) is dirty (update_region != empty). +#define JI_HASTEXT 0x1000 // The widget has text (at least setText() was called one time). class GuiSystem { public: diff --git a/src/ui/widget.cpp b/src/ui/widget.cpp index 05adc2f0d..36fd03bdf 100644 --- a/src/ui/widget.cpp +++ b/src/ui/widget.cpp @@ -61,7 +61,6 @@ Widget::Widget(WidgetType type) this->m_theme = CurrentTheme::get(); this->m_align = 0; - this->m_text = ""; this->m_font = this->m_theme ? this->m_theme->default_font: NULL; this->m_bgColor = ui::ColorNone; @@ -154,6 +153,7 @@ void Widget::setTextf(const char *format, ...) void Widget::setTextQuiet(const base::string& text) { m_text = text; + flags |= JI_HASTEXT; } FONT *Widget::getFont() const diff --git a/src/ui/widget.h b/src/ui/widget.h index 660c312dc..141021865 100644 --- a/src/ui/widget.h +++ b/src/ui/widget.h @@ -105,7 +105,7 @@ namespace ui { // Text property. - bool hasText() const { return !m_text.empty(); } + bool hasText() const { return (flags & JI_HASTEXT) == JI_HASTEXT; } const base::string& getText() const { return m_text; } int getTextInt() const;