1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-09-02 19:39:12 +00:00

Add: NWidgetBase::GetCurrentRect function

This commit is contained in:
Niels Martin Hansen
2021-04-04 10:34:37 +02:00
parent 49d370185b
commit 64c9af0991

View File

@@ -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).