#include "CanvasView.h" #include "HorizontalSpacer.h" #include "VerticalSpacer.h" #include "CanvasController.h" #include "Theme.h" #include "TextNode.h" #include "Label.h" #include "Button.h" #include CanvasView::CanvasView() : mController(CanvasController::Create()) { std::cout << "Creatin canvas" << std::endl; initialize(); } CanvasView::~CanvasView() { } std::unique_ptr CanvasView::Create() { return std::make_unique(); } void CanvasView::initialize() { auto label = Label::Create(); label->setLabel("Canvas"); label->setBackgroundColor(Theme::getBannerBackground()); label->setMargin(1); auto hSpacer = HorizontalSpacer::Create(); hSpacer->addWidgetWithScale(std::move(label), 1); //hSpacer->addWidgetWithScale(std::move(textBox), 14); auto cache_button_spacer = initializeCacheButtons(); hSpacer->addWidgetWithScale(std::move(cache_button_spacer), 1); addWidget(std::move(hSpacer)); } std::unique_ptr CanvasView::initializeCacheButtons() { auto saveButton = Button::Create(); saveButton->setLabel("Save"); saveButton->setBackgroundColor(Theme::getButtonPrimaryBackground()); saveButton->setMargin(2); auto clearButton = Button::Create(); clearButton->setLabel("Clear"); clearButton->setBackgroundColor(Theme::getButtonPrimaryBackground()); clearButton->setMargin(2); auto loadButton = Button::Create(); loadButton->setLabel("Load"); loadButton->setBackgroundColor(Theme::getButtonPrimaryBackground()); loadButton->setMargin(2); auto buttonSpacer = VerticalSpacer::Create(); buttonSpacer->AddWidgetWithScale(std::move(saveButton), 1); buttonSpacer->AddWidgetWithScale(std::move(clearButton), 1); buttonSpacer->AddWidgetWithScale(std::move(loadButton), 1); return buttonSpacer; }