diff options
author | alberth <alberth@openttd.org> | 2010-05-16 19:17:02 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2010-05-16 19:17:02 +0000 |
commit | 638cfe86e3c821ff4756b4b959b46ab19b55c451 (patch) | |
tree | 69cc0d8420c3360a46c9ee66082e717e1529481e /src/widget_type.h | |
parent | b3be440d78f155f6aa0d69cfe7824d65b1394381 (diff) | |
download | openttd-638cfe86e3c821ff4756b4b959b46ab19b55c451.tar.xz |
(svn r19844) -Fix: Move NWidgetBase::StoreSizePosition() to an include file, and use proper inline macro.
Diffstat (limited to 'src/widget_type.h')
-rw-r--r-- | src/widget_type.h | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/widget_type.h b/src/widget_type.h index 29cb13acd..fcb8aa4d0 100644 --- a/src/widget_type.h +++ b/src/widget_type.h @@ -137,7 +137,7 @@ public: * @param bottom Amount of additional space below the widget. * @param left Amount of additional space left of the widget. */ - inline void SetPadding(uint8 top, uint8 right, uint8 bottom, uint8 left) + FORCEINLINE void SetPadding(uint8 top, uint8 right, uint8 bottom, uint8 left) { this->padding_top = top; this->padding_right = right; @@ -145,8 +145,8 @@ public: this->padding_left = left; }; - inline uint GetHorizontalStepSize(SizingType sizing) const; - inline uint GetVerticalStepSize(SizingType sizing) const; + FORCEINLINE uint GetHorizontalStepSize(SizingType sizing) const; + FORCEINLINE uint GetVerticalStepSize(SizingType sizing) const; virtual void Draw(const Window *w) = 0; virtual void SetDirty(const Window *w) const; @@ -177,14 +177,14 @@ public: uint8 padding_left; ///< Paddings added to the left of the widget. Managed by parent container widget. protected: - inline void StoreSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height); + FORCEINLINE void StoreSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height); }; /** * Get the horizontal sizing step. * @param sizing Type of resize being performed. */ -inline uint NWidgetBase::GetHorizontalStepSize(SizingType sizing) const +FORCEINLINE uint NWidgetBase::GetHorizontalStepSize(SizingType sizing) const { return (sizing == ST_RESIZE) ? this->resize_x : this->fill_x; } @@ -193,11 +193,32 @@ inline uint NWidgetBase::GetHorizontalStepSize(SizingType sizing) const * Get the vertical sizing step. * @param sizing Type of resize being performed. */ -inline uint NWidgetBase::GetVerticalStepSize(SizingType sizing) const +FORCEINLINE uint NWidgetBase::GetVerticalStepSize(SizingType sizing) const { return (sizing == ST_RESIZE) ? this->resize_y : this->fill_y; } +/** + * Store size and position. + * @param sizing Type of resizing to perform. + * @param x Horizontal offset of the widget relative to the left edge of the window. + * @param y Vertical offset of the widget relative to the top edge of the window. + * @param given_width Width allocated to the widget. + * @param given_height Height allocated to the widget. + */ +FORCEINLINE void NWidgetBase::StoreSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height) +{ + this->pos_x = x; + this->pos_y = y; + if (sizing == ST_SMALLEST) { + this->smallest_x = given_width; + this->smallest_y = given_height; + } + this->current_x = given_width; + this->current_y = given_height; +} + + /** Base class for a resizable nested widget. * @ingroup NestedWidgets */ class NWidgetResizeBase : public NWidgetBase { |