Mercurial > hg > openttd
changeset 15214:238a73de7bcf draft
(svn r19843) -Codechange: Move ComputeMaxSize() to widget_type.h to make it globally accessible.
author | alberth <alberth@openttd.org> |
---|---|
date | Sun, 16 May 2010 19:13:31 +0000 |
parents | ca6a446ce6d6 |
children | c68f3c67204d |
files | src/widget.cpp src/widget_type.h |
diffstat | 2 files changed, 16 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/widget.cpp +++ b/src/widget.cpp @@ -942,22 +942,6 @@ } /** - * 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. */ NWidgetStacked::NWidgetStacked() : NWidgetContainer(NWID_SELECTION)
--- a/src/widget_type.h +++ b/src/widget_type.h @@ -486,6 +486,22 @@ }; /** + * 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. *