diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-11-20 21:45:41 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-11-20 21:45:41 +0100 |
commit | 44fa03c1bf8eb60d38256b48720f9958c735aadc (patch) | |
tree | b85a9575687002f7cd578e5de282f75d637bcbc2 /plugingui/window.h | |
parent | eec019ec3e94d5aee7f7d423a3a43f63237b6e87 (diff) |
Refactored Window.
Diffstat (limited to 'plugingui/window.h')
-rw-r--r-- | plugingui/window.h | 101 |
1 files changed, 51 insertions, 50 deletions
diff --git a/plugingui/window.h b/plugingui/window.h index 23d91e0..7701ad9 100644 --- a/plugingui/window.h +++ b/plugingui/window.h @@ -24,8 +24,7 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#ifndef __DRUMGIZMO_WINDOW_H__ -#define __DRUMGIZMO_WINDOW_H__ +#pragma once #include "widget.h" @@ -38,68 +37,70 @@ namespace GUI { class Window : public Widget { public: - Window(); - ~Window(); + Window(); + ~Window(); - void show(); - void hide(); + void setFixedSize(int width, int height); + void setCaption(const std::string& caption); - void setFixedSize(int width, int height); - void resize(int width, int height); - void move(size_t x, size_t y); + // From Widget: + void resize(int width, int height) override; + void move(size_t x, size_t y) override; + size_t x() override; + size_t y() override; + size_t width() override; + size_t height() override; + size_t windowX() override; + size_t windowY() override; + void show() override; + void hide() override; + Window* window() override; - size_t x(); - size_t y(); - size_t windowX(); - size_t windowY(); - size_t width(); - size_t height(); + EventHandler* eventHandler(); - void setCaption(std::string caption); + Widget* keyboardFocus(); + void setKeyboardFocus(Widget* widget); - void addChild(Widget *widget); + Widget* buttonDownFocus(); + void setButtonDownFocus(Widget* widget); - void repaintEvent(GUI::RepaintEvent* repaintEvent); + Widget* mouseFocus(); + void setMouseFocus(Widget* widget); - void beginPaint(); - void endPaint(); - - Window *window(); - - EventHandler *eventHandler(); - - // handlers - virtual void redraw(); - void resized(size_t w, size_t h); - - Widget *keyboardFocus(); - void setKeyboardFocus(Widget *widget); - - Widget *buttonDownFocus(); - void setButtonDownFocus(Widget *widget); +protected: + // For the EventHandler + friend class EventHandler; + void redraw(); + void resized(size_t w, size_t h); + void updateBuffer(); - Widget *mouseFocus(); - void setMouseFocus(Widget *widget); + // For the Painter + friend class Painter; + void beginPaint(); + void endPaint(); - PixelBuffer wpixbuf; - void updateBuffer(); + // From Widget: + void repaintEvent(RepaintEvent* repaintEvent) override; -protected: - size_t refcount; + // For the NativweWindow + friend class NativeWindowX11; + friend class NativeWindowWin32; + friend class NativeWindowPugl; + PixelBuffer wpixbuf; - Widget *_keyboardFocus; - Widget *_buttonDownFocus; - Widget *_mouseFocus; + size_t refcount{0}; - NativeWindow *native; - EventHandler *eventhandler; + Widget* _keyboardFocus{nullptr}; + Widget* _buttonDownFocus{nullptr}; + Widget* _mouseFocus{nullptr}; - Image back; - Image logo; + NativeWindow* native{nullptr}; + EventHandler* eventhandler{nullptr}; - size_t max_refcount; -}; + Image back{":bg.png"}; + Image logo{":logo.png"}; + size_t maxRefcount{0}; }; -#endif/*__DRUMGIZMO_WINDOW_H__*/ +} // GUI:: |