diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-11-20 20:37:00 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-11-20 20:37:00 +0100 |
commit | eec019ec3e94d5aee7f7d423a3a43f63237b6e87 (patch) | |
tree | 8f8840976659b1d2bcfd9deb011127664dd0e26f /plugingui/widget.h | |
parent | db6d5834361a2e660301e9511058e370fb884cc5 (diff) |
Refactored Widget.
Diffstat (limited to 'plugingui/widget.h')
-rw-r--r-- | plugingui/widget.h | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/plugingui/widget.h b/plugingui/widget.h index 806ee5c..9827641 100644 --- a/plugingui/widget.h +++ b/plugingui/widget.h @@ -38,8 +38,9 @@ namespace GUI { class Window; class Widget : public Listener, LayoutItem { + friend class Painter; public: - Widget(Widget *parent); + Widget(Widget* parent); virtual ~Widget(); virtual void show(); @@ -59,15 +60,14 @@ public: virtual bool isFocusable() { return false; } virtual bool catchMouse() { return false; } - void addChild(Widget *widget); - void removeChild(Widget *widget); + void addChild(Widget* widget); + void removeChild(Widget* widget); virtual void repaintEvent(RepaintEvent* repaintEvent) {} virtual void mouseMoveEvent(MouseMoveEvent* mouseMoveEvent) {} virtual void buttonEvent(ButtonEvent* buttonEvent) {} virtual void scrollEvent(ScrollEvent* scrollEvent) {} virtual void keyEvent(KeyEvent* keyEvent) {} - virtual void mouseLeaveEvent() {} virtual void mouseEnterEvent() {} @@ -75,25 +75,29 @@ public: virtual Window* window(); - void repaint_r(RepaintEvent* repaintEvent); - - PixelBufferAlpha pixbuf; std::vector<PixelBufferAlpha*> getPixelBuffers(); bool hasKeyboardFocus(); - Widget *parent; - bool visible(); void setVisible(bool visible); protected: + void repaintChildren(RepaintEvent* repaintEvent); + + PixelBufferAlpha pixbuf{0,0}; + std::vector<Widget*> children; - Window *_window; - size_t _x, _y, _width, _height; -private: - bool _visible; + Widget* parent = nullptr; + Window* _window = nullptr; + + size_t _x{0}; + size_t _y{0}; + size_t _width{0}; + size_t _height{0}; + + bool _visible = true; }; } // GUI:: |