[Scummvm-git-logs] scummvm master -> e5adfff85340b2fd0ec69438bf538d240b0684fd
sev-
sev at scummvm.org
Mon Apr 6 23:03:56 UTC 2020
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
52137f6627 GRAPHICS: MACGUI: Turned MacWindow into MacWidget
e5adfff853 GRAPHICS: MACGUI: Pass events to window children
Commit: 52137f6627b5fd69599c11b91c4dc70c1dcc8e9a
https://github.com/scummvm/scummvm/commit/52137f6627b5fd69599c11b91c4dc70c1dcc8e9a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-04-07T00:56:27+02:00
Commit Message:
GRAPHICS: MACGUI: Turned MacWindow into MacWidget
Changed paths:
graphics/macgui/macwidget.h
graphics/macgui/macwindow.cpp
graphics/macgui/macwindow.h
diff --git a/graphics/macgui/macwidget.h b/graphics/macgui/macwidget.h
index fe1df7e753..858bc23c90 100644
--- a/graphics/macgui/macwidget.h
+++ b/graphics/macgui/macwidget.h
@@ -42,14 +42,29 @@ public:
MacWidget(MacWidget *parent, int x, int y, int w, int h, bool focusable);
virtual ~MacWidget();
+ /**
+ * Accessor method for the complete dimensions of the widget.
+ * @return Dimensions of the widget relative to the parent's position.
+ */
const Common::Rect &getDimensions() { return _dims; }
+
bool isFocusable() { return _focusable; }
virtual void setActive(bool active) = 0;
+
+ /**
+ * Method for marking the widget for redraw.
+ * @param dirty True if the widget needs to be redrawn.
+ */
void setDirty(bool dirty) { _contentIsDirty = dirty; }
+
virtual bool draw(ManagedSurface *g, bool forceRedraw = false) = 0;
virtual bool processEvent(Common::Event &event) = 0;
virtual bool hasAllFocus() = 0;
+ virtual void setDimensions(const Common::Rect &r) {
+ _dims = r;
+ }
+
Common::Point getAbsolutePos();
MacWidget *findEventHandler(Common::Event &event, int dx, int dy);
diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp
index e33d9dbe1e..d5fd934293 100644
--- a/graphics/macgui/macwindow.cpp
+++ b/graphics/macgui/macwindow.cpp
@@ -32,7 +32,7 @@
namespace Graphics {
BaseMacWindow::BaseMacWindow(int id, bool editable, MacWindowManager *wm) :
- _id(id), _editable(editable), _wm(wm) {
+ MacWidget(nullptr, 0, 0, 0, 0, true), _id(id), _editable(editable), _wm(wm) {
_callback = 0;
_dataPtr = 0;
diff --git a/graphics/macgui/macwindow.h b/graphics/macgui/macwindow.h
index 672cdda6e1..9140634ec6 100644
--- a/graphics/macgui/macwindow.h
+++ b/graphics/macgui/macwindow.h
@@ -30,6 +30,7 @@
#include "graphics/nine_patch.h"
#include "graphics/palette.h"
+#include "graphics/macgui/macwidget.h"
#include "graphics/macgui/macwindowborder.h"
namespace Graphics {
@@ -67,7 +68,7 @@ using namespace MacWindowConstants;
* Abstract class that defines common functionality for all window classes.
* It supports event callbacks and drawing.
*/
-class BaseMacWindow {
+class BaseMacWindow : public MacWidget {
public:
/**
* Base constructor.
@@ -78,12 +79,6 @@ public:
BaseMacWindow(int id, bool editable, MacWindowManager *wm);
virtual ~BaseMacWindow() {}
- /**
- * Accessor method for the complete dimensions of the window.
- * @return Dimensions of the window (including border) relative to the WM's screen.
- */
- const Common::Rect &getDimensions() { return _dims; }
-
/**
* Accessor method to the id of the window.
* @return The id set in the constructor.
@@ -116,12 +111,6 @@ public:
*/
virtual void setActive(bool active) = 0;
- /**
- * Method for marking the window for redraw.
- * @param dirty True if the window needs to be redrawn.
- */
- void setDirty(bool dirty) { _contentIsDirty = dirty; }
-
/**
* Method called to draw the window into the target surface.
* This method is most often called by the WM, and relies on
@@ -158,9 +147,6 @@ protected:
bool _editable;
ManagedSurface _surface;
- bool _contentIsDirty;
-
- Common::Rect _dims;
bool (*_callback)(WindowClick, Common::Event &, void *);
void *_dataPtr;
@@ -208,7 +194,7 @@ public:
* of the window, although move() and resize() might be more comfortable.
* @param r The desired dimensions of the window.
*/
- void setDimensions(const Common::Rect &r);
+ virtual void setDimensions(const Common::Rect &r);
/**
* Accessor to retrieve the dimensions of the inner surface of the window
Commit: e5adfff85340b2fd0ec69438bf538d240b0684fd
https://github.com/scummvm/scummvm/commit/e5adfff85340b2fd0ec69438bf538d240b0684fd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-04-07T01:03:24+02:00
Commit Message:
GRAPHICS: MACGUI: Pass events to window children
Changed paths:
graphics/macgui/macwindow.cpp
diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp
index d5fd934293..21ebfe5a9a 100644
--- a/graphics/macgui/macwindow.cpp
+++ b/graphics/macgui/macwindow.cpp
@@ -514,6 +514,10 @@ bool MacWindow::processEvent(Common::Event &event) {
return false;
}
+ MacWidget *w = findEventHandler(event, _dims.left, _dims.top);
+ if (w && w->processEvent(event))
+ return true;
+
if (_callback)
return (*_callback)(click, event, _dataPtr);
else
More information about the Scummvm-git-logs
mailing list