summaryrefslogtreecommitdiff
path: root/src/widget_type.h
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2021-04-04 10:34:37 +0200
committerNiels Martin Hansen <nielsm@indvikleren.dk>2021-04-09 12:18:52 +0200
commit64c9af09914472c6a9eeb495cd790f7c325b194c (patch)
treede543066991f5578dfc4ac6d5fab3bf27a443ae8 /src/widget_type.h
parent49d370185bf2a5fe8c34a4087ee8e9763c2821c9 (diff)
downloadopenttd-64c9af09914472c6a9eeb495cd790f7c325b194c.tar.xz
Add: NWidgetBase::GetCurrentRect function
Diffstat (limited to 'src/widget_type.h')
-rw-r--r--src/widget_type.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/widget_type.h b/src/widget_type.h
index c5083c6c5..1692ef226 100644
--- a/src/widget_type.h
+++ b/src/widget_type.h
@@ -158,6 +158,16 @@ public:
virtual void Draw(const Window *w) = 0;
virtual void SetDirty(const Window *w) const;
+ Rect GetCurrentRect() const
+ {
+ Rect r;
+ r.left = this->pos_x;
+ r.top = this->pos_y;
+ r.right = this->pos_x + this->current_x;
+ r.bottom = this->pos_y + this->current_y;
+ return r;
+ }
+
WidgetType type; ///< Type of the widget / nested widget.
uint fill_x; ///< Horizontal fill stepsize (from initial size, \c 0 means not resizable).
uint fill_y; ///< Vertical fill stepsize (from initial size, \c 0 means not resizable).