diff --git a/src/ui/client/StatusBar.cpp b/src/ui/client/StatusBar.cpp index 1cb0e93..ddad3ad 100644 --- a/src/ui/client/StatusBar.cpp +++ b/src/ui/client/StatusBar.cpp @@ -4,7 +4,7 @@ StatusBar::StatusBar() { - setBackground(ThemeToken::SystemToken::Secondary); + setBackground(Theme::Sys::Color::Secondary); } std::unique_ptr StatusBar::Create() diff --git a/src/ui/client/TabbedPanelWidget.cpp b/src/ui/client/TabbedPanelWidget.cpp index 36d93df..95565ec 100644 --- a/src/ui/client/TabbedPanelWidget.cpp +++ b/src/ui/client/TabbedPanelWidget.cpp @@ -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(); diff --git a/src/ui/client/TopBar.cpp b/src/ui/client/TopBar.cpp index ce6b812..9864150 100644 --- a/src/ui/client/TopBar.cpp +++ b/src/ui/client/TopBar.cpp @@ -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); diff --git a/src/ui/ui_controls/ButtonData.cpp b/src/ui/ui_controls/ButtonData.cpp index e12a7e2..fd57a89 100644 --- a/src/ui/ui_controls/ButtonData.cpp +++ b/src/ui/ui_controls/ButtonData.cpp @@ -4,8 +4,9 @@ const float ButtonData::DEFAULT_CONTAINER_OPACITY = 1; -const std::unordered_map ButtonData::mContainerColors = { +const std::map 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 ButtonDa {{Component::Filled, State::Pressed}, Theme::Sys::Color::On_Primary}, }; -const std::unordered_map ButtonData::mContainerShadowColors = { +const std::map ButtonData::mContainerShadowColors = { {{Component::Elevated, State::Enabled}, Theme::Sys::Color::Shadow}, {{Component::Filled, State::Enabled}, Theme::Sys::Color::Shadow}, }; -const std::unordered_map ButtonData::mContainerElevations = { +const std::map 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 Butt {{Component::Filled, State::Pressed}, Theme::Sys::Elevation::Level_0}, }; -const std::unordered_map ButtonData::mContainerOpacity = { - {{Component::Elevated, State::Disabled}, 0.12}, +const std::map 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::mLabelTextColors = { +const std::map 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 ButtonDa {{Component::Filled, State::Pressed}, Theme::Sys::Color::On_Primary}, }; -const std::unordered_map ButtonData::mLabelTypescales = { +const std::map 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::mLabelTextOpacity = { - {{Component::Elevated, State::Disabled}, 0.38}, - {{Component::Filled, State::Disabled}, 0.38}, +const std::map ButtonData::mLabelTextOpacity = { + {{Component::Elevated, State::Disabled}, 0.38f}, + {{Component::Filled, State::Disabled}, 0.38f}, }; -const std::unordered_map ButtonData::mIconColors = { +const std::map 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 ButtonDa {{Component::Filled, State::Pressed}, Theme::Sys::Color::On_Primary}, }; -const std::unordered_map ButtonData::mIconOpacity = { - {{Component::Elevated, State::Disabled}, 0.38}, - {{Component::Filled, State::Disabled}, 0.38}, +const std::map ButtonData::mIconOpacity = { + {{Component::Elevated, State::Disabled}, 0.38f}, + {{Component::Filled, State::Disabled}, 0.38f}, }; Theme::Sys::Color ButtonData::getContainerColor() const diff --git a/src/ui/ui_controls/ButtonData.h b/src/ui/ui_controls/ButtonData.h index 47fee59..f9cafbd 100644 --- a/src/ui/ui_controls/ButtonData.h +++ b/src/ui/ui_controls/ButtonData.h @@ -4,7 +4,7 @@ #include "FontTokens.h" #include "ElevationTokens.h" -#include +#include class ButtonData { @@ -67,17 +67,17 @@ public: private: using ComponentState = std::pair; - static const std::unordered_map mContainerColors; - static const std::unordered_map mContainerShadowColors; - static const std::unordered_map mContainerElevations; - static const std::unordered_map mContainerOpacity; + static const std::map mContainerColors; + static const std::map mContainerShadowColors; + static const std::map mContainerElevations; + static const std::map mContainerOpacity; - static const std::unordered_map mLabelTextColors; - static const std::unordered_map mLabelTypescales; - static const std::unordered_map mLabelTextOpacity; + static const std::map mLabelTextColors; + static const std::map mLabelTypescales; + static const std::map mLabelTextOpacity; - static const std::unordered_map mIconColors; - static const std::unordered_map mIconOpacity; + static const std::map mIconColors; + static const std::map 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 }; diff --git a/src/ui/ui_controls/TextBox.cpp b/src/ui/ui_controls/TextBox.cpp index dfaa8b4..70a4754 100644 --- a/src/ui/ui_controls/TextBox.cpp +++ b/src/ui/ui_controls/TextBox.cpp @@ -15,7 +15,7 @@ TextBox::TextBox() mContent(), mCaps(false) { - mBackground = ThemeToken::SystemToken::Background; + mBackground = Theme::Sys::Color::Background; mPadding = {20, 0, 20, 0}; } diff --git a/src/ui/ui_elements/style/FontTokens.h b/src/ui/ui_elements/style/FontTokens.h index 8e9a1e3..9102372 100644 --- a/src/ui/ui_elements/style/FontTokens.h +++ b/src/ui/ui_elements/style/FontTokens.h @@ -44,10 +44,7 @@ namespace Theme Label_Small, Body_Large, Body_Medium, - Body_Small, - Label_Large, - Label_Medium, - Label_Small + Body_Small }; }; }; diff --git a/src/ui/ui_elements/style/OpacityTokens.h b/src/ui/ui_elements/style/OpacityTokens.h index fbe0450..cdf2726 100644 --- a/src/ui/ui_elements/style/OpacityTokens.h +++ b/src/ui/ui_elements/style/OpacityTokens.h @@ -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; } } }; diff --git a/src/ui/ui_elements/style/Theme.h b/src/ui/ui_elements/style/Theme.h index 652b7eb..6595665 100644 --- a/src/ui/ui_elements/style/Theme.h +++ b/src/ui/ui_elements/style/Theme.h @@ -7,7 +7,7 @@ class ThemeManager { public: - Color getColor(ThemeToken::SystemToken token) const; + Color getColor(Theme::Sys::Color token) const; private: std::unique_ptr mActiveTheme; diff --git a/src/ui/ui_elements/style/ThemeManager.cpp b/src/ui/ui_elements/style/ThemeManager.cpp index 982d337..3a9ed72 100644 --- a/src/ui/ui_elements/style/ThemeManager.cpp +++ b/src/ui/ui_elements/style/ThemeManager.cpp @@ -7,7 +7,7 @@ ThemeManager::ThemeManager() mTheme = std::make_unique(); } -Color ThemeManager::getColor(ThemeToken::SystemToken token) const +Color ThemeManager::getColor(Theme::Sys::Color token) const { return mTheme->getColor(token); } diff --git a/src/ui/ui_elements/style/ThemeManager.h b/src/ui/ui_elements/style/ThemeManager.h index 00bb967..8b9002a 100644 --- a/src/ui/ui_elements/style/ThemeManager.h +++ b/src/ui/ui_elements/style/ThemeManager.h @@ -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 mTheme; }; diff --git a/src/ui/ui_elements/widgets/Widget.cpp b/src/ui/ui_elements/widgets/Widget.cpp index c4cac23..e2bdf15 100644 --- a/src/ui/ui_elements/widgets/Widget.cpp +++ b/src/ui/ui_elements/widgets/Widget.cpp @@ -23,8 +23,8 @@ Widget::Widget() mRootNode(std::make_unique()), 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) { diff --git a/src/ui/ui_elements/widgets/Widget.h b/src/ui/ui_elements/widgets/Widget.h index 88c6aa0..43c6973 100644 --- a/src/ui/ui_elements/widgets/Widget.h +++ b/src/ui/ui_elements/widgets/Widget.h @@ -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 > mChildren; unsigned mBorderThickness{0}; - ThemeToken::SystemToken mBackground; - ThemeToken::SystemToken mBorder; + Theme::Sys::Color mBackground; + Theme::Sys::Color mBorder; bool mVisible{true};