Add initial token theming.

This commit is contained in:
jmsgrogan 2023-01-17 13:01:59 +00:00
parent 3d37a7244b
commit 1f85954e98
34 changed files with 406 additions and 253 deletions

View file

@ -8,7 +8,7 @@ AudioEditorView::AudioEditorView()
{
auto label = Label::Create();
label->setLabel("audio Editor");
label->setBackgroundColor(Theme::getBackgroundPrimary());
label->setBackground(ThemeToken::SystemToken::Primary);
label->setMargin(1);
addWidget(std::move(label));
}

View file

@ -2,7 +2,9 @@
#include "HorizontalSpacer.h"
#include "Button.h"
#include "Theme.h"
#include "ThemeManager.h"
#include "PaintEvent.h"
CanvasCommandSelectorView::CanvasCommandSelectorView()
: Widget()
@ -13,7 +15,7 @@ CanvasCommandSelectorView::CanvasCommandSelectorView()
onCommandSelected(CanvasDrawCommand::CIRCLE);
};
circle_button->setLabel("Circle");
circle_button->setBackgroundColor(Theme::getButtonPrimaryBackground());
circle_button->setBackground(ThemeToken::SystemToken::Primary);
circle_button->setMargin(2);
circle_button->setOnClickFunction(on_circle_click);
@ -22,7 +24,7 @@ CanvasCommandSelectorView::CanvasCommandSelectorView()
};
auto line_button = Button::Create();
line_button->setLabel("Line");
line_button->setBackgroundColor(Theme::getButtonPrimaryBackground());
line_button->setBackground(ThemeToken::SystemToken::Primary);
line_button->setMargin(2);
line_button->setOnClickFunction(on_line_click);

View file

@ -7,13 +7,15 @@
#include "CanvasDrawingArea.h"
#include "CanvasCommandSelectorView.h"
#include "Theme.h"
#include "TextNode.h"
#include "GeometryNode.h"
#include "Label.h"
#include "Button.h"
#include "ThemeManager.h"
#include "PaintEvent.h"
CanvasView::CanvasView()
: mController(CanvasController::Create())
{
@ -34,11 +36,11 @@ void CanvasView::initialize()
{
auto label = Label::Create();
label->setLabel("Canvas");
label->setBackgroundColor(Theme::getBannerBackground());
label->setBackground(ThemeToken::SystemToken::Secondary);
label->setMargin(1);
auto controls = std::make_unique<CanvasCommandSelectorView>();
controls->setBackgroundColor(Theme::getBannerBackground());
controls->setBackground(ThemeToken::SystemToken::Background);
controls->setMargin(1);
auto on_draw_command_changed = [this](CanvasDrawCommand command){
@ -47,7 +49,7 @@ void CanvasView::initialize()
controls->setCommandSelectedCallback(on_draw_command_changed);
auto drawing_area = std::make_unique<CanvasDrawingArea>();
drawing_area->setBackgroundColor(Theme::getBackgroundPrimary());
drawing_area->setBackground(ThemeToken::SystemToken::Background);
drawing_area->setMargin(1);
mDrawingArea = drawing_area.get();
@ -75,17 +77,17 @@ std::unique_ptr<Widget> CanvasView::initializeCacheButtons()
{
auto saveButton = Button::Create();
saveButton->setLabel("Save");
saveButton->setBackgroundColor(Theme::getButtonPrimaryBackground());
saveButton->setBackground(ThemeToken::SystemToken::Primary);
saveButton->setMargin(2);
auto clearButton = Button::Create();
clearButton->setLabel("Clear");
clearButton->setBackgroundColor(Theme::getButtonPrimaryBackground());
clearButton->setBackground(ThemeToken::SystemToken::Primary);
clearButton->setMargin(2);
auto loadButton = Button::Create();
loadButton->setLabel("Load");
loadButton->setBackgroundColor(Theme::getButtonPrimaryBackground());
loadButton->setBackground(ThemeToken::SystemToken::Primary);
loadButton->setMargin(2);
auto buttonSpacer = VerticalSpacer::Create();

View file

@ -12,7 +12,7 @@ ImageEditorView::ImageEditorView()
{
auto label = Label::Create();
label->setLabel("Image Editor");
label->setBackgroundColor(Theme::getBackgroundPrimary());
label->setBackground(ThemeToken::SystemToken::Primary);
label->setMargin(1);
auto image_widget = std::make_unique<ImageViewWidget>();

View file

@ -3,7 +3,8 @@
#include "GridNode.h"
#include "TransformNode.h"
#include <iostream>
#include "ThemeManager.h"
#include "PaintEvent.h"
ImageViewWidget::ImageViewWidget()
{
@ -27,7 +28,7 @@ void ImageViewWidget::doPaint(const PaintEvent* event)
mGridNode->setWidth(mSize.mWidth);
mGridNode->setHeight(mSize.mHeight);
mGridNode->setStrokeColor(mBorderColor);
mGridNode->setStrokeColor(event->getThemesManager()->getColor(mBorder));
mRootNode->addChild(mGridNode.get());
}
@ -41,6 +42,6 @@ void ImageViewWidget::doPaint(const PaintEvent* event)
if (mMaterialDirty)
{
mGridNode->setFillColor(mBorderColor);
mGridNode->setFillColor(event->getThemesManager()->getColor(mBorder));
}
}

View file

@ -5,6 +5,9 @@
#include "AbstractMesh.h"
#include "MeshPrimitives.h"
#include "ThemeManager.h"
#include "PaintEvent.h"
#include <iostream>
std::unique_ptr<MeshViewerView> MeshViewerView::Create()
@ -20,7 +23,7 @@ MeshViewerView::~MeshViewerView()
MeshViewerView::MeshViewerView()
{
mName = "MeshViewerView";
mBackgroundColor = {204, 204, 255};
mBackground = ThemeToken::SystemToken::Background;
}
void MeshViewerView::doPaint(const PaintEvent* event)
@ -38,7 +41,7 @@ void MeshViewerView::doPaint(const PaintEvent* event)
mMeshNode->setWidth(mSize.mWidth);
mMeshNode->setHeight(mSize.mHeight);
mMeshNode->setFillColor(mBackgroundColor);
mMeshNode->setFillColor(event->getThemesManager()->getColor(mBackground));
mRootNode->addChild(mMeshNode.get());
}
@ -52,7 +55,7 @@ void MeshViewerView::doPaint(const PaintEvent* event)
if (mMaterialDirty)
{
mMeshNode->setFillColor(mBackgroundColor);
mMeshNode->setFillColor(event->getThemesManager()->getColor(mBackground));
}
if (!mMesh)

View file

@ -25,7 +25,7 @@ void TextEditorView::initialize()
{
auto label = Label::Create();
label->setLabel("Text Editor");
label->setBackgroundColor(Theme::getBannerBackground());
label->setBackground(ThemeToken::SystemToken::Secondary);
label->setMargin(1);
auto textBox = TextBox::Create();
@ -34,7 +34,7 @@ void TextEditorView::initialize()
auto saveButton = Button::Create();
saveButton->setLabel("Save");
saveButton->setBackgroundColor(Theme::getButtonPrimaryBackground());
saveButton->setBackground(ThemeToken::SystemToken::Primary);
saveButton->setMargin(2);
auto onSave = [this](Widget* self){
if(this && mController && mTextBox)
@ -47,7 +47,7 @@ void TextEditorView::initialize()
auto clearButton = Button::Create();
clearButton->setLabel("Clear");
clearButton->setBackgroundColor(Theme::getButtonPrimaryBackground());
clearButton->setBackground(ThemeToken::SystemToken::Primary);
clearButton->setMargin(2);
auto onClear = [this](Widget* self){
if(this && mController && mTextBox)
@ -60,7 +60,7 @@ void TextEditorView::initialize()
auto loadButton = Button::Create();
loadButton->setLabel("Load");
loadButton->setBackgroundColor(Theme::getButtonPrimaryBackground());
loadButton->setBackground(ThemeToken::SystemToken::Primary);
loadButton->setMargin(2);
auto onLoad = [this](Widget* self){
if(this && mController && mTextBox)

View file

@ -10,7 +10,7 @@ WebClientView::WebClientView()
{
auto label = Label::Create();
label->setLabel("Web Client");
label->setBackgroundColor(Theme::getBackgroundPrimary());
label->setBackground(ThemeToken::SystemToken::Secondary);
label->setMargin(1);
addWidget(std::move(label));
}