Add initial token theming.
This commit is contained in:
parent
3d37a7244b
commit
1f85954e98
34 changed files with 406 additions and 253 deletions
|
@ -3,6 +3,8 @@
|
|||
#include "TextNode.h"
|
||||
#include "GeometryNode.h"
|
||||
#include "TransformNode.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PaintEvent.h"
|
||||
|
||||
#include "MouseEvent.h"
|
||||
#include "FileLogger.h"
|
||||
|
@ -10,8 +12,8 @@
|
|||
Button::Button()
|
||||
: Widget(),
|
||||
mLabel(),
|
||||
mCachedColor(255, 255, 255),
|
||||
mClickedColor(Color(180, 180, 180)),
|
||||
mCachedColor(ThemeToken::SystemToken::Primary),
|
||||
mClickedColor(ThemeToken::SystemToken::Secondary),
|
||||
mClickFunc()
|
||||
{
|
||||
mName = "Button";
|
||||
|
@ -46,8 +48,8 @@ void Button::onMyMouseEvent(const MouseEvent* event)
|
|||
MLOG_INFO("Widget mouse event");
|
||||
if(event->getAction() == MouseEvent::Action::Pressed)
|
||||
{
|
||||
mCachedColor = mBackgroundColor;
|
||||
setBackgroundColor(mClickedColor);
|
||||
mCachedColor = mBackground;
|
||||
setBackground(mClickedColor);
|
||||
if(mClickFunc)
|
||||
{
|
||||
mClickFunc(this);
|
||||
|
@ -55,7 +57,7 @@ void Button::onMyMouseEvent(const MouseEvent* event)
|
|||
}
|
||||
else if(event->getAction() == MouseEvent::Action::Released)
|
||||
{
|
||||
setBackgroundColor(mCachedColor);
|
||||
setBackground(mCachedColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,7 +96,7 @@ void Button::updateLabel(const PaintEvent* event)
|
|||
|
||||
if (mMaterialDirty)
|
||||
{
|
||||
mTextNode->setFillColor(mBackgroundColor);
|
||||
mTextNode->setFillColor(event->getThemesManager()->getColor(mBackground));
|
||||
}
|
||||
|
||||
if (mContentDirty)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue