STextButton: backup color as a local variable

This commit is contained in:
Jean Pierre Cimalando 2020-09-11 14:05:26 +02:00
parent be56de72c1
commit c6f7e81b70
2 changed files with 2 additions and 3 deletions

View file

@ -435,13 +435,13 @@ void STextButton::setHoverColor (const CColor& color)
void STextButton::draw(CDrawContext* context) void STextButton::draw(CDrawContext* context)
{ {
backupColor_ = textColor; CColor backupColor = textColor;
if (hovered) { if (hovered) {
textColor = hoverColor_; // textColor is protected textColor = hoverColor_; // textColor is protected
} }
CTextButton::draw(context); CTextButton::draw(context);
if (hovered) if (hovered)
textColor = backupColor_; textColor = backupColor;
} }

View file

@ -160,6 +160,5 @@ public:
void draw(CDrawContext* context) override; void draw(CDrawContext* context) override;
private: private:
CColor hoverColor_; CColor hoverColor_;
CColor backupColor_;
bool hovered { false }; bool hovered { false };
}; };