Start adding grid
This commit is contained in:
parent
9301769d58
commit
f04d86e0ad
37 changed files with 709 additions and 211 deletions
|
@ -6,6 +6,7 @@ list(APPEND client_HEADERS
|
|||
text_editor/PlainTextDocument.h
|
||||
audio_editor/AudioEditorView.h
|
||||
image_editor/ImageEditorView.h
|
||||
image_editor/ImageViewWidget.h
|
||||
web_client/WebClientView.h)
|
||||
|
||||
|
||||
|
@ -16,6 +17,7 @@ list(APPEND client_LIB_INCLUDES
|
|||
text_editor/PlainTextDocument.cpp
|
||||
audio_editor/AudioEditorView.cpp
|
||||
image_editor/ImageEditorView.cpp
|
||||
image_editor/ImageViewWidget.cpp
|
||||
web_client/WebClientView.cpp
|
||||
MediaTool.cpp)
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#include "AudioEditorView.h"
|
||||
|
||||
#include "Label.h"
|
||||
#include "Color.h"
|
||||
#include "TextNode.h"
|
||||
#include "Theme.h"
|
||||
|
||||
AudioEditorView::AudioEditorView()
|
||||
{
|
||||
auto label = Label::Create();
|
||||
label->setLabel("audio Editor");
|
||||
label->setBackgroundColor(Color(200, 189, 160));
|
||||
label->setBackgroundColor(Theme::getBackgroundPrimary());
|
||||
label->setMargin(1);
|
||||
addWidget(std::move(label));
|
||||
}
|
||||
|
|
|
@ -3,14 +3,25 @@
|
|||
#include "Label.h"
|
||||
#include "Color.h"
|
||||
#include "TextNode.h"
|
||||
#include "Theme.h"
|
||||
#include "ImageViewWidget.h"
|
||||
|
||||
#include "HorizontalSpacer.h"
|
||||
|
||||
ImageEditorView::ImageEditorView()
|
||||
{
|
||||
auto label = Label::Create();
|
||||
label->setLabel("Image Editor");
|
||||
label->setBackgroundColor(Color(200, 189, 160));
|
||||
label->setBackgroundColor(Theme::getBackgroundPrimary());
|
||||
label->setMargin(1);
|
||||
addWidget(std::move(label));
|
||||
|
||||
auto image_widget = std::make_unique<ImageViewWidget>();
|
||||
|
||||
auto hSpacer = HorizontalSpacer::Create();
|
||||
hSpacer->addWidgetWithScale(std::move(label), 1);
|
||||
hSpacer->addWidgetWithScale(std::move(image_widget), 14);
|
||||
|
||||
addWidget(std::move(hSpacer));
|
||||
}
|
||||
|
||||
std::unique_ptr<ImageEditorView> ImageEditorView::Create()
|
||||
|
|
32
apps/sample-gui/image_editor/ImageViewWidget.cpp
Normal file
32
apps/sample-gui/image_editor/ImageViewWidget.cpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#include "ImageViewWidget.h"
|
||||
|
||||
#include "GridNode.h"
|
||||
#include "TransformNode.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
ImageViewWidget::ImageViewWidget()
|
||||
{
|
||||
mName = "ImageViewWidget";
|
||||
}
|
||||
|
||||
void ImageViewWidget::doPaint(const PaintEvent* event)
|
||||
{
|
||||
if (!mVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mGridNode)
|
||||
{
|
||||
std::cout << "Setting up grid node" << std::endl;
|
||||
mGridNode = std::make_unique<GridNode>(mLocation);
|
||||
mGridNode->setName(mName + "_GridNode");
|
||||
mGridNode->setNumX(mNumX);
|
||||
mGridNode->setNumY(mNumY);
|
||||
|
||||
mGridNode->setWidth(mSize.mWidth);
|
||||
mGridNode->setHeight(mSize.mHeight);
|
||||
mRootNode->addChild(mGridNode.get());
|
||||
}
|
||||
}
|
18
apps/sample-gui/image_editor/ImageViewWidget.h
Normal file
18
apps/sample-gui/image_editor/ImageViewWidget.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
#include "Widget.h"
|
||||
|
||||
#include "GridNode.h"
|
||||
|
||||
class ImageViewWidget : public Widget
|
||||
{
|
||||
public:
|
||||
ImageViewWidget();
|
||||
|
||||
private:
|
||||
void doPaint(const PaintEvent* event) override;
|
||||
unsigned mNumX{5};
|
||||
unsigned mNumY{5};
|
||||
|
||||
std::unique_ptr<GridNode> mGridNode;
|
||||
};
|
|
@ -1,6 +1,10 @@
|
|||
#include "HorizontalSpacer.h"
|
||||
#include "TextEditorView.h"
|
||||
|
||||
#include "HorizontalSpacer.h"
|
||||
#include "VerticalSpacer.h"
|
||||
|
||||
#include "Theme.h"
|
||||
|
||||
#include "TextNode.h"
|
||||
|
||||
#include <iostream>
|
||||
|
@ -21,7 +25,7 @@ void TextEditorView::Initialize()
|
|||
{
|
||||
auto label = Label::Create();
|
||||
label->setLabel("Text Editor");
|
||||
label->setBackgroundColor(Color(181, 189, 200));
|
||||
label->setBackgroundColor(Theme::getBannerBackground());
|
||||
label->setMargin(1);
|
||||
|
||||
auto textBox = TextBox::Create();
|
||||
|
@ -30,7 +34,7 @@ void TextEditorView::Initialize()
|
|||
|
||||
auto saveButton = Button::Create();
|
||||
saveButton->setLabel("Save");
|
||||
saveButton->setBackgroundColor(Color(200, 200, 200));
|
||||
saveButton->setBackgroundColor(Theme::getButtonPrimaryBackground());
|
||||
saveButton->setMargin(2);
|
||||
auto onSave = [this](Widget* self){
|
||||
if(this && mController && mTextBox)
|
||||
|
@ -43,7 +47,7 @@ void TextEditorView::Initialize()
|
|||
|
||||
auto clearButton = Button::Create();
|
||||
clearButton->setLabel("Clear");
|
||||
clearButton->setBackgroundColor(Color(200, 200, 200));
|
||||
clearButton->setBackgroundColor(Theme::getButtonPrimaryBackground());
|
||||
clearButton->setMargin(2);
|
||||
auto onClear = [this](Widget* self){
|
||||
if(this && mController && mTextBox)
|
||||
|
@ -56,7 +60,7 @@ void TextEditorView::Initialize()
|
|||
|
||||
auto loadButton = Button::Create();
|
||||
loadButton->setLabel("Load");
|
||||
loadButton->setBackgroundColor(Color(200, 200, 200));
|
||||
loadButton->setBackgroundColor(Theme::getButtonPrimaryBackground());
|
||||
loadButton->setMargin(2);
|
||||
auto onLoad = [this](Widget* self){
|
||||
if(this && mController && mTextBox)
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
#include "WebClientView.h"
|
||||
|
||||
#include "Label.h"
|
||||
#include "Color.h"
|
||||
|
||||
#include "TextNode.h"
|
||||
|
||||
#include "Theme.h"
|
||||
|
||||
WebClientView::WebClientView()
|
||||
{
|
||||
auto label = Label::Create();
|
||||
label->setLabel("Web Client");
|
||||
label->setBackgroundColor(Color(200, 189, 160));
|
||||
label->setBackgroundColor(Theme::getBackgroundPrimary());
|
||||
label->setMargin(1);
|
||||
addWidget(std::move(label));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue