From c497e9e7edb2a891544450280e326c31a964d1a9 Mon Sep 17 00:00:00 2001 From: alberth Date: Thu, 21 May 2009 18:12:28 +0000 Subject: (svn r16372) -Codechange: Simplify size calculations with a few helper functions. --- src/widget_type.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/widget_type.h') diff --git a/src/widget_type.h b/src/widget_type.h index 4b49741bb..888d9052d 100644 --- a/src/widget_type.h +++ b/src/widget_type.h @@ -172,6 +172,9 @@ public: this->padding_left = left; }; + inline uint GetHorizontalStepSize() const; + inline uint GetVerticalStepSize() const; + WidgetType type; ///< Type of the widget / nested widget. bool fill_x; ///< Allow horizontal filling from initial size. bool fill_y; ///< Allow vertical filling from initial size. @@ -195,6 +198,18 @@ public: uint8 padding_left; ///< Paddings added to the left of the widget. Managed by parent container widget. }; +/** Get the horizontal sizing step. */ +inline uint NWidgetBase::GetHorizontalStepSize() const +{ + return this->fill_x ? 1 : 0; +} + +/** Get the vertical sizing step. */ +inline uint NWidgetBase::GetVerticalStepSize() const +{ + return this->fill_y ? 1 : 0; +} + /** Base class for a resizable nested widget. * @ingroup NestedWidgets */ class NWidgetResizeBase : public NWidgetBase { -- cgit v1.2.3-54-g00ecf