(svn r16372) -Codechange: Simplify size calculations with a few helper functions.

This commit is contained in:
alberth
2009-05-21 18:12:28 +00:00
parent 1122d625ae
commit c497e9e7ed
2 changed files with 72 additions and 49 deletions

View File

@@ -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 {