Start adding themed buttons.

This commit is contained in:
jmsgrogan 2023-01-18 10:47:13 +00:00
parent dfbc87cb09
commit 942cc2539c
18 changed files with 781 additions and 173 deletions

View file

@ -1,5 +1,6 @@
#pragma once
#include "ButtonData.h"
#include "Widget.h"
#include "Color.h"
@ -15,11 +16,11 @@ class Button : public Widget
public:
using clickFunc = std::function<void(Widget* self)>;
Button();
Button(ButtonData::Component component = ButtonData::Component::Elevated);
~Button();
static std::unique_ptr<Button> Create();
static std::unique_ptr<Button> Create(ButtonData::Component component = ButtonData::Component::Elevated);
void setLabel(const std::string& text);
@ -34,10 +35,10 @@ protected:
void updateLabel(const PaintEvent* event);
private:
ButtonData mStyle;
std::string mLabel;
clickFunc mClickFunc;
ThemeToken::SystemToken mCachedColor;
ThemeToken::SystemToken mClickedColor;
std::unique_ptr<TextNode> mTextNode;
bool mContentDirty{true};