Running on Linux again and small clean up.
This commit is contained in:
parent
683ba5447f
commit
2bde5567be
24 changed files with 113 additions and 60 deletions
|
@ -1,4 +1,10 @@
|
|||
#include "Button.h"
|
||||
|
||||
#include "TextElement.h"
|
||||
#include "GeometryElement.h"
|
||||
#include "VisualLayer.h"
|
||||
#include "MouseEvent.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
Button::Button()
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#include "Widget.h"
|
||||
#include "Color.h"
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
class PaintEvent;
|
||||
class MouseEvent;
|
||||
|
||||
class Button : public Widget
|
||||
{
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#include "Label.h"
|
||||
|
||||
#include "TextElement.h"
|
||||
#include "GeometryElement.h"
|
||||
#include "VisualLayer.h"
|
||||
|
||||
Label::Label()
|
||||
: Widget(),
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include "Widget.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
class Label : public Widget
|
||||
{
|
||||
private:
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
#include "TextBox.h"
|
||||
|
||||
#include "TextElement.h"
|
||||
#include <string>
|
||||
#include "VisualLayer.h"
|
||||
#include "GeometryElement.h"
|
||||
#include "KeyboardEvent.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
TextBox::TextBox()
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include "Widget.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
class TextBox : public Widget
|
||||
{
|
||||
private:
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
#include "RectangleElement.h"
|
||||
#include "Widget.h"
|
||||
|
||||
#include "RectangleElement.h"
|
||||
#include "MouseEvent.h"
|
||||
#include "KeyboardEvent.h"
|
||||
#include "PaintEvent.h"
|
||||
#include "VisualLayer.h"
|
||||
#include "TextElement.h"
|
||||
#include "Color.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
Widget::Widget()
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
#include "DiscretePoint.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "DiscretePoint.h"
|
||||
#include "VisualLayer.h"
|
||||
#include "PaintEvent.h"
|
||||
#include "Color.h"
|
||||
#include "MouseEvent.h"
|
||||
#include "KeyboardEvent.h"
|
||||
class MouseEvent;
|
||||
class KeyboardEvent;
|
||||
class PaintEvent;
|
||||
|
||||
class VisualLayer;
|
||||
class Color;
|
||||
|
||||
class Widget
|
||||
{
|
||||
|
@ -34,12 +36,12 @@ protected:
|
|||
BoundedSize mSize;
|
||||
BoundaryOffset mPadding;
|
||||
BoundaryOffset mMargin;
|
||||
std::vector<VisualLayerUPtr> mMyLayers;
|
||||
std::vector<std::unique_ptr<VisualLayer> > mMyLayers;
|
||||
std::vector<VisualLayer*> mLayers;
|
||||
std::vector<std::unique_ptr<Widget> > mChildren;
|
||||
unsigned mBorderThickness;
|
||||
ColorUPtr mBackgroundColor;
|
||||
ColorUPtr mBorderColor;
|
||||
std::unique_ptr<Color> mBackgroundColor;
|
||||
std::unique_ptr<Color> mBorderColor;
|
||||
bool mVisible;
|
||||
|
||||
public:
|
||||
|
@ -66,7 +68,7 @@ public:
|
|||
|
||||
bool Contains(const DiscretePoint& loc) const;
|
||||
|
||||
void SetBackgroundColor(ColorUPtr color);
|
||||
void SetBackgroundColor(std::unique_ptr<Color> color);
|
||||
|
||||
void SetBounds(unsigned width, unsigned height);
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#include "TextElement.h"
|
||||
|
||||
#include "Color.h"
|
||||
|
||||
TextElement::TextElement(const std::string& content, const DiscretePoint& loc)
|
||||
: mContent(content),
|
||||
mLocation(loc),
|
||||
mFontLabel("7x14"),
|
||||
mFontLabel("fixed"),
|
||||
mFillColor(Color::Create(255, 255, 255)),
|
||||
mStrokeColor(Color::Create(0, 0, 0))
|
||||
{
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
#pragma once
|
||||
|
||||
#include "DiscretePoint.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "DiscretePoint.h"
|
||||
#include "Color.h"
|
||||
class Color;
|
||||
|
||||
class TextElement
|
||||
{
|
||||
std::string mContent;
|
||||
DiscretePoint mLocation;
|
||||
std::string mFontLabel;
|
||||
ColorUPtr mFillColor;
|
||||
ColorUPtr mStrokeColor;
|
||||
std::unique_ptr<Color> mFillColor;
|
||||
std::unique_ptr<Color> mStrokeColor;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -29,8 +30,8 @@ public:
|
|||
std::string GetContent() const;
|
||||
std::string GetFontLabel() const;
|
||||
void SetContent(const std::string& content);
|
||||
void SetFillColor(ColorUPtr color);
|
||||
void SetStrokeColor(ColorUPtr color);
|
||||
void SetFillColor(std::unique_ptr<Color> color);
|
||||
void SetStrokeColor(std::unique_ptr<Color> color);
|
||||
};
|
||||
|
||||
using TextElementUPtr = std::unique_ptr<TextElement>;
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#include "VisualLayer.h"
|
||||
|
||||
#include "GeometryElement.h"
|
||||
#include "TextElement.h"
|
||||
|
||||
VisualLayer::VisualLayer()
|
||||
: mShape(),
|
||||
mText()
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#pragma once
|
||||
#include <memory>
|
||||
|
||||
#include "GeometryElement.h"
|
||||
#include "TextElement.h"
|
||||
class GeometryElement;
|
||||
class TextElement;
|
||||
|
||||
class VisualLayer
|
||||
{
|
||||
GeometryElementUPtr mShape;
|
||||
TextElementUPtr mText;
|
||||
std::unique_ptr<GeometryElement> mShape;
|
||||
std::unique_ptr<TextElement> mText;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -19,7 +19,7 @@ public:
|
|||
TextElement* GetText() const;
|
||||
bool HasShape() const;
|
||||
bool HasText() const;
|
||||
void SetShape(GeometryElementUPtr shape);
|
||||
void SetText(TextElementUPtr text);
|
||||
void SetShape(std::unique_ptr<GeometryElement> shape);
|
||||
void SetText(std::unique_ptr<TextElement> text);
|
||||
};
|
||||
using VisualLayerUPtr = std::unique_ptr<VisualLayer>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue