diff options
author | alberth <alberth@openttd.org> | 2009-04-12 19:30:47 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2009-04-12 19:30:47 +0000 |
commit | eaa98482e4c4436d159f69290b0f637144508f9e (patch) | |
tree | 1853a65fd1c15345a1db81d8953538e161e5e41d /src | |
parent | 8a39da7618779fe41c1a578e1c40ee531ab8116f (diff) | |
download | openttd-eaa98482e4c4436d159f69290b0f637144508f9e.tar.xz |
(svn r16049) -Codechange: Added nested widgets to town windows.
Diffstat (limited to 'src')
-rw-r--r-- | src/town_gui.cpp | 114 |
1 files changed, 110 insertions, 4 deletions
diff --git a/src/town_gui.cpp b/src/town_gui.cpp index dabac7d36..5d2f1f4ec 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -54,6 +54,20 @@ static const Widget _town_authority_widgets[] = { { WIDGETS_END}, }; +static const NWidgetPart _nested_town_authority_widgets[] = { + NWidget(NWID_HORIZONTAL), + NWidget(WWT_CLOSEBOX, COLOUR_BROWN, TWA_CLOSEBOX), + NWidget(WWT_CAPTION, COLOUR_BROWN, TWA_CAPTION), SetDataTip(STR_2022_LOCAL_AUTHORITY, STR_018C_WINDOW_TITLE_DRAG_THIS), + EndContainer(), + NWidget(WWT_PANEL, COLOUR_BROWN, TWA_RATING_INFO), SetMinimalSize(317, 92), EndContainer(), + NWidget(NWID_HORIZONTAL), + NWidget(WWT_PANEL, COLOUR_BROWN, TWA_COMMAND_LIST), SetMinimalSize(305, 52), SetDataTip(0x0, STR_2043_LIST_OF_THINGS_TO_DO_AT), EndContainer(), + NWidget(WWT_SCROLLBAR, COLOUR_BROWN, TWA_SCROLLBAR), + EndContainer(), + NWidget(WWT_PANEL, COLOUR_BROWN, TWA_ACTION_INFO), SetMinimalSize(317, 52), EndContainer(), + NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, TWA_EXECUTE), SetMinimalSize(317, 12), SetDataTip(STR_2042_DO_IT, STR_2044_CARRY_OUT_THE_HIGHLIGHTED), +}; + extern const byte _town_action_costs[8]; struct TownAuthorityWindow : Window { @@ -210,7 +224,7 @@ static const WindowDesc _town_authority_desc( WDP_AUTO, WDP_AUTO, 317, 222, 317, 222, WC_TOWN_AUTHORITY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, - _town_authority_widgets + _town_authority_widgets, _nested_town_authority_widgets, lengthof(_nested_town_authority_widgets) ); static void ShowTownAuthorityWindow(uint town) @@ -443,11 +457,30 @@ static const Widget _town_view_widgets[] = { { WIDGETS_END}, }; +static const NWidgetPart _nested_town_view_widgets[] = { + NWidget(NWID_HORIZONTAL), + NWidget(WWT_CLOSEBOX, COLOUR_BROWN, TVW_CLOSEBOX), + NWidget(WWT_CAPTION, COLOUR_BROWN, TVW_CAPTION), SetDataTip(STR_2005, STR_018C_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, TVW_CHANGENAME), SetMinimalSize(76, 14), SetDataTip(STR_0130_RENAME, STR_200C_CHANGE_TOWN_NAME), + NWidget(WWT_STICKYBOX, COLOUR_BROWN, TVW_STICKY), + EndContainer(), + NWidget(WWT_PANEL, COLOUR_BROWN, TVW_VIEWPORTPANEL), + NWidget(WWT_INSET, COLOUR_BROWN, TVW_VIEWPORTINSET), SetMinimalSize(256, 88), SetPadding(2, 2, 2, 2), EndContainer(), + EndContainer(), + NWidget(WWT_PANEL, COLOUR_BROWN, TVW_INFOPANEL), SetMinimalSize(260, 32), EndContainer(), + NWidget(NWID_HORIZONTAL), + NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, TVW_CENTERVIEW), SetMinimalSize(86, 12), SetDataTip(STR_00E4_LOCATION, STR_200B_CENTER_THE_MAIN_VIEW_ON), + NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, TVW_SHOWAUTHORITY), SetMinimalSize(42, 12), SetDataTip(STR_2020_LOCAL_AUTHORITY, STR_2021_SHOW_INFORMATION_ON_LOCAL), + NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, TVW_EXPAND), SetMinimalSize(44, 12), SetDataTip(STR_023C_EXPAND, STR_023B_INCREASE_SIZE_OF_TOWN), + NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, TVW_DELETE), SetMinimalSize(88, 12), SetDataTip(STR_0290_DELETE, STR_0291_DELETE_THIS_TOWN_COMPLETELY), + EndContainer(), +}; + static const WindowDesc _town_view_desc( WDP_AUTO, WDP_AUTO, 260, TownViewWindow::TVW_HEIGHT_NORMAL, 260, TownViewWindow::TVW_HEIGHT_NORMAL, WC_TOWN_VIEW, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, - _town_view_widgets + _town_view_widgets, _nested_town_view_widgets, lengthof(_nested_town_view_widgets) ); void ShowTownViewWindow(TownID town) @@ -481,6 +514,28 @@ static const Widget _town_directory_widgets[] = { { WIDGETS_END}, }; +static const NWidgetPart _nested_town_directory_widgets[] = { + NWidget(NWID_HORIZONTAL), + NWidget(WWT_CLOSEBOX, COLOUR_BROWN, TDW_CLOSEBOX), + NWidget(WWT_CAPTION, COLOUR_BROWN, TDW_CAPTION), SetDataTip(STR_2000_TOWNS, STR_018C_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_STICKYBOX, COLOUR_BROWN, TDW_STICKYBOX), + EndContainer(), + NWidget(NWID_HORIZONTAL), + NWidget(NWID_VERTICAL), + NWidget(NWID_HORIZONTAL), + NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, TDW_SORTNAME), SetMinimalSize(99, 12), SetDataTip(STR_SORT_BY_NAME, STR_SORT_ORDER_TIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, TDW_SORTPOPULATION), SetMinimalSize(97, 12), SetDataTip(STR_SORT_BY_POPULATION, STR_SORT_ORDER_TIP), + EndContainer(), + NWidget(WWT_PANEL, COLOUR_BROWN, TDW_CENTERTOWN), SetMinimalSize(196, 164), SetDataTip(0x0, STR_200A_TOWN_NAMES_CLICK_ON_NAME), + SetResize(0, 10), EndContainer(), + EndContainer(), + NWidget(WWT_SCROLLBAR, COLOUR_BROWN, TDW_SCROLLBAR), + EndContainer(), + NWidget(NWID_HORIZONTAL), + NWidget(WWT_PANEL, COLOUR_BROWN, TDW_EMPTYBOTTOM), SetMinimalSize(196, 12), EndContainer(), + NWidget(WWT_RESIZEBOX, COLOUR_BROWN, TDW_RESIZEBOX), + EndContainer(), +}; struct TownDirectoryWindow : public Window { private: @@ -671,7 +726,7 @@ static const WindowDesc _town_directory_desc( WDP_AUTO, WDP_AUTO, 208, 202, 208, 202, WC_TOWN_DIRECTORY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, - _town_directory_widgets + _town_directory_widgets, _nested_town_directory_widgets, lengthof(_nested_town_directory_widgets) ); void ShowTownDirectory() @@ -738,6 +793,57 @@ static const Widget _found_town_widgets[] = { { WIDGETS_END}, }; +static const NWidgetPart _nested_found_town_widgets[] = { + NWidget(NWID_HORIZONTAL), + NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN, TSEW_CLOSEBOX), + NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, TSEW_CAPTION), SetDataTip(STR_0233_TOWN_GENERATION, STR_018C_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN, TSEW_STICKYBOX), + EndContainer(), + /* Construct new town(s) buttons. */ + NWidget(WWT_PANEL, COLOUR_DARK_GREEN, TSEW_BACKGROUND), + NWidget(NWID_SPACER), SetMinimalSize(0, 2), + NWidget(WWT_TEXTBTN, COLOUR_GREY, TSEW_NEWTOWN), SetMinimalSize(156, 12), SetDataTip(STR_0234_NEW_TOWN, STR_0235_CONSTRUCT_NEW_TOWN), SetPadding(0, 2, 1, 2), + NWidget(WWT_TEXTBTN, COLOUR_GREY, TSEW_RANDOMTOWN), SetMinimalSize(156, 12), + SetDataTip(STR_023D_RANDOM_TOWN, STR_023E_BUILD_TOWN_IN_RANDOM_LOCATION), SetPadding(0, 2, 1, 2), + NWidget(WWT_TEXTBTN, COLOUR_GREY, TSEW_MANYRANDOMTOWNS), SetMinimalSize(156, 12), SetDataTip(STR_MANY_RANDOM_TOWNS, STR_RANDOM_TOWNS_TIP), SetPadding(0, 2, 0, 2), + /* Town size selection. */ + NWidget(NWID_HORIZONTAL), + NWidget(WWT_LABEL, COLOUR_DARK_GREEN, TSEW_TOWNSIZE), SetMinimalSize(148, 14), SetDataTip(STR_02A5_TOWN_SIZE, STR_NULL), + NWidget(NWID_SPACER), SetFill(1, 0), + EndContainer(), + NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2), + NWidget(WWT_TEXTBTN, COLOUR_GREY, TSEW_SIZE_SMALL), SetMinimalSize(78, 12), SetDataTip(STR_02A1_SMALL, STR_02A4_SELECT_TOWN_SIZE), + NWidget(WWT_TEXTBTN, COLOUR_GREY, TSEW_SIZE_MEDIUM), SetMinimalSize(78, 12), SetDataTip(STR_02A2_MEDIUM, STR_02A4_SELECT_TOWN_SIZE), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0, 1), + NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2), + NWidget(WWT_TEXTBTN, COLOUR_GREY, TSEW_SIZE_LARGE), SetMinimalSize(78, 12), SetDataTip(STR_02A3_LARGE, STR_02A4_SELECT_TOWN_SIZE), + NWidget(WWT_TEXTBTN, COLOUR_GREY, TSEW_SIZE_RANDOM), SetMinimalSize(78, 12), SetDataTip(STR_SELECT_TOWN_SIZE_RANDOM, STR_02A4_SELECT_TOWN_SIZE), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0, 3), + NWidget(WWT_TEXTBTN, COLOUR_GREY, TSEW_CITY), SetPadding(0, 2, 0, 2), SetMinimalSize(156, 12), + SetDataTip(STR_FOUND_TOWN_CITY, STR_FOUND_TOWN_CITY_TOOLTIP), SetFill(1, 0), + /* Town roads selection. */ + NWidget(NWID_HORIZONTAL), + NWidget(WWT_LABEL, COLOUR_DARK_GREEN, TSEW_TOWNLAYOUT), SetMinimalSize(148, 14), SetDataTip(STR_TOWN_ROAD_LAYOUT, STR_NULL), + NWidget(NWID_SPACER), SetFill(1, 0), + EndContainer(), + NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2), + NWidget(WWT_TEXTBTN, COLOUR_GREY, TSEW_LAYOUT_ORIGINAL), SetMinimalSize(78, 12), SetDataTip(STR_SELECT_LAYOUT_ORIGINAL, STR_SELECT_TOWN_ROAD_LAYOUT), + NWidget(WWT_TEXTBTN, COLOUR_GREY, TSEW_LAYOUT_BETTER), SetMinimalSize(78, 12), SetDataTip(STR_SELECT_LAYOUT_BETTER_ROADS, STR_SELECT_TOWN_ROAD_LAYOUT), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0, 1), + NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2), + NWidget(WWT_TEXTBTN, COLOUR_GREY, TSEW_LAYOUT_GRID2), SetMinimalSize(78, 12), SetDataTip(STR_SELECT_LAYOUT_2X2_GRID, STR_SELECT_TOWN_ROAD_LAYOUT), + NWidget(WWT_TEXTBTN, COLOUR_GREY, TSEW_LAYOUT_GRID3), SetMinimalSize(78, 12), SetDataTip(STR_SELECT_LAYOUT_3X3_GRID, STR_SELECT_TOWN_ROAD_LAYOUT), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0, 1), + NWidget(WWT_TEXTBTN, COLOUR_GREY, TSEW_LAYOUT_RANDOM), SetPadding(0, 2, 0, 2), SetMinimalSize(0,12), + SetDataTip(STR_SELECT_LAYOUT_RANDOM, STR_SELECT_TOWN_ROAD_LAYOUT), SetFill(1, 0), + NWidget(NWID_SPACER), SetMinimalSize(0, 2), + EndContainer(), +}; + struct FoundTownWindow : Window { private: @@ -865,7 +971,7 @@ static const WindowDesc _found_town_desc( WDP_AUTO, WDP_AUTO, 160, 162, 160, 162, WC_FOUND_TOWN, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_CONSTRUCTION, - _found_town_widgets + _found_town_widgets, _nested_found_town_widgets, lengthof(_nested_found_town_widgets) ); void ShowBuildTownWindow() |