(svn r17023) -Revert (r16839): FillNestedArray() was less obsolete than anticipated.

This commit is contained in:
alberth
2009-08-01 15:45:18 +00:00
parent 9e682bb2f7
commit 47075fdbca
2 changed files with 34 additions and 0 deletions

View File

@@ -919,6 +919,13 @@ NWidgetBase::NWidgetBase(WidgetType tp) : ZeroedMemoryAllocator()
* the smallest size such that all widgets of the window are consistent, and \e current_x and \e current_y contain the current size.
*/
/**
* @fn void FillNestedArray(NWidgetCore **array, uint length)
* Fill the Window::nested_array array with pointers to nested widgets in the tree.
* @param array Base pointer of the array.
* @param length Length of the array.
*/
/**
* Store size and position.
* @param sizing Type of resizing to perform.
@@ -1080,6 +1087,11 @@ void NWidgetCore::SetDataTip(uint16 widget_data, StringID tool_tip)
this->tool_tip = tool_tip;
}
void NWidgetCore::FillNestedArray(NWidgetCore **array, uint length)
{
if (this->index >= 0 && (uint)(this->index) < length) array[this->index] = this;
}
void NWidgetCore::StoreWidgets(Widget *widgets, int length, bool left_moving, bool top_moving, bool rtl)
{
if (this->index < 0) return;
@@ -1182,6 +1194,13 @@ void NWidgetContainer::Add(NWidgetBase *wid)
}
}
void NWidgetContainer::FillNestedArray(NWidgetCore **array, uint length)
{
for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) {
child_wid->FillNestedArray(array, length);
}
}
/**
* Return the biggest possible size of a nested widget.
* @param base Base size of the widget.
@@ -1604,6 +1623,10 @@ void NWidgetSpacer::SetupSmallestSize(Window *w, bool init_array)
this->smallest_y = this->min_y;
}
void NWidgetSpacer::FillNestedArray(NWidgetCore **array, uint length)
{
}
void NWidgetSpacer::StoreWidgets(Widget *widgets, int length, bool left_moving, bool top_moving, bool rtl)
{
/* Spacer widgets are never stored in the widget array. */
@@ -1732,6 +1755,12 @@ void NWidgetBackground::StoreWidgets(Widget *widgets, int length, bool left_movi
if (this->child != NULL) this->child->StoreWidgets(widgets, length, left_moving, top_moving, rtl);
}
void NWidgetBackground::FillNestedArray(NWidgetCore **array, uint length)
{
if (this->index >= 0 && (uint)(this->index) < length) array[this->index] = this;
if (this->child != NULL) this->child->FillNestedArray(array, length);
}
void NWidgetBackground::Draw(const Window *w)
{
if (this->current_x == 0 || this->current_y == 0) return;