Initial commit.

This commit is contained in:
jmsgrogan 2020-05-02 08:31:03 +01:00
commit 59c6161fdb
134 changed files with 4751 additions and 0 deletions

View file

@ -0,0 +1,62 @@
#pragma once
#include <memory>
#include <vector>
#include "DiscretePoint.h"
#include "VisualLayer.h"
#include "PaintEvent.h"
#include "Color.h"
#include "MouseEvent.h"
class Widget
{
protected:
DiscretePoint mLocation;
unsigned mWidth;
unsigned mHeight;
std::vector<VisualLayerPtr> mLayers;
std::vector<std::shared_ptr<Widget> > mChildren;
ColorPtr mBackgroundColor;
public:
Widget();
virtual ~Widget();
void AddWidget(std::shared_ptr<Widget> widget);
void SetBackgroundColor(ColorPtr color);
void SetSize(unsigned mWidth, unsigned mHeight);
DiscretePoint GetLocation();
void SetLocation(const DiscretePoint& loc);
unsigned GetWidth();
unsigned GetHeight();
std::vector<VisualLayerPtr> GetLayers();
static std::shared_ptr<Widget> Create();
virtual void OnPaintEvent(PaintEventPtr event);
virtual bool OnMouseEvent(MouseEventPtr event);
bool Contains(const DiscretePoint& loc);
protected:
virtual void OnMyMouseEvent(MouseEventPtr event);
virtual void AddChildLayers(PaintEventPtr event);
virtual void AddBackground(PaintEventPtr event);
};
using WidgetPtr = std::shared_ptr<Widget>;