1
0

Add getActiveColor functions to IGUIStaticText and IGUIButton

Returns currently used color - depending on state and if override color is set.
Note: Not adding this to editbox for now as it's a bit more tricky there (selection changing color, so it has no single color).


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6165 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien
2020-12-10 14:45:30 +00:00
parent bd2b44aa1c
commit c90238e87f
7 changed files with 39 additions and 4 deletions

View File

@@ -327,7 +327,7 @@ void CGUIButton::draw()
if (font)
font->draw(Text.c_str(), rect,
OverrideColorEnabled ? OverrideColor : skin->getColor(isEnabled() ? EGDC_BUTTON_TEXT : EGDC_GRAY_TEXT),
getActiveColor(),
true, true, &AbsoluteClippingRect);
}
@@ -466,6 +466,16 @@ video::SColor CGUIButton::getOverrideColor() const
return OverrideColor;
}
irr::video::SColor CGUIButton::getActiveColor() const
{
if ( OverrideColorEnabled )
return OverrideColor;
IGUISkin* skin = Environment->getSkin();
if (skin)
return OverrideColorEnabled ? OverrideColor : skin->getColor(isEnabled() ? EGDC_BUTTON_TEXT : EGDC_GRAY_TEXT);
return OverrideColor;
}
void CGUIButton::enableOverrideColor(bool enable)
{
OverrideColorEnabled = enable;