summaryrefslogtreecommitdiff
path: root/src/widget_type.h
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-05-21 18:12:28 +0000
committeralberth <alberth@openttd.org>2009-05-21 18:12:28 +0000
commitc497e9e7edb2a891544450280e326c31a964d1a9 (patch)
treef9b3c651db91ea877eae6f0ab9effa8a4e38dbca /src/widget_type.h
parent1122d625ae84584103ab124246b321f531b4da3c (diff)
downloadopenttd-c497e9e7edb2a891544450280e326c31a964d1a9.tar.xz
(svn r16372) -Codechange: Simplify size calculations with a few helper functions.
Diffstat (limited to 'src/widget_type.h')
-rw-r--r--src/widget_type.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/widget_type.h b/src/widget_type.h
index 4b49741bb..888d9052d 100644
--- a/src/widget_type.h
+++ b/src/widget_type.h
@@ -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 {