From 4f07e8dec4fcc2d5b6a4c505fcec77a914ace853 Mon Sep 17 00:00:00 2001 From: Harishankar Kumar <hari01584@gmail.com> Date: Wed, 31 May 2023 02:08:16 +0530 Subject: [PATCH] GRAPHICS: MACGUI: Added support to change inner dimension of macwindow derived object Added setInnerDimension which calls resize (with bool inner dimension change: true), moveto and finally updateOuterDimension. This was implemented to match window rectangle size as used by window property `rect`, `rect of window` in `workshop` uses this. --- graphics/macgui/macwindow.cpp | 9 +++++++++ graphics/macgui/macwindow.h | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp index 216f3a245f3..7f314935e61 100644 --- a/graphics/macgui/macwindow.cpp +++ b/graphics/macgui/macwindow.cpp @@ -147,6 +147,15 @@ void MacWindow::setDimensions(const Common::Rect &r) { _wm->setFullRefresh(true); } +void MacWindow::setInnerDimensions(const Common::Rect &r) { + resizeInner(r.width(), r.height()); + _innerDims.moveTo(r.left, r.top); + updateOuterDims(); + + _contentIsDirty = true; + _wm->setFullRefresh(true); +} + void MacWindow::setBackgroundPattern(int pattern) { _pattern = pattern; _hasPattern = true; diff --git a/graphics/macgui/macwindow.h b/graphics/macgui/macwindow.h index 92d42d5fd81..9b966278fc6 100644 --- a/graphics/macgui/macwindow.h +++ b/graphics/macgui/macwindow.h @@ -233,6 +233,14 @@ public: */ void setDimensions(const Common::Rect &r) override; + /** + * Change the inner dimension of the window. + * Note that this changes the window inner dimension and calculates + * outer dimension (ie with border, etc) + * @param r The desired dimensions of the window. + */ + void setInnerDimensions(const Common::Rect &r); + /** * Set a background pattern for the window. * @param pattern