diff --git a/es-core/src/GuiComponent.cpp b/es-core/src/GuiComponent.cpp index 7264c76e9..18a171bac 100644 --- a/es-core/src/GuiComponent.cpp +++ b/es-core/src/GuiComponent.cpp @@ -319,15 +319,24 @@ const Transform4x4f& GuiComponent::getTransform() return mTransform; } +std::string GuiComponent::getValue() const +{ + return ""; +} + void GuiComponent::setValue(const std::string& /*value*/) { } -std::string GuiComponent::getValue() const +std::string GuiComponent::getHiddenValue() const { return ""; } +void GuiComponent::setHiddenValue(const std::string& /*value*/) +{ +} + void GuiComponent::textInput(const char* text) { for (auto iter = mChildren.cbegin(); iter != mChildren.cend(); iter++) diff --git a/es-core/src/GuiComponent.h b/es-core/src/GuiComponent.h index bf545b4ce..4b66caa7a 100644 --- a/es-core/src/GuiComponent.h +++ b/es-core/src/GuiComponent.h @@ -161,6 +161,9 @@ public: virtual std::string getValue() const; virtual void setValue(const std::string& value); + virtual std::string getHiddenValue() const; + virtual void setHiddenValue(const std::string& value); + virtual void onFocusGained() {}; virtual void onFocusLost() {}; diff --git a/es-core/src/components/TextComponent.cpp b/es-core/src/components/TextComponent.cpp index 70a274963..1eab58b9f 100644 --- a/es-core/src/components/TextComponent.cpp +++ b/es-core/src/components/TextComponent.cpp @@ -114,6 +114,11 @@ void TextComponent::setText(const std::string& text) onTextChanged(); } +void TextComponent::setHiddenText(const std::string& text) +{ + mHiddenText = text; +} + void TextComponent::setUppercase(bool uppercase) { mUppercase = uppercase; @@ -265,14 +270,24 @@ void TextComponent::setLineSpacing(float spacing) onTextChanged(); } +std::string TextComponent::getValue() const +{ + return mText; +} + void TextComponent::setValue(const std::string& value) { setText(value); } -std::string TextComponent::getValue() const +std::string TextComponent::getHiddenValue() const { - return mText; + return mHiddenText; +} + +void TextComponent::setHiddenValue(const std::string& value) +{ + setHiddenText(value); } void TextComponent::applyTheme(const std::shared_ptr& theme, const std::string& view, diff --git a/es-core/src/components/TextComponent.h b/es-core/src/components/TextComponent.h index c81454636..c49379bf3 100644 --- a/es-core/src/components/TextComponent.h +++ b/es-core/src/components/TextComponent.h @@ -39,6 +39,7 @@ public: void setUppercase(bool uppercase); void onSizeChanged() override; void setText(const std::string& text); + void setHiddenText(const std::string& text); void setColor(unsigned int color) override; void setHorizontalAlignment(Alignment align); void setVerticalAlignment(Alignment align); @@ -52,6 +53,9 @@ public: std::string getValue() const override; void setValue(const std::string& value) override; + std::string getHiddenValue() const override; + void setHiddenValue(const std::string& value) override; + unsigned char getOpacity() const override; void setOpacity(unsigned char opacity) override; @@ -64,6 +68,7 @@ protected: virtual void onTextChanged(); std::string mText; + std::string mHiddenText; std::shared_ptr mFont; private: