From b3be440d78f155f6aa0d69cfe7824d65b1394381 Mon Sep 17 00:00:00 2001 From: alberth Date: Sun, 16 May 2010 19:13:31 +0000 Subject: (svn r19843) -Codechange: Move ComputeMaxSize() to widget_type.h to make it globally accessible. --- src/widget.cpp | 16 ---------------- src/widget_type.h | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/widget.cpp b/src/widget.cpp index 377ef0667..9a9c3094a 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -941,22 +941,6 @@ void NWidgetContainer::FillNestedArray(NWidgetBase **array, uint length) } } -/** - * Return the biggest possible size of a nested widget. - * @param base Base size of the widget. - * @param max_space Available space for the widget. - * @param step Stepsize of the widget. - * @return Biggest possible size of the widget, assuming that \a base may only be incremented by \a step size steps. - */ -static inline uint ComputeMaxSize(uint base, uint max_space, uint step) -{ - if (base >= max_space || step == 0) return base; - if (step == 1) return max_space; - int increment = max_space - base; - increment -= increment % step; - return base + increment; -} - /** * Widgets stacked on top of each other. */ diff --git a/src/widget_type.h b/src/widget_type.h index fca5f3c56..29cb13acd 100644 --- a/src/widget_type.h +++ b/src/widget_type.h @@ -485,6 +485,22 @@ private: static Dimension closebox_dimension; ///< Cached size of a closebox widget. }; +/** + * Return the biggest possible size of a nested widget. + * @param base Base size of the widget. + * @param max_space Available space for the widget. + * @param step Stepsize of the widget. + * @return Biggest possible size of the widget, assuming that \a base may only be incremented by \a step size steps. + */ +static FORCEINLINE uint ComputeMaxSize(uint base, uint max_space, uint step) +{ + if (base >= max_space || step == 0) return base; + if (step == 1) return max_space; + uint increment = max_space - base; + increment -= increment % step; + return base + increment; +} + /** * @defgroup NestedWidgetParts Hierarchical widget parts * To make nested widgets easier to enter, nested widget parts have been created. They allow the tree to be defined in a flat array of parts. -- cgit v1.2.3-54-g00ecf