Convert visual layers to scene nodes.

This commit is contained in:
James Grogan 2022-11-16 15:06:08 +00:00
parent 798cb365d7
commit 3e53bd9e00
64 changed files with 863 additions and 551 deletions

View file

@ -10,7 +10,9 @@ class MouseEvent;
class KeyboardEvent;
class PaintEvent;
class VisualLayer;
class AbstractVisualNode;
class TransformNode;
class RectangleNode;
class Widget
{
@ -71,7 +73,7 @@ public:
BoundedSize getSize() const;
std::vector<VisualLayer*> getLayers() const;
TransformNode* getRootNode() const;
const DiscretePoint& getLocation() const;
@ -106,27 +108,38 @@ protected:
virtual void onMyMouseEvent(const MouseEvent* event);
virtual void addChildLayers(const PaintEvent* event);
virtual void updateBackground(const PaintEvent* event);
virtual void addBackground(const PaintEvent* event);
virtual void doPaint(const PaintEvent* event);
virtual void updateChildLocations();
void addMyLayers();
bool needsUpdate() const;
protected:
virtual bool isDirty() const;
DiscretePoint mLocation;
BoundedSize mSize;
BoundaryOffset mPadding;
BoundaryOffset mMargin;
std::vector<std::unique_ptr<VisualLayer> > mMyLayers;
std::vector<VisualLayer*> mLayers;
std::unique_ptr<TransformNode> mRootNode;
std::vector<std::unique_ptr<Widget> > mChildren;
unsigned mBorderThickness{0};
Color mBackgroundColor;
Color mBorderColor;
bool mVisible{false};
bool mDirty{true};
std::unique_ptr<RectangleNode> mBackgroundNode;
bool mTransformDirty{true};
bool mMaterialDirty{true};
bool mVisibilityDirty{true};
std::vector<TransformNode*> mPendingChildNodes;
};
using WidgetUPtr = std::unique_ptr<Widget>;