diff options
author | Eugene Sandulenko | 2016-04-25 10:41:58 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-04-25 10:41:58 +0200 |
commit | 438ddd586fff6d6a0755aaf83b2d714942cbb9a8 (patch) | |
tree | a09b5af22acc18aa09414d1d4a1eba37bed823d7 | |
parent | 811b300ff613a7b967a296d9dab75739f8a86f6f (diff) | |
download | scummvm-rg350-438ddd586fff6d6a0755aaf83b2d714942cbb9a8.tar.gz scummvm-rg350-438ddd586fff6d6a0755aaf83b2d714942cbb9a8.tar.bz2 scummvm-rg350-438ddd586fff6d6a0755aaf83b2d714942cbb9a8.zip |
WAGE: Splitout BaseMacWindow class
-rw-r--r-- | engines/wage/macwindow.cpp | 2 | ||||
-rw-r--r-- | engines/wage/macwindow.h | 39 |
2 files changed, 29 insertions, 12 deletions
diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp index 076584ca0e..012574ab0a 100644 --- a/engines/wage/macwindow.cpp +++ b/engines/wage/macwindow.cpp @@ -55,7 +55,7 @@ namespace Wage { MacWindow::MacWindow(int id, bool scrollable, bool resizable) : - _scrollable(scrollable), _id(id), _resizable(resizable) { + BaseMacWindow(id), _scrollable(scrollable), _resizable(resizable) { _active = false; _borderIsDirty = true; _contentIsDirty = true; diff --git a/engines/wage/macwindow.h b/engines/wage/macwindow.h index 315203b491..c90fee891f 100644 --- a/engines/wage/macwindow.h +++ b/engines/wage/macwindow.h @@ -71,25 +71,48 @@ enum WindowClick { kBorderResizeButton }; -class MacWindow { +class BaseMacWindow { +public: + BaseMacWindow(int id) : _id(id) {} + ~BaseMacWindow() {} + + const Common::Rect &getDimensions() { return _dims; } + int getId() { return _id; } + Graphics::ManagedSurface *getSurface() { return &_surface; } + + bool draw(Graphics::ManagedSurface *g, bool forceRedraw = false) { return false; } + bool processEvent(Common::Event &event) { return false; } + + void setCallback(bool (*callback)(WindowClick, Common::Event &, void *), void *data) { _callback = callback; _dataPtr = data; } + +protected: + int _id; + + Graphics::ManagedSurface _surface; + + Common::Rect _dims; + + bool (*_callback)(WindowClick, Common::Event &, void *); + void *_dataPtr; +}; + +class MacWindow : public BaseMacWindow { public: MacWindow(int id, bool scrollable, bool resizable); ~MacWindow(); void move(int x, int y); void resize(int w, int h); void setDimensions(const Common::Rect &r); - const Common::Rect &getDimensions() { return _dims; } const Common::Rect &getInnerDimensions() { return _innerDims; } + bool draw(Graphics::ManagedSurface *g, bool forceRedraw = false); + void setActive(bool active); - Graphics::ManagedSurface *getSurface() { return &_surface; } void setTitle(Common::String &title) { _title = title; } void setHighlight(WindowClick highlightedPart); void setScroll(float scrollPos, float scrollSize); void setDirty(bool dirty) { _contentIsDirty = dirty; } - int getId() { return _id; } bool processEvent(Common::Event &event); - void setCallback(bool (*callback)(WindowClick, Common::Event &, void *), void *data) { _callback = callback; _dataPtr = data; } bool beingDragged() { return _beingDragged; } bool beingResized() { return _beingResized; } @@ -103,7 +126,6 @@ private: WindowClick isInBorder(int x, int y); private: - Graphics::ManagedSurface _surface; Graphics::ManagedSurface _borderSurface; Graphics::ManagedSurface _composeSurface; bool _scrollable; @@ -111,7 +133,6 @@ private: bool _active; bool _borderIsDirty; bool _contentIsDirty; - int _id; bool _beingDragged, _beingResized; int _draggedX, _draggedY; @@ -119,13 +140,9 @@ private: WindowClick _highlightedPart; float _scrollPos, _scrollSize; - Common::Rect _dims; Common::Rect _innerDims; Common::String _title; - - bool (*_callback)(WindowClick, Common::Event &, void *); - void *_dataPtr; }; } // End of namespace Wage |