Start cleaning icon.
This commit is contained in:
parent
97afa782a0
commit
3915a40c96
10 changed files with 172 additions and 33 deletions
|
@ -21,6 +21,8 @@ Button::Button(ButtonData::Component component)
|
|||
{
|
||||
mStyle.mComponent = component;
|
||||
mName = "Button";
|
||||
setWidth(150);
|
||||
setMaxWidth(150);
|
||||
|
||||
setHeight(mStyle.getContainerHeight());
|
||||
setMaxHeight(mStyle.getContainerHeight());
|
||||
|
@ -95,6 +97,9 @@ void Button::updateState()
|
|||
setLabelTextColor(mStyle.getLabelTextColor());
|
||||
setLabelTextOpacity(mStyle.getLabelOpacity());
|
||||
setLabelTextTypescale(mStyle.getLabelTypescale());
|
||||
|
||||
setIconColor(mStyle.getIconColor());
|
||||
//setIconOpacity()
|
||||
}
|
||||
|
||||
void Button::setLabelTextColor(Theme::Sys::Color color)
|
||||
|
@ -124,6 +129,24 @@ void Button::setLabelTextTypescale(Theme::Sys::Typescale typescale)
|
|||
}
|
||||
}
|
||||
|
||||
void Button::setIconColor(Theme::Sys::Color color)
|
||||
{
|
||||
if (mIconColor != color)
|
||||
{
|
||||
mIconColor = color;
|
||||
mMaterialDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Button::setIconOpacity(float opacity)
|
||||
{
|
||||
if (mIconOpacity!= opacity)
|
||||
{
|
||||
mIconOpacity = opacity;
|
||||
mMaterialDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Button::onMyMouseEvent(const MouseEvent* event)
|
||||
{
|
||||
if (!mEnabled)
|
||||
|
@ -237,6 +260,10 @@ void Button::updateIcon(const PaintEvent* event)
|
|||
mIconNode->setContent(IconNode::IconType::Svg, MediaResourceManager::getSvgIconNode(mIcon));
|
||||
mRootNode->addChild(mIconNode.get());
|
||||
}
|
||||
else if (mContentDirty && mIcon != Resource::Icon::Svg::NONE)
|
||||
{
|
||||
mIconNode->setContent(IconNode::IconType::Svg, MediaResourceManager::getSvgIconNode(mIcon));
|
||||
}
|
||||
|
||||
if (!mIconNode)
|
||||
{
|
||||
|
@ -252,11 +279,7 @@ void Button::updateIcon(const PaintEvent* event)
|
|||
{
|
||||
auto icon_fill = event->getThemesManager()->getColor(mIconColor);
|
||||
icon_fill.setAlpha(mIconOpacity);
|
||||
}
|
||||
|
||||
if (mContentDirty)
|
||||
{
|
||||
mIconNode->setContent(IconNode::IconType::Svg, MediaResourceManager::getSvgIconNode(mIcon));
|
||||
mIconNode->setFillColor(icon_fill);
|
||||
}
|
||||
|
||||
if (mVisibilityDirty)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue