Changeset - r12573:f61cf1e30c17
[Not reviewed]
master
0 2 0
alberth - 15 years ago 2009-08-01 15:45:18
alberth@openttd.org
(svn r17023) -Revert (r16839): FillNestedArray() was less obsolete than anticipated.
2 files changed with 34 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/widget.cpp
Show inline comments
 
@@ -920,6 +920,13 @@ NWidgetBase::NWidgetBase(WidgetType tp) 
 
 */
 

	
 
/**
 
 * @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.
 
 * @param x              Horizontal offset of the widget relative to the left edge of the window.
 
@@ -1080,6 +1087,11 @@ void NWidgetCore::SetDataTip(uint16 widg
 
	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 *
 
	}
 
}
 

	
 
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(Wi
 
	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(Wid
 
	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;
src/widget_type.h
Show inline comments
 
@@ -181,6 +181,7 @@ public:
 
	virtual void AssignSizePosition(SizingType sizing, 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;
 
	virtual void FillNestedArray(NWidgetCore **array, uint length) = 0;
 

	
 
	virtual NWidgetCore *GetWidgetFromPos(int x, int y) = 0;
 
	virtual NWidgetBase *GetWidgetOfType(WidgetType tp);
 
@@ -296,6 +297,7 @@ public:
 
	inline bool IsDisabled();
 

	
 
	void StoreWidgets(Widget *widgets, int length, bool left_moving, bool top_moving, bool rtl);
 
	/* virtual */ void FillNestedArray(NWidgetCore **array, uint length);
 
	/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y);
 

	
 
	virtual Scrollbar *FindScrollbar(Window *w, bool allow_next = true) = 0;
 
@@ -346,6 +348,7 @@ public:
 
	~NWidgetContainer();
 

	
 
	void Add(NWidgetBase *wid);
 
	/* virtual */ void FillNestedArray(NWidgetCore **array, uint length);
 

	
 
	/** Return whether the container is empty. */
 
	inline bool IsEmpty() { return head == NULL; };
 
@@ -442,6 +445,7 @@ public:
 

	
 
	void SetupSmallestSize(Window *w, bool init_array);
 
	void StoreWidgets(Widget *widgets, int length, bool left_moving, bool top_moving, bool rtl);
 
	/* virtual */ void FillNestedArray(NWidgetCore **array, uint length);
 

	
 
	/* virtual */ void Draw(const Window *w);
 
	/* virtual */ void Invalidate(const Window *w) const;
 
@@ -462,6 +466,7 @@ public:
 
	void AssignSizePosition(SizingType sizing, 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);
 
	/* virtual */ void FillNestedArray(NWidgetCore **array, uint length);
 

	
 
	/* virtual */ void Draw(const Window *w);
 
	/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y);
0 comments (0 inline, 0 general)