More window cleaning
This commit is contained in:
parent
6adc441e6f
commit
53c98a227d
29 changed files with 422 additions and 261 deletions
|
@ -15,14 +15,42 @@ class Color;
|
|||
class Widget
|
||||
{
|
||||
public:
|
||||
struct BoundaryOffset{
|
||||
struct BoundaryOffset
|
||||
{
|
||||
bool operator==(const BoundaryOffset& rhs) const
|
||||
{
|
||||
return (mLeft == rhs.mLeft)
|
||||
&& (mRight == rhs.mRight)
|
||||
&& (mTop == rhs.mTop)
|
||||
&& (mBottom == rhs.mBottom);
|
||||
}
|
||||
bool operator!=(const BoundaryOffset& rhs) const
|
||||
{
|
||||
return !operator==(rhs);
|
||||
}
|
||||
|
||||
unsigned mLeft = 0;
|
||||
unsigned mRight = 0;
|
||||
unsigned mTop = 0;
|
||||
unsigned mBottom = 0;
|
||||
};
|
||||
|
||||
struct BoundedSize{
|
||||
struct BoundedSize
|
||||
{
|
||||
bool operator==(const BoundedSize& rhs) const
|
||||
{
|
||||
return (mWidth == rhs.mWidth)
|
||||
&& (mMaxWidth == rhs.mMaxWidth)
|
||||
&& (mMinWidth == rhs.mMinWidth)
|
||||
&& (mHeight == rhs.mHeight)
|
||||
&& (mMaxHeight == rhs.mMaxHeight)
|
||||
&& (mMinHeight == rhs.mMinHeight);
|
||||
}
|
||||
bool operator!=(const BoundedSize& rhs) const
|
||||
{
|
||||
return !operator==(rhs);
|
||||
}
|
||||
|
||||
unsigned mWidth = 0;
|
||||
unsigned mMaxWidth = 0;
|
||||
unsigned mMinWidth = 0;
|
||||
|
@ -31,19 +59,6 @@ public:
|
|||
unsigned mMinHeight = 0;
|
||||
};
|
||||
|
||||
protected:
|
||||
DiscretePoint mLocation;
|
||||
BoundedSize mSize;
|
||||
BoundaryOffset mPadding;
|
||||
BoundaryOffset mMargin;
|
||||
std::vector<std::unique_ptr<VisualLayer> > mMyLayers;
|
||||
std::vector<VisualLayer*> mLayers;
|
||||
std::vector<std::unique_ptr<Widget> > mChildren;
|
||||
unsigned mBorderThickness;
|
||||
std::unique_ptr<Color> mBackgroundColor;
|
||||
std::unique_ptr<Color> mBorderColor;
|
||||
bool mVisible;
|
||||
|
||||
public:
|
||||
|
||||
Widget();
|
||||
|
@ -52,51 +67,66 @@ public:
|
|||
|
||||
static std::unique_ptr<Widget> Create();
|
||||
|
||||
virtual void AddWidget(std::unique_ptr<Widget> widget);
|
||||
virtual void addWidget(std::unique_ptr<Widget> widget);
|
||||
|
||||
BoundedSize GetSize() const;
|
||||
BoundedSize getSize() const;
|
||||
|
||||
std::vector<VisualLayer*> GetLayers() const;
|
||||
std::vector<VisualLayer*> getLayers() const;
|
||||
|
||||
DiscretePoint GetLocation() const;
|
||||
DiscretePoint getLocation() const;
|
||||
|
||||
virtual void OnPaintEvent(const PaintEvent* event);
|
||||
virtual void onPaintEvent(const PaintEvent* event);
|
||||
|
||||
virtual bool OnMouseEvent(const MouseEvent* event);
|
||||
virtual bool onMouseEvent(const MouseEvent* event);
|
||||
|
||||
virtual bool OnKeyboardEvent(const KeyboardEvent* event);
|
||||
virtual bool onKeyboardEvent(const KeyboardEvent* event);
|
||||
|
||||
bool Contains(const DiscretePoint& loc) const;
|
||||
bool contains(const DiscretePoint& loc) const;
|
||||
|
||||
void SetBackgroundColor(std::unique_ptr<Color> color);
|
||||
void setBackgroundColor(std::unique_ptr<Color> color);
|
||||
|
||||
void SetBounds(unsigned width, unsigned height);
|
||||
void setBounds(unsigned width, unsigned height);
|
||||
|
||||
void SetSize(const BoundedSize& size);
|
||||
void setSize(const BoundedSize& size);
|
||||
|
||||
void SetMargin(unsigned margin);
|
||||
void setMargin(unsigned margin);
|
||||
|
||||
void SetMargin(const BoundaryOffset& margin);
|
||||
void setMargin(const BoundaryOffset& margin);
|
||||
|
||||
void SetPadding(unsigned padding);
|
||||
void setPadding(unsigned padding);
|
||||
|
||||
void SetPadding(const BoundaryOffset& padding);
|
||||
void setPadding(const BoundaryOffset& padding);
|
||||
|
||||
void SetLocation(const DiscretePoint& loc);
|
||||
void setLocation(const DiscretePoint& loc);
|
||||
|
||||
void SetVisible(bool visible);
|
||||
void setVisible(bool visible);
|
||||
|
||||
protected:
|
||||
virtual bool onMyKeyboardEvent(const KeyboardEvent* event);
|
||||
|
||||
virtual bool OnMyKeyboardEvent(const KeyboardEvent* event);
|
||||
virtual void onMyMouseEvent(const MouseEvent* event);
|
||||
|
||||
virtual void OnMyMouseEvent(const MouseEvent* event);
|
||||
virtual void addChildLayers(const PaintEvent* event);
|
||||
|
||||
virtual void AddChildLayers(const PaintEvent* event);
|
||||
virtual void addBackground(const PaintEvent* event);
|
||||
|
||||
virtual void AddBackground(const PaintEvent* event);
|
||||
void addMyLayers();
|
||||
|
||||
void CopyMyLayers();
|
||||
bool needsUpdate() const;
|
||||
|
||||
protected:
|
||||
DiscretePoint mLocation;
|
||||
BoundedSize mSize;
|
||||
BoundaryOffset mPadding;
|
||||
BoundaryOffset mMargin;
|
||||
std::vector<std::unique_ptr<VisualLayer> > mMyLayers;
|
||||
std::vector<VisualLayer*> mLayers;
|
||||
std::vector<std::unique_ptr<Widget> > mChildren;
|
||||
unsigned mBorderThickness{0};
|
||||
std::unique_ptr<Color> mBackgroundColor;
|
||||
std::unique_ptr<Color> mBorderColor;
|
||||
bool mVisible{false};
|
||||
bool mDirty{true};
|
||||
};
|
||||
|
||||
using WidgetUPtr = std::unique_ptr<Widget>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue