Move windows to uptr. Add simple text editing.

This commit is contained in:
jmsgrogan 2020-06-20 16:34:10 +01:00
parent 2bcc7b3d83
commit b99708e7d3
55 changed files with 1257 additions and 994 deletions

View file

@ -8,55 +8,63 @@
#include "PaintEvent.h"
#include "Color.h"
#include "MouseEvent.h"
#include "KeyboardEvent.h"
class Widget
{
protected:
DiscretePoint mLocation;
unsigned mWidth;
unsigned mHeight;
std::vector<VisualLayerPtr> mLayers;
std::vector<std::shared_ptr<Widget> > mChildren;
ColorPtr mBackgroundColor;
DiscretePoint mLocation;
unsigned mWidth;
unsigned mHeight;
std::vector<VisualLayerUPtr> mMyLayers;
std::vector<VisualLayer*> mLayers;
std::vector<std::unique_ptr<Widget> > mChildren;
ColorUPtr mBackgroundColor;
public:
Widget();
Widget();
virtual ~Widget();
virtual ~Widget();
void AddWidget(std::shared_ptr<Widget> widget);
static std::unique_ptr<Widget> Create();
void SetBackgroundColor(ColorPtr color);
void AddWidget(std::unique_ptr<Widget> widget);
void SetSize(unsigned mWidth, unsigned mHeight);
unsigned GetWidth() const;
DiscretePoint GetLocation();
unsigned GetHeight() const;
void SetLocation(const DiscretePoint& loc);
std::vector<VisualLayer*> GetLayers() const;
unsigned GetWidth();
DiscretePoint GetLocation() const;
unsigned GetHeight();
virtual void OnPaintEvent(const PaintEvent* event);
std::vector<VisualLayerPtr> GetLayers();
virtual bool OnMouseEvent(const MouseEvent* event);
static std::shared_ptr<Widget> Create();
virtual bool OnKeyboardEvent(const KeyboardEvent* event);
virtual void OnPaintEvent(PaintEventPtr event);
bool Contains(const DiscretePoint& loc) const;
virtual bool OnMouseEvent(MouseEventPtr event);
void SetBackgroundColor(ColorUPtr color);
bool Contains(const DiscretePoint& loc);
void SetSize(unsigned mWidth, unsigned mHeight);
void SetLocation(const DiscretePoint& loc);
protected:
virtual void OnMyMouseEvent(MouseEventPtr event);
virtual bool OnMyKeyboardEvent(const KeyboardEvent* event);
virtual void AddChildLayers(PaintEventPtr event);
virtual void OnMyMouseEvent(const MouseEvent* event);
virtual void AddBackground(PaintEventPtr event);
virtual void AddChildLayers(const PaintEvent* event);
virtual void AddBackground(const PaintEvent* event);
void CopyMyLayers();
};
using WidgetPtr = std::shared_ptr<Widget>;
using WidgetUPtr = std::unique_ptr<Widget>;