Fix up compilation.

This commit is contained in:
jmsgrogan 2023-01-18 11:17:41 +00:00
parent 7cab70f839
commit 19091a0e80
13 changed files with 46 additions and 48 deletions

View file

@ -4,7 +4,7 @@
StatusBar::StatusBar()
{
setBackground(ThemeToken::SystemToken::Secondary);
setBackground(Theme::Sys::Color::Secondary);
}
std::unique_ptr<StatusBar> StatusBar::Create()

View file

@ -38,7 +38,7 @@ void TabbedPanelWidget::addPanel(WidgetUPtr panel, const std::string& label)
{
auto button = Button::Create();
button->setLabel(label);
button->setBackground(ThemeToken::SystemToken::Primary);
button->setBackground(Theme::Sys::Color::Primary);
button->setMargin({1, 0, 0, 1});
auto rawPanel = panel.get();

View file

@ -8,11 +8,11 @@
TopBar::TopBar()
{
setBackground(ThemeToken::SystemToken::Secondary);
setBackground(Theme::Sys::Color::Secondary);
auto fileButton = Button::Create();
fileButton->setLabel("File");
fileButton->setBackground(ThemeToken::SystemToken::Primary);
fileButton->setBackground(Theme::Sys::Color::Primary);
fileButton->setMargin(2);
fileButton->setMaxWidth(60);

View file

@ -4,8 +4,9 @@
const float ButtonData::DEFAULT_CONTAINER_OPACITY = 1;
const std::unordered_map<ButtonData::ComponentState, Theme::Sys::Color> ButtonData::mContainerColors = {
const std::map<ButtonData::ComponentState, Theme::Sys::Color> ButtonData::mContainerColors = {
{{Component::Elevated, State::Enabled}, Theme::Sys::Color::Surface},
{{Component::Elevated, State::Disabled}, Theme::Sys::Color::On_Surface},
{{Component::Elevated, State::Hovered}, Theme::Sys::Color::Primary},
{{Component::Elevated, State::Focused}, Theme::Sys::Color::Primary},
@ -18,12 +19,12 @@ const std::unordered_map<ButtonData::ComponentState, Theme::Sys::Color> ButtonDa
{{Component::Filled, State::Pressed}, Theme::Sys::Color::On_Primary},
};
const std::unordered_map<ButtonData::ComponentState, Theme::Sys::Color> ButtonData::mContainerShadowColors = {
const std::map<ButtonData::ComponentState, Theme::Sys::Color> ButtonData::mContainerShadowColors = {
{{Component::Elevated, State::Enabled}, Theme::Sys::Color::Shadow},
{{Component::Filled, State::Enabled}, Theme::Sys::Color::Shadow},
};
const std::unordered_map<ButtonData::ComponentState, Theme::Sys::Elevation> ButtonData::mContainerElevations = {
const std::map<ButtonData::ComponentState, Theme::Sys::Elevation> ButtonData::mContainerElevations = {
{{Component::Elevated, State::Enabled}, Theme::Sys::Elevation::Level_1},
{{Component::Elevated, State::Disabled}, Theme::Sys::Elevation::Level_0},
{{Component::Elevated, State::Hovered}, Theme::Sys::Elevation::Level_2},
@ -36,19 +37,19 @@ const std::unordered_map<ButtonData::ComponentState, Theme::Sys::Elevation> Butt
{{Component::Filled, State::Pressed}, Theme::Sys::Elevation::Level_0},
};
const std::unordered_map<ButtonData::ComponentState, float> ButtonData::mContainerOpacity = {
{{Component::Elevated, State::Disabled}, 0.12},
const std::map<ButtonData::ComponentState, float> ButtonData::mContainerOpacity = {
{{Component::Elevated, State::Disabled}, 0.12f},
{{Component::Elevated, State::Hovered}, OpacityTokens::getValue(Theme::Sys::StateLayerOpacity::State::Hover)},
{{Component::Elevated, State::Focused}, OpacityTokens::getValue(Theme::Sys::StateLayerOpacity::State::Focus)},
{{Component::Elevated, State::Pressed}, OpacityTokens::getValue(Theme::Sys::StateLayerOpacity::State::Pressed)},
{{Component::Filled, State::Disabled}, 0.12},
{{Component::Filled, State::Disabled}, 0.12f},
{{Component::Filled, State::Hovered}, OpacityTokens::getValue(Theme::Sys::StateLayerOpacity::State::Hover)},
{{Component::Filled, State::Focused}, OpacityTokens::getValue(Theme::Sys::StateLayerOpacity::State::Focus)},
{{Component::Filled, State::Pressed}, OpacityTokens::getValue(Theme::Sys::StateLayerOpacity::State::Pressed)},
};
const std::unordered_map<ButtonData::ComponentState, Theme::Sys::Color> ButtonData::mLabelTextColors = {
const std::map<ButtonData::ComponentState, Theme::Sys::Color> ButtonData::mLabelTextColors = {
{{Component::Elevated, State::Enabled}, Theme::Sys::Color::Primary},
{{Component::Elevated, State::Disabled}, Theme::Sys::Color::On_Surface},
{{Component::Elevated, State::Hovered}, Theme::Sys::Color::Primary},
@ -62,17 +63,17 @@ const std::unordered_map<ButtonData::ComponentState, Theme::Sys::Color> ButtonDa
{{Component::Filled, State::Pressed}, Theme::Sys::Color::On_Primary},
};
const std::unordered_map<ButtonData::ComponentState, Theme::Sys::Typescale> ButtonData::mLabelTypescales = {
const std::map<ButtonData::ComponentState, Theme::Sys::Typescale> ButtonData::mLabelTypescales = {
{{Component::Elevated, State::Enabled}, Theme::Sys::Typescale::Label_Large},
{{Component::Filled, State::Enabled}, Theme::Sys::Typescale::Label_Large},
};
const std::unordered_map<ButtonData::ComponentState, float> ButtonData::mLabelTextOpacity = {
{{Component::Elevated, State::Disabled}, 0.38},
{{Component::Filled, State::Disabled}, 0.38},
const std::map<ButtonData::ComponentState, float> ButtonData::mLabelTextOpacity = {
{{Component::Elevated, State::Disabled}, 0.38f},
{{Component::Filled, State::Disabled}, 0.38f},
};
const std::unordered_map<ButtonData::ComponentState, Theme::Sys::Color> ButtonData::mIconColors = {
const std::map<ButtonData::ComponentState, Theme::Sys::Color> ButtonData::mIconColors = {
{{Component::Elevated, State::Enabled}, Theme::Sys::Color::Primary},
{{Component::Elevated, State::Disabled}, Theme::Sys::Color::On_Surface},
{{Component::Elevated, State::Hovered}, Theme::Sys::Color::Primary},
@ -86,9 +87,9 @@ const std::unordered_map<ButtonData::ComponentState, Theme::Sys::Color> ButtonDa
{{Component::Filled, State::Pressed}, Theme::Sys::Color::On_Primary},
};
const std::unordered_map<ButtonData::ComponentState, float> ButtonData::mIconOpacity = {
{{Component::Elevated, State::Disabled}, 0.38},
{{Component::Filled, State::Disabled}, 0.38},
const std::map<ButtonData::ComponentState, float> ButtonData::mIconOpacity = {
{{Component::Elevated, State::Disabled}, 0.38f},
{{Component::Filled, State::Disabled}, 0.38f},
};
Theme::Sys::Color ButtonData::getContainerColor() const

View file

@ -4,7 +4,7 @@
#include "FontTokens.h"
#include "ElevationTokens.h"
#include <unordered_map>
#include <map>
class ButtonData
{
@ -67,17 +67,17 @@ public:
private:
using ComponentState = std::pair<Component, State>;
static const std::unordered_map<ComponentState, Theme::Sys::Color> mContainerColors;
static const std::unordered_map<ComponentState, Theme::Sys::Color> mContainerShadowColors;
static const std::unordered_map<ComponentState, Theme::Sys::Elevation> mContainerElevations;
static const std::unordered_map<ComponentState, float> mContainerOpacity;
static const std::map<ComponentState, Theme::Sys::Color> mContainerColors;
static const std::map<ComponentState, Theme::Sys::Color> mContainerShadowColors;
static const std::map<ComponentState, Theme::Sys::Elevation> mContainerElevations;
static const std::map<ComponentState, float> mContainerOpacity;
static const std::unordered_map<ComponentState, Theme::Sys::Color> mLabelTextColors;
static const std::unordered_map<ComponentState, Theme::Sys::Typescale> mLabelTypescales;
static const std::unordered_map<ComponentState, float> mLabelTextOpacity;
static const std::map<ComponentState, Theme::Sys::Color> mLabelTextColors;
static const std::map<ComponentState, Theme::Sys::Typescale> mLabelTypescales;
static const std::map<ComponentState, float> mLabelTextOpacity;
static const std::unordered_map<ComponentState, Theme::Sys::Color> mIconColors;
static const std::unordered_map<ComponentState, float> mIconOpacity;
static const std::map<ComponentState, Theme::Sys::Color> mIconColors;
static const std::map<ComponentState, float> mIconOpacity;
static const Theme::Sys::Color DEFAULT_CONTAINER_COLOR{ Theme::Sys::Color::None };
static const Theme::Sys::Color DEFAULT_CONTAINER_SHADOW_COLOR{ Theme::Sys::Color::None };

View file

@ -15,7 +15,7 @@ TextBox::TextBox()
mContent(),
mCaps(false)
{
mBackground = ThemeToken::SystemToken::Background;
mBackground = Theme::Sys::Color::Background;
mPadding = {20, 0, 20, 0};
}

View file

@ -44,10 +44,7 @@ namespace Theme
Label_Small,
Body_Large,
Body_Medium,
Body_Small,
Label_Large,
Label_Medium,
Label_Small
Body_Small
};
};
};

View file

@ -25,15 +25,15 @@ public:
switch (token)
{
case Theme::Sys::StateLayerOpacity::State::Hover:
return 0.08;
return 0.08f;
case Theme::Sys::StateLayerOpacity::State::Focus:
return 0.12;
return 0.12f;
case Theme::Sys::StateLayerOpacity::State::Pressed:
return 0.12;
return 0.12f;
case Theme::Sys::StateLayerOpacity::State::Dragged:
return 0.16;
return 0.16f;
default:
return 0.0;
return 0.0f;
}
}
};

View file

@ -7,7 +7,7 @@
class ThemeManager
{
public:
Color getColor(ThemeToken::SystemToken token) const;
Color getColor(Theme::Sys::Color token) const;
private:
std::unique_ptr<ITheme> mActiveTheme;

View file

@ -7,7 +7,7 @@ ThemeManager::ThemeManager()
mTheme = std::make_unique<LightTheme>();
}
Color ThemeManager::getColor(ThemeToken::SystemToken token) const
Color ThemeManager::getColor(Theme::Sys::Color token) const
{
return mTheme->getColor(token);
}

View file

@ -6,7 +6,7 @@ class ThemeManager
{
public:
ThemeManager();
Color getColor(ThemeToken::SystemToken token) const;
Color getColor(Theme::Sys::Color token) const;
private:
std::unique_ptr<ITheme> mTheme;
};

View file

@ -23,8 +23,8 @@ Widget::Widget()
mRootNode(std::make_unique<TransformNode>()),
mChildren(),
mBorderThickness(0),
mBackground(ThemeToken::SystemToken::Primary),
mBorder(ThemeToken::SystemToken::Outline),
mBackground(Theme::Sys::Color::Primary),
mBorder(Theme::Sys::Color::Outline),
mVisible(true)
{
mName = "Widget";
@ -66,7 +66,7 @@ TransformNode* Widget::getRootNode() const
void Widget::setBackground(ThemeToken::SystemToken token)
void Widget::setBackground(Theme::Sys::Color token)
{
if (mBackground != token)
{

View file

@ -47,7 +47,7 @@ public:
virtual bool onKeyboardEvent(const KeyboardEvent* event);
void setBackground(ThemeToken::SystemToken token);
void setBackground(Theme::Sys::Color token);
void setVisible(bool visible);
@ -78,8 +78,8 @@ protected:
std::vector<std::unique_ptr<Widget> > mChildren;
unsigned mBorderThickness{0};
ThemeToken::SystemToken mBackground;
ThemeToken::SystemToken mBorder;
Theme::Sys::Color mBackground;
Theme::Sys::Color mBorder;
bool mVisible{true};