summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/widget.cpp52
-rw-r--r--src/widget_type.h30
2 files changed, 41 insertions, 41 deletions
diff --git a/src/widget.cpp b/src/widget.cpp
index be97ae50b..6aff0679e 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -686,7 +686,7 @@ NWidgetBase::NWidgetBase(WidgetType tp) : ZeroedMemoryAllocator()
/* ~NWidgetContainer() takes care of #next and #prev data members. */
/**
- * @fn int NWidgetBase::ComputeMinimalSize()
+ * @fn int NWidgetBase::SetupSmallestSize()
* @brief Compute smallest size needed by the widget.
*
* The smallest size of a widget is the smallest size that a widget needs to
@@ -698,8 +698,8 @@ NWidgetBase::NWidgetBase(WidgetType tp) : ZeroedMemoryAllocator()
*/
/**
- * @fn void NWidgetBase::AssignMinimalPosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl)
- * @brief Assign minimal size and position to the widget.
+ * @fn void NWidgetBase::AssignSizePosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl)
+ * @brief Assign size and position to the widget.
* @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.
@@ -767,7 +767,7 @@ void NWidgetResizeBase::SetResize(uint resize_x, uint resize_y)
this->resize_y = resize_y;
}
-void NWidgetResizeBase::AssignMinimalPosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl)
+void NWidgetResizeBase::AssignSizePosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl)
{
this->pos_x = x;
this->pos_y = y;
@@ -815,7 +815,7 @@ void NWidgetCore::SetDataTip(uint16 widget_data, StringID tool_tip)
this->tool_tip = tool_tip;
}
-int NWidgetCore::ComputeMinimalSize()
+int NWidgetCore::SetupSmallestSize()
{
this->smallest_x = this->min_x;
this->smallest_y = this->min_y;
@@ -906,7 +906,7 @@ NWidgetStacked::NWidgetStacked(WidgetType tp) : NWidgetContainer(tp)
{
}
-int NWidgetStacked::ComputeMinimalSize()
+int NWidgetStacked::SetupSmallestSize()
{
/* First sweep, recurse down and compute minimal size and filling. */
int biggest_index = -1;
@@ -917,7 +917,7 @@ int NWidgetStacked::ComputeMinimalSize()
this->resize_x = (this->head != NULL) ? 1 : 0;
this->resize_y = (this->head != NULL) ? 1 : 0;
for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) {
- int idx = child_wid->ComputeMinimalSize();
+ int idx = child_wid->SetupSmallestSize();
biggest_index = max(biggest_index, idx);
this->smallest_x = max(this->smallest_x, child_wid->smallest_x + child_wid->padding_left + child_wid->padding_right);
@@ -930,7 +930,7 @@ int NWidgetStacked::ComputeMinimalSize()
return biggest_index;
}
-void NWidgetStacked::AssignMinimalPosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl)
+void NWidgetStacked::AssignSizePosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl)
{
assert(given_width >= this->smallest_x && given_height >= this->smallest_y);
@@ -963,7 +963,7 @@ void NWidgetStacked::AssignMinimalPosition(uint x, uint y, uint given_width, uin
child_height = child_wid->smallest_y;
child_pos_y = (given_height - child_wid->padding_top - child_wid->padding_bottom - child_height) / 2;
}
- child_wid->AssignMinimalPosition(x + child_pos_x, y + child_pos_y, child_width, child_height, (this->resize_x > 0), (this->resize_y > 0), rtl);
+ child_wid->AssignSizePosition(x + child_pos_x, y + child_pos_y, child_width, child_height, (this->resize_x > 0), (this->resize_y > 0), rtl);
}
}
@@ -999,7 +999,7 @@ NWidgetHorizontal::NWidgetHorizontal() : NWidgetPIPContainer(NWID_HORIZONTAL)
{
}
-int NWidgetHorizontal::ComputeMinimalSize()
+int NWidgetHorizontal::SetupSmallestSize()
{
int biggest_index = -1;
this->smallest_x = 0; // Sum of minimal size of all childs.
@@ -1011,7 +1011,7 @@ int NWidgetHorizontal::ComputeMinimalSize()
if (this->head != NULL) this->head->padding_left += this->pip_pre;
for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) {
- int idx = child_wid->ComputeMinimalSize();
+ int idx = child_wid->SetupSmallestSize();
biggest_index = max(biggest_index, idx);
if (child_wid->next != NULL) {
@@ -1036,7 +1036,7 @@ int NWidgetHorizontal::ComputeMinimalSize()
return biggest_index;
}
-void NWidgetHorizontal::AssignMinimalPosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl)
+void NWidgetHorizontal::AssignSizePosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl)
{
assert(given_width >= this->smallest_x && given_height >= this->smallest_y);
@@ -1084,7 +1084,7 @@ void NWidgetHorizontal::AssignMinimalPosition(uint x, uint y, uint given_width,
child_width += increment;
}
- child_wid->AssignMinimalPosition(x + position + (rtl ? child_wid->padding_right : child_wid->padding_left), y + child_pos_y, child_width, child_height, allow_resize_x, (this->resize_y > 0), rtl);
+ child_wid->AssignSizePosition(x + position + (rtl ? child_wid->padding_right : child_wid->padding_left), y + child_pos_y, child_width, child_height, allow_resize_x, (this->resize_y > 0), rtl);
position += child_width + child_wid->padding_right + child_wid->padding_left;
if (child_wid->resize_x > 0) allow_resize_x = false; // Widget array allows only one child resizing
@@ -1109,9 +1109,9 @@ NWidgetHorizontalLTR::NWidgetHorizontalLTR() : NWidgetHorizontal()
this->type = NWID_HORIZONTAL_LTR;
}
-void NWidgetHorizontalLTR::AssignMinimalPosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl)
+void NWidgetHorizontalLTR::AssignSizePosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl)
{
- NWidgetHorizontal::AssignMinimalPosition(x, y, given_width, given_height, allow_resize_x, allow_resize_y, false);
+ NWidgetHorizontal::AssignSizePosition(x, y, given_width, given_height, allow_resize_x, allow_resize_y, false);
}
void NWidgetHorizontalLTR::StoreWidgets(Widget *widgets, int length, bool left_moving, bool top_moving, bool rtl)
@@ -1124,7 +1124,7 @@ NWidgetVertical::NWidgetVertical() : NWidgetPIPContainer(NWID_VERTICAL)
{
}
-int NWidgetVertical::ComputeMinimalSize()
+int NWidgetVertical::SetupSmallestSize()
{
int biggest_index = -1;
this->smallest_x = 0; // Biggest child.
@@ -1136,7 +1136,7 @@ int NWidgetVertical::ComputeMinimalSize()
if (this->head != NULL) this->head->padding_top += this->pip_pre;
for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) {
- int idx = child_wid->ComputeMinimalSize();
+ int idx = child_wid->SetupSmallestSize();
biggest_index = max(biggest_index, idx);
if (child_wid->next != NULL) {
@@ -1161,7 +1161,7 @@ int NWidgetVertical::ComputeMinimalSize()
return biggest_index;
}
-void NWidgetVertical::AssignMinimalPosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl)
+void NWidgetVertical::AssignSizePosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl)
{
assert(given_width >= this->smallest_x && given_height >= this->smallest_y);
@@ -1207,7 +1207,7 @@ void NWidgetVertical::AssignMinimalPosition(uint x, uint y, uint given_width, ui
child_height += increment;
}
- child_wid->AssignMinimalPosition(x + child_pos_x, y + position + child_wid->padding_top, child_width, child_height, (this->resize_x > 0), allow_resize_y, rtl);
+ child_wid->AssignSizePosition(x + child_pos_x, y + position + child_wid->padding_top, child_width, child_height, (this->resize_x > 0), allow_resize_y, rtl);
position += child_height + child_wid->padding_top + child_wid->padding_bottom;
if (child_wid->resize_y > 0) allow_resize_y = false; // Widget array allows only one child resizing
}
@@ -1232,7 +1232,7 @@ NWidgetSpacer::NWidgetSpacer(int length, int height) : NWidgetResizeBase(NWID_SP
this->SetResize(0, 0);
}
-int NWidgetSpacer::ComputeMinimalSize()
+int NWidgetSpacer::SetupSmallestSize()
{
this->smallest_x = this->min_x;
this->smallest_y = this->min_y;
@@ -1299,11 +1299,11 @@ void NWidgetBackground::SetPIP(uint8 pip_pre, uint8 pip_inter, uint8 pip_post)
this->child->SetPIP(pip_pre, pip_inter, pip_post);
}
-int NWidgetBackground::ComputeMinimalSize()
+int NWidgetBackground::SetupSmallestSize()
{
int biggest_index = this->index;
if (this->child != NULL) {
- int idx = this->child->ComputeMinimalSize();
+ int idx = this->child->SetupSmallestSize();
biggest_index = max(biggest_index, idx);
this->smallest_x = this->child->smallest_x;
@@ -1320,7 +1320,7 @@ int NWidgetBackground::ComputeMinimalSize()
return biggest_index;
}
-void NWidgetBackground::AssignMinimalPosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl)
+void NWidgetBackground::AssignSizePosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl)
{
this->pos_x = x;
this->pos_y = y;
@@ -1333,7 +1333,7 @@ void NWidgetBackground::AssignMinimalPosition(uint x, uint y, uint given_width,
uint x_offset = (rtl ? this->child->padding_right : this->child->padding_left);
uint width = given_width - this->child->padding_right - this->child->padding_left;
uint height = given_height - this->child->padding_top - this->child->padding_bottom;
- this->child->AssignMinimalPosition(x + x_offset, y + this->child->padding_top, width, height, (this->resize_x > 0), (this->resize_y > 0), rtl);
+ this->child->AssignSizePosition(x + x_offset, y + this->child->padding_top, width, height, (this->resize_x > 0), (this->resize_y > 0), rtl);
}
}
@@ -1442,8 +1442,8 @@ NWidgetLeaf::NWidgetLeaf(WidgetType tp, Colours colour, int index, uint16 data,
Widget *InitializeNWidgets(NWidgetBase *nwid, bool rtl)
{
/* Initialize nested widgets. */
- int biggest_index = nwid->ComputeMinimalSize();
- nwid->AssignMinimalPosition(0, 0, nwid->smallest_x, nwid->smallest_y, (nwid->resize_x > 0), (nwid->resize_y > 0), rtl);
+ int biggest_index = nwid->SetupSmallestSize();
+ nwid->AssignSizePosition(0, 0, nwid->smallest_x, nwid->smallest_y, (nwid->resize_x > 0), (nwid->resize_y > 0), rtl);
/* Construct a local widget array and initialize all its types to #WWT_LAST. */
Widget *widgets = MallocT<Widget>(biggest_index + 2);
diff --git a/src/widget_type.h b/src/widget_type.h
index e4298fcfb..4b49741bb 100644
--- a/src/widget_type.h
+++ b/src/widget_type.h
@@ -152,8 +152,8 @@ class NWidgetBase : public ZeroedMemoryAllocator {
public:
NWidgetBase(WidgetType tp);
- virtual int ComputeMinimalSize() = 0;
- virtual void AssignMinimalPosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl) = 0;
+ virtual int SetupSmallestSize() = 0;
+ virtual void AssignSizePosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl) = 0;
virtual void StoreWidgets(Widget *widgets, int length, bool left_moving, bool top_moving, bool rtl) = 0;
@@ -178,7 +178,7 @@ public:
uint resize_x; ///< Horizontal resize step (\c 0 means not resizable).
uint resize_y; ///< Vertical resize step (\c 0 means not resizable).
/* Size of the widget in the smallest window possible.
- * Computed by #ComputeMinimalSize() followed by #AssignMinimalPosition().
+ * Computed by #SetupSmallestSize() followed by #AssignSizePosition().
*/
uint smallest_x; ///< Smallest horizontal size of the widget in a filled window.
uint smallest_y; ///< Smallest vertical size of the widget in a filled window.
@@ -205,7 +205,7 @@ public:
void SetFill(bool fill_x, bool fill_y);
void SetResize(uint resize_x, uint resize_y);
- void AssignMinimalPosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl);
+ void AssignSizePosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl);
uint min_x; ///< Minimal horizontal size of only this widget.
uint min_y; ///< Minimal vertical size of only this widget.
@@ -220,7 +220,7 @@ public:
void SetIndex(int index);
void SetDataTip(uint16 widget_data, StringID tool_tip);
- int ComputeMinimalSize();
+ int SetupSmallestSize();
void StoreWidgets(Widget *widgets, int length, bool left_moving, bool top_moving, bool rtl);
Colours colour; ///< Colour of this widget.
@@ -253,8 +253,8 @@ class NWidgetStacked : public NWidgetContainer {
public:
NWidgetStacked(WidgetType tp);
- int ComputeMinimalSize();
- void AssignMinimalPosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl);
+ int SetupSmallestSize();
+ void AssignSizePosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl);
void StoreWidgets(Widget *widgets, int length, bool left_moving, bool top_moving, bool rtl);
};
@@ -277,8 +277,8 @@ class NWidgetHorizontal : public NWidgetPIPContainer {
public:
NWidgetHorizontal();
- int ComputeMinimalSize();
- void AssignMinimalPosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl);
+ int SetupSmallestSize();
+ void AssignSizePosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl);
void StoreWidgets(Widget *widgets, int length, bool left_moving, bool top_moving, bool rtl);
};
@@ -289,7 +289,7 @@ class NWidgetHorizontalLTR : public NWidgetHorizontal {
public:
NWidgetHorizontalLTR();
- void AssignMinimalPosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl);
+ void AssignSizePosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl);
void StoreWidgets(Widget *widgets, int length, bool left_moving, bool top_moving, bool rtl);
};
@@ -300,8 +300,8 @@ class NWidgetVertical : public NWidgetPIPContainer {
public:
NWidgetVertical();
- int ComputeMinimalSize();
- void AssignMinimalPosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl);
+ int SetupSmallestSize();
+ void AssignSizePosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl);
void StoreWidgets(Widget *widgets, int length, bool left_moving, bool top_moving, bool rtl);
};
@@ -313,7 +313,7 @@ class NWidgetSpacer : public NWidgetResizeBase {
public:
NWidgetSpacer(int length, int height);
- int ComputeMinimalSize();
+ int SetupSmallestSize();
void StoreWidgets(Widget *widgets, int length, bool left_moving, bool top_moving, bool rtl);
};
@@ -327,8 +327,8 @@ public:
void Add(NWidgetBase *nwid);
void SetPIP(uint8 pip_pre, uint8 pip_inter, uint8 pip_post);
- int ComputeMinimalSize();
- void AssignMinimalPosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl);
+ int SetupSmallestSize();
+ void AssignSizePosition(uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl);
void StoreWidgets(Widget *widgets, int length, bool left_moving, bool top_moving, bool rtl);
private: