forked from mirror/OpenTTD
(svn r19844) -Fix: Move NWidgetBase::StoreSizePosition() to an include file, and use proper inline macro.
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user