Changeset - r15866:97ecf119973d
[Not reviewed]
master
0 4 0
yexo - 14 years ago 2010-08-19 12:56:31
yexo@openttd.org
(svn r20558) -Codechange: use one generic function to create a list of company buttons
4 files changed with 69 insertions and 89 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_gui.cpp
Show inline comments
 
@@ -680,49 +680,49 @@ struct AIConfigWindow : public Window {
 
		this->SetWidgetDisabledState(AIC_WIDGET_INCREASE, _settings_newgame.difficulty.max_no_competitors == MAX_COMPANIES - 1);
 
		this->SetWidgetDisabledState(AIC_WIDGET_CHANGE, this->selected_slot == INVALID_COMPANY);
 
		this->SetWidgetDisabledState(AIC_WIDGET_CONFIGURE, this->selected_slot == INVALID_COMPANY);
 
		this->SetWidgetDisabledState(AIC_WIDGET_MOVE_UP, this->selected_slot == INVALID_COMPANY || this->selected_slot == 1);
 
		this->SetWidgetDisabledState(AIC_WIDGET_MOVE_DOWN, this->selected_slot == INVALID_COMPANY || this->selected_slot == _settings_newgame.difficulty.max_no_competitors);
 
	}
 
};
 

	
 
/** Open the AI config window. */
 
void ShowAIConfigWindow()
 
{
 
	DeleteWindowById(WC_GAME_OPTIONS, 0);
 
	new AIConfigWindow();
 
}
 

	
 
/** Enum referring to the widgets of the AI debug window */
 
enum AIDebugWindowWidgets {
 
	AID_WIDGET_VIEW,
 
	AID_WIDGET_NAME_TEXT,
 
	AID_WIDGET_SETTINGS,
 
	AID_WIDGET_RELOAD_TOGGLE,
 
	AID_WIDGET_LOG_PANEL,
 
	AID_WIDGET_SCROLLBAR,
 
	AID_WIDGET_COMPANY_BUTTON_START,
 
	AID_WIDGET_COMPANY_BUTTON_END = AID_WIDGET_COMPANY_BUTTON_START + 14,
 
	AID_WIDGET_COMPANY_BUTTON_END = AID_WIDGET_COMPANY_BUTTON_START + MAX_COMPANIES - 1,
 
	AID_BREAK_STRING_WIDGETS,
 
	AID_WIDGET_BREAK_STR_ON_OFF_BTN,
 
	AID_WIDGET_BREAK_STR_EDIT_BOX,
 
	AID_WIDGET_MATCH_CASE_BTN,
 
	AID_WIDGET_CONTINUE_BTN,
 
};
 

	
 
/**
 
 * Window with everything an AI prints via AILog.
 
 */
 
struct AIDebugWindow : public QueryStringBaseWindow {
 
	static const int top_offset;    ///< Offset of the text at the top of the ::AID_WIDGET_LOG_PANEL.
 
	static const int bottom_offset; ///< Offset of the text at the bottom of the ::AID_WIDGET_LOG_PANEL.
 

	
 
	static const unsigned int MAX_BREAK_STR_STRING_LENGTH = 256;
 

	
 
	static CompanyID ai_debug_company;                     ///< The AI that is (was last) being debugged.
 
	int redraw_timer;
 
	int last_vscroll_pos;
 
	bool autoscroll;
 
	bool show_break_box;
 
	static bool break_check_enabled;                       ///< Stop an AI when it prints a matching string
 
	static char break_string[MAX_BREAK_STR_STRING_LENGTH]; ///< The string to match to the AI output
 
	static bool case_sensitive_break_check;                ///< Is the matching done case-sensitive
 
@@ -1045,96 +1045,64 @@ struct AIDebugWindow : public QueryStrin
 
				this->EnableWidget(AID_WIDGET_CONTINUE_BTN);
 
				this->SetWidgetDirty(AID_WIDGET_CONTINUE_BTN);
 

	
 
				/* Highlight row that matched */
 
				this->highlight_row = log->pos;
 
			}
 

	
 
			cur_company.Restore();
 
		}
 
	}
 

	
 
	virtual void OnResize()
 
	{
 
		this->vscroll->SetCapacityFromWidget(this, AID_WIDGET_LOG_PANEL);
 
	}
 
};
 

	
 
const int AIDebugWindow::top_offset = WD_FRAMERECT_TOP + 2;
 
const int AIDebugWindow::bottom_offset = WD_FRAMERECT_BOTTOM;
 
CompanyID AIDebugWindow::ai_debug_company = INVALID_COMPANY;
 
char AIDebugWindow::break_string[MAX_BREAK_STR_STRING_LENGTH] = "";
 
bool AIDebugWindow::break_check_enabled = true;
 
bool AIDebugWindow::case_sensitive_break_check = false;
 

	
 
/** Make a number of rows with buttons for each company for the AI debug window. */
 
NWidgetBase *MakeCompanyButtonRowsAIDebug(int *biggest_index)
 
{
 
	return MakeCompanyButtonRows(biggest_index, AID_WIDGET_COMPANY_BUTTON_START, AID_WIDGET_COMPANY_BUTTON_END, 8, STR_AI_DEBUG_SELECT_AI_TOOLTIP);
 
}
 

	
 
/** Widgets for the AI debug window. */
 
static const NWidgetPart _nested_ai_debug_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_AI_DEBUG, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_SHADEBOX, COLOUR_GREY),
 
		NWidget(WWT_STICKYBOX, COLOUR_GREY),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_VIEW),
 
		NWidget(NWID_HORIZONTAL),
 
			NWidget(NWID_SPACER), SetMinimalSize(2, 0),
 
			NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
 
			EndContainer(),
 
			NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 1), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
 
			EndContainer(),
 
			NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 2), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
 
			EndContainer(),
 
			NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 3), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
 
			EndContainer(),
 
			NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 4), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
 
			EndContainer(),
 
			NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 5), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
 
			EndContainer(),
 
			NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 6), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
 
			EndContainer(),
 
			NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 7), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
 
			EndContainer(),
 
			NWidget(NWID_SPACER), SetMinimalSize(2, 0),
 
		EndContainer(),
 
		NWidget(NWID_HORIZONTAL),
 
			NWidget(NWID_SPACER), SetMinimalSize(2, 0),
 
			NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 8), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
 
			EndContainer(),
 
			NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 9), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
 
			EndContainer(),
 
			NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 10), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
 
			EndContainer(),
 
			NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 11), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
 
			EndContainer(),
 
			NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 12), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
 
			EndContainer(),
 
			NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 13), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
 
			EndContainer(),
 
			NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 14), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
 
			EndContainer(),
 
			NWidget(NWID_SPACER), SetMinimalSize(39, 0), SetResize(1, 0),
 
		EndContainer(),
 
		NWidget(NWID_SPACER), SetMinimalSize(0, 1), SetResize(1, 0),
 
		NWidgetFunction(MakeCompanyButtonRowsAIDebug), SetPadding(0, 2, 1, 2),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_TEXTBTN, COLOUR_GREY, AID_WIDGET_NAME_TEXT), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_JUST_STRING, STR_AI_DEBUG_NAME_TOOLTIP),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, AID_WIDGET_SETTINGS), SetMinimalSize(100, 20), SetDataTip(STR_AI_DEBUG_SETTINGS, STR_AI_DEBUG_SETTINGS_TOOLTIP),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, AID_WIDGET_RELOAD_TOGGLE), SetMinimalSize(100, 20), SetDataTip(STR_AI_DEBUG_RELOAD, STR_AI_DEBUG_RELOAD_TOOLTIP),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(NWID_VERTICAL),
 
			/* Log panel */
 
			NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_LOG_PANEL), SetMinimalSize(287, 180), SetResize(1, 1), SetScrollbar(AID_WIDGET_SCROLLBAR),
 
			EndContainer(),
 
			/* Break string widgets */
 
			NWidget(NWID_SELECTION, INVALID_COLOUR, AID_BREAK_STRING_WIDGETS),
 
				NWidget(NWID_HORIZONTAL),
 
					NWidget(WWT_IMGBTN_2, COLOUR_GREY, AID_WIDGET_BREAK_STR_ON_OFF_BTN), SetFill(0, 1), SetDataTip(SPR_FLAG_VEH_STOPPED, STR_AI_DEBUG_BREAK_STR_ON_OFF_TOOLTIP),
 
					NWidget(WWT_PANEL, COLOUR_GREY),
 
						NWidget(NWID_HORIZONTAL),
 
							NWidget(WWT_LABEL, COLOUR_GREY), SetPadding(2, 2, 2, 4), SetDataTip(STR_AI_DEBUG_BREAK_ON_LABEL, 0x0),
 
							NWidget(WWT_EDITBOX, COLOUR_WHITE, AID_WIDGET_BREAK_STR_EDIT_BOX), SetFill(1, 1), SetResize(1, 0), SetPadding(2, 2, 2, 2), SetDataTip(STR_AI_DEBUG_BREAK_STR_OSKTITLE, STR_AI_DEBUG_BREAK_STR_TOOLTIP),
 
						EndContainer(),
 
					EndContainer(),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, AID_WIDGET_MATCH_CASE_BTN), SetMinimalSize(100, 0), SetFill(0, 1), SetDataTip(STR_AI_DEBUG_MATCH_CASE, STR_AI_DEBUG_MATCH_CASE_TOOLTIP),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, AID_WIDGET_CONTINUE_BTN), SetMinimalSize(100, 0), SetFill(0, 1), SetDataTip(STR_AI_DEBUG_CONTINUE, STR_AI_DEBUG_CONTINUE_TOOLTIP),
 
				EndContainer(),
src/graph_gui.cpp
Show inline comments
 
@@ -1533,99 +1533,54 @@ static NWidgetBase *MakePerformanceDetai
 
		STR_PERFORMANCE_DETAIL_STATIONS_TOOLTIP,
 
		STR_PERFORMANCE_DETAIL_MIN_PROFIT_TOOLTIP,
 
		STR_PERFORMANCE_DETAIL_MIN_INCOME_TOOLTIP,
 
		STR_PERFORMANCE_DETAIL_MAX_INCOME_TOOLTIP,
 
		STR_PERFORMANCE_DETAIL_DELIVERED_TOOLTIP,
 
		STR_PERFORMANCE_DETAIL_CARGO_TOOLTIP,
 
		STR_PERFORMANCE_DETAIL_MONEY_TOOLTIP,
 
		STR_PERFORMANCE_DETAIL_LOAN_TOOLTIP,
 
		STR_PERFORMANCE_DETAIL_TOTAL_TOOLTIP,
 
	};
 

	
 
	assert_compile(lengthof(performance_tips) == SCORE_END - SCORE_BEGIN);
 

	
 
	NWidgetVertical *vert = new NWidgetVertical(NC_EQUALSIZE);
 
	for (int widnum = PRW_SCORE_FIRST; widnum <= PRW_SCORE_LAST; widnum++) {
 
		NWidgetBackground *panel = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, widnum);
 
		panel->SetFill(1, 1);
 
		panel->SetDataTip(0x0, performance_tips[widnum - PRW_SCORE_FIRST]);
 
		vert->Add(panel);
 
	}
 
	*biggest_index = PRW_SCORE_LAST;
 
	return vert;
 
}
 

	
 
/**
 
 * Make a number of rows with button-like graphics, for enabling/disabling each company.
 
 * @param biggest_index Storage for collecting the biggest index used in the returned tree.
 
 * @return Panel with rows of company buttons.
 
 * @post \c *biggest_index contains the largest used index in the tree.
 
 */
 
static NWidgetBase *MakeCompanyButtonRows(int *biggest_index)
 
/** Make a number of rows with buttons for each company for the performance rating detail window. */
 
NWidgetBase *MakeCompanyButtonRowsGraphGUI(int *biggest_index)
 
{
 
	static const int MAX_LENGTH = 8; // Maximal number of company buttons in one row.
 
	NWidgetVertical *vert = NULL; // Storage for all rows.
 
	NWidgetHorizontal *hor = NULL; // Storage for buttons in one row.
 
	int hor_length = 0;
 

	
 
	Dimension sprite_size = GetSpriteSize(SPR_COMPANY_ICON);
 
	sprite_size.width  += WD_MATRIX_LEFT + WD_MATRIX_RIGHT;
 
	sprite_size.height += WD_MATRIX_TOP + WD_MATRIX_BOTTOM + 1; // 1 for the 'offset' of being pressed
 

	
 
	for (int widnum = PRW_COMPANY_FIRST; widnum <= PRW_COMPANY_LAST; widnum++) {
 
		/* Ensure there is room in 'hor' for another button. */
 
		if (hor_length == MAX_LENGTH) {
 
			if (vert == NULL) vert = new NWidgetVertical();
 
			vert->Add(hor);
 
			hor = NULL;
 
			hor_length = 0;
 
		}
 
		if (hor == NULL) {
 
			hor = new NWidgetHorizontal();
 
			hor_length = 0;
 
		}
 

	
 
		NWidgetBackground *panel = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, widnum);
 
		panel->SetMinimalSize(sprite_size.width, sprite_size.height);
 
		panel->SetFill(1, 0);
 
		panel->SetDataTip(0x0, STR_PERFORMANCE_DETAIL_SELECT_COMPANY_TOOLTIP);
 
		hor->Add(panel);
 
		hor_length++;
 
	}
 
	*biggest_index = PRW_COMPANY_LAST;
 
	if (vert == NULL) return hor; // All buttons fit in a single row.
 

	
 
	if (hor_length > 0 && hor_length < MAX_LENGTH) {
 
		/* Last row is partial, add a spacer at the end to force all buttons to the left. */
 
		NWidgetSpacer *spc = new NWidgetSpacer(0, 0);
 
		spc->SetMinimalSize(sprite_size.width, sprite_size.height);
 
		spc->SetFill(1, 0);
 
		hor->Add(spc);
 
	}
 
	if (hor != NULL) vert->Add(hor);
 
	return vert;
 
	return MakeCompanyButtonRows(biggest_index, PRW_COMPANY_FIRST, PRW_COMPANY_LAST, 8, STR_PERFORMANCE_DETAIL_SELECT_COMPANY_TOOLTIP);
 
}
 

	
 
static const NWidgetPart _nested_performance_rating_detail_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_PERFORMANCE_DETAIL, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_SHADEBOX, COLOUR_GREY),
 
		NWidget(WWT_STICKYBOX, COLOUR_GREY),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY),
 
		NWidgetFunction(MakeCompanyButtonRows), SetPadding(0, 1, 1, 2),
 
		NWidgetFunction(MakeCompanyButtonRowsGraphGUI), SetPadding(0, 1, 1, 2),
 
	EndContainer(),
 
	NWidgetFunction(MakePerformanceDetailPanels),
 
};
 

	
 
static const WindowDesc _performance_rating_detail_desc(
 
	WDP_AUTO, 0, 0,
 
	WC_PERFORMANCE_DETAIL, WC_NONE,
 
	0,
 
	_nested_performance_rating_detail_widgets, lengthof(_nested_performance_rating_detail_widgets)
 
);
 

	
 
void ShowPerformanceRatingDetail()
 
{
 
	AllocateWindowDescFront<PerformanceRatingDetailWindow>(&_performance_rating_detail_desc, 0);
 
}
src/widget.cpp
Show inline comments
 
@@ -2383,24 +2383,79 @@ NWidgetContainer *MakeWindowNWidgetTree(
 
		return root;
 
	}
 

	
 
	/* If the first widget looks like a titlebar, treat it as such.
 
	 * If it has a shading box, silently add a shade selection widget in the tree. */
 
	NWidgetHorizontal *hor_cont = dynamic_cast<NWidgetHorizontal *>(nwid);
 
	NWidgetContainer *body;
 
	if (hor_cont != NULL && hor_cont->GetWidgetOfType(WWT_CAPTION) != NULL && hor_cont->GetWidgetOfType(WWT_SHADEBOX) != NULL) {
 
		*shade_select = new NWidgetStacked;
 
		root->Add(*shade_select);
 
		body = new NWidgetVertical;
 
		(*shade_select)->Add(body);
 
	} else {
 
		*shade_select = NULL;
 
		body = root;
 
	}
 

	
 
	/* Load the remaining parts into 'body'. */
 
	int biggest2 = -1;
 
	MakeNWidgets(parts, count, &biggest2, body);
 

	
 
	*biggest_index = max(*biggest_index, biggest2);
 
	return root;
 
}
 

	
 
/**
 
 * Make a number of rows with button-like graphics, for enabling/disabling each company.
 
 * @param biggest_index Storage for collecting the biggest index used in the returned tree.
 
 * @param widget_first The first widget index to use.
 
 * @param widget_last The last widget index to use.
 
 * @param max_length Maximal number of company buttons in one row.
 
 * @param button_tooltip The tooltip-string of every button.
 
 * @return Panel with rows of company buttons.
 
 * @post \c *biggest_index contains the largest used index in the tree.
 
 */
 
NWidgetBase *MakeCompanyButtonRows(int *biggest_index, int widget_first, int widget_last, int max_length, StringID button_tooltip)
 
{
 
	NWidgetVertical *vert = NULL; // Storage for all rows.
 
	NWidgetHorizontal *hor = NULL; // Storage for buttons in one row.
 
	int hor_length = 0;
 

	
 
	Dimension sprite_size = GetSpriteSize(SPR_COMPANY_ICON);
 
	sprite_size.width  += WD_MATRIX_LEFT + WD_MATRIX_RIGHT;
 
	sprite_size.height += WD_MATRIX_TOP + WD_MATRIX_BOTTOM + 1; // 1 for the 'offset' of being pressed
 

	
 
	for (int widnum = widget_first; widnum <= widget_last; widnum++) {
 
		/* Ensure there is room in 'hor' for another button. */
 
		if (hor_length == max_length) {
 
			if (vert == NULL) vert = new NWidgetVertical();
 
			vert->Add(hor);
 
			hor = NULL;
 
			hor_length = 0;
 
		}
 
		if (hor == NULL) {
 
			hor = new NWidgetHorizontal();
 
			hor_length = 0;
 
		}
 

	
 
		NWidgetBackground *panel = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, widnum);
 
		panel->SetMinimalSize(sprite_size.width, sprite_size.height);
 
		panel->SetFill(1, 0);
 
		panel->SetResize(1, 0);
 
		panel->SetDataTip(0x0, button_tooltip);
 
		hor->Add(panel);
 
		hor_length++;
 
	}
 
	*biggest_index = widget_last;
 
	if (vert == NULL) return hor; // All buttons fit in a single row.
 

	
 
	if (hor_length > 0 && hor_length < max_length) {
 
		/* Last row is partial, add a spacer at the end to force all buttons to the left. */
 
		NWidgetSpacer *spc = new NWidgetSpacer(sprite_size.width, sprite_size.height);
 
		spc->SetFill(1, 0);
 
		spc->SetResize(1, 0);
 
		hor->Add(spc);
 
	}
 
	if (hor != NULL) vert->Add(hor);
 
	return vert;
 
}
src/widget_type.h
Show inline comments
 
@@ -1001,25 +1001,27 @@ static inline NWidgetPart NWidget(Widget
 
	part.type = tp;
 
	part.u.cont_flags = cont_flags;
 

	
 
	return part;
 
}
 

	
 
/**
 
 * Obtain a nested widget (sub)tree from an external source.
 
 * @param func_ptr Pointer to function that returns the tree.
 
 * @ingroup NestedWidgetParts
 
 */
 
static inline NWidgetPart NWidgetFunction(NWidgetFunctionType *func_ptr)
 
{
 
	NWidgetPart part;
 

	
 
	part.type = WPT_FUNCTION;
 
	part.u.func_ptr = func_ptr;
 

	
 
	return part;
 
}
 

	
 
NWidgetContainer *MakeNWidgets(const NWidgetPart *parts, int count, int *biggest_index, NWidgetContainer *container);
 
NWidgetContainer *MakeWindowNWidgetTree(const NWidgetPart *parts, int count, int *biggest_index, NWidgetStacked **shade_select);
 

	
 
NWidgetBase *MakeCompanyButtonRows(int *biggest_index, int widget_first, int widget_last, int max_length, StringID button_tooltip);
 

	
 
#endif /* WIDGET_TYPE_H */
0 comments (0 inline, 0 general)