diff options
author | alberth <alberth@openttd.org> | 2009-03-22 21:16:57 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2009-03-22 21:16:57 +0000 |
commit | 6567a29e182d6de528bbfc57258ec38c03a0385f (patch) | |
tree | 640eeab947c2dadf2731d1cf3d96388d4b4c36c1 | |
parent | 12a31f3d5c47253174684de70d2297543a69838d (diff) | |
download | openttd-6567a29e182d6de528bbfc57258ec38c03a0385f.tar.xz |
(svn r15820) -Codechange: Some windows using nested widgets
-rw-r--r-- | src/airport_gui.cpp | 162 | ||||
-rw-r--r-- | src/bridge_gui.cpp | 23 | ||||
-rw-r--r-- | src/build_vehicle_gui.cpp | 26 | ||||
-rw-r--r-- | src/cheat_gui.cpp | 10 | ||||
-rw-r--r-- | src/group_gui.cpp | 51 | ||||
-rw-r--r-- | src/intro_gui.cpp | 157 | ||||
-rw-r--r-- | src/network/network_gui.cpp | 126 | ||||
-rw-r--r-- | src/news_gui.cpp | 45 | ||||
-rw-r--r-- | src/vehicle_gui.cpp | 42 |
9 files changed, 575 insertions, 67 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index c4fc7f218..651b79f06 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -137,12 +137,23 @@ static const Widget _air_toolbar_widgets[] = { { WIDGETS_END}, }; +static const NWidgetPart _nested_air_toolbar_widgets[] = { + NWidget(NWID_HORIZONTAL), + NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN, 0), + NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, 1), SetMinimalSize(41, 14), SetDataTip(STR_A000_AIRPORTS, STR_018C_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN, 2), + EndContainer(), + NWidget(NWID_HORIZONTAL), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, 3), SetMinimalSize(42, 22), SetDataTip(SPR_IMG_AIRPORT, STR_A01E_BUILD_AIRPORT), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, 4), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_018D_DEMOLISH_BUILDINGS_ETC), + EndContainer(), +}; static const WindowDesc _air_toolbar_desc( WDP_ALIGN_TBR, 22, 64, 36, 64, 36, WC_BUILD_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_CONSTRUCTION, - _air_toolbar_widgets + _air_toolbar_widgets, _nested_air_toolbar_widgets, lengthof(_nested_air_toolbar_widgets) ); void ShowBuildAirToolbar() @@ -153,42 +164,41 @@ void ShowBuildAirToolbar() AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR); } -class AirportPickerWindow : public PickerWindowBase { - - enum { - BAW_CLOSEBOX, - BAW_CAPTION, - /* Panels and labels. */ - BAW_SMALL_AIRPORTS_PANEL, - BAW_SMALL_AIRPORTS_LABEL, - BAW_LARGE_AIRPORTS_PANEL, - BAW_LARGE_AIRPORTS_LABEL, - BAW_HUB_AIRPORTS_PANEL, - BAW_HUB_AIRPORTS_LABEL, - BAW_HELIPORTS_PANEL, - BAW_HELIPORTS_LABEL, - BAW_BOTTOMPANEL, - /* Airport selection buttons. */ - BAW_SMALL_AIRPORT, - BAW_CITY_AIRPORT, - BAW_HELIPORT, - BAW_METRO_AIRPORT, - BAW_INTERNATIONAL_AIRPORT, - BAW_COMMUTER_AIRPORT, - BAW_HELIDEPOT, - BAW_INTERCONTINENTAL_AIRPORT, - BAW_HELISTATION, - /* Coverage. */ - BAW_BTN_DONTHILIGHT, - BAW_BTN_DOHILIGHT, - BAW_COVERAGE_LABEL, - - BAW_LAST_AIRPORT = BAW_HELISTATION, - BAW_AIRPORT_COUNT = BAW_LAST_AIRPORT - BAW_SMALL_AIRPORT + 1, - }; +/** Airport widgets in the airport picker window. */ +enum AirportPickerWidgets { + BAW_CLOSEBOX, + BAW_CAPTION, + /* Panels and labels. */ + BAW_SMALL_AIRPORTS_PANEL, + BAW_SMALL_AIRPORTS_LABEL, + BAW_LARGE_AIRPORTS_PANEL, + BAW_LARGE_AIRPORTS_LABEL, + BAW_HUB_AIRPORTS_PANEL, + BAW_HUB_AIRPORTS_LABEL, + BAW_HELIPORTS_PANEL, + BAW_HELIPORTS_LABEL, + BAW_BOTTOMPANEL, + /* Airport selection buttons. */ + BAW_SMALL_AIRPORT, + BAW_CITY_AIRPORT, + BAW_HELIPORT, + BAW_METRO_AIRPORT, + BAW_INTERNATIONAL_AIRPORT, + BAW_COMMUTER_AIRPORT, + BAW_HELIDEPOT, + BAW_INTERCONTINENTAL_AIRPORT, + BAW_HELISTATION, + /* Coverage. */ + BAW_BTN_DONTHILIGHT, + BAW_BTN_DOHILIGHT, + BAW_COVERAGE_LABEL, + + BAW_LAST_AIRPORT = BAW_HELISTATION, + BAW_AIRPORT_COUNT = BAW_LAST_AIRPORT - BAW_SMALL_AIRPORT + 1, +}; +class AirportPickerWindow : public PickerWindowBase { public: - AirportPickerWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent) { this->SetWidgetLoweredState(BAW_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage); @@ -314,11 +324,91 @@ static const Widget _build_airport_picker_widgets[] = { { WIDGETS_END}, }; +static const NWidgetPart _nested_build_airport_widgets[] = { + NWidget(NWID_HORIZONTAL), + NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN, BAW_CLOSEBOX), + NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, BAW_CAPTION), SetMinimalSize(137, 14), SetDataTip(STR_3001_AIRPORT_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS), + EndContainer(), + /* Small airports. */ + NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BAW_SMALL_AIRPORTS_PANEL), + NWidget(WWT_LABEL, COLOUR_DARK_GREEN, BAW_SMALL_AIRPORTS_LABEL), SetMinimalSize(148, 14), SetDataTip(STR_SMALL_AIRPORTS, STR_NULL), + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(1, 0), + NWidget(NWID_VERTICAL), + NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_SMALL_AIRPORT), SetMinimalSize(144, 12), + SetDataTip(STR_SMALL_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT), + NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_COMMUTER_AIRPORT), SetMinimalSize(144, 12), + SetDataTip(STR_COMMUTER_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT), + NWidget(NWID_SPACER), SetMinimalSize(0, 1), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(1, 0), + EndContainer(), + EndContainer(), + /* Large airports. */ + NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BAW_LARGE_AIRPORTS_PANEL), + NWidget(WWT_LABEL, COLOUR_DARK_GREEN, BAW_LARGE_AIRPORTS_LABEL), SetMinimalSize(148, 14), SetDataTip(STR_LARGE_AIRPORTS, STR_NULL), + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(1, 0), + NWidget(NWID_VERTICAL), + NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_CITY_AIRPORT), SetMinimalSize(144, 12), + SetDataTip(STR_CITY_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT), + NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_METRO_AIRPORT), SetMinimalSize(144, 12), + SetDataTip(STR_METRO_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT), + NWidget(NWID_SPACER), SetMinimalSize(0, 1), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(1, 0), + EndContainer(), + EndContainer(), + /* Hub airports. */ + NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BAW_HUB_AIRPORTS_PANEL), + NWidget(WWT_LABEL, COLOUR_DARK_GREEN, BAW_HUB_AIRPORTS_LABEL), SetMinimalSize(148, 14), SetDataTip(STR_HUB_AIRPORTS, STR_NULL), + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(2, 0), + NWidget(NWID_VERTICAL), + NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_INTERNATIONAL_AIRPORT), SetMinimalSize(144, 12), + SetDataTip(STR_INTERNATIONAL_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT), + NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_INTERCONTINENTAL_AIRPORT), SetMinimalSize(144, 12), + SetDataTip(STR_INTERCONTINENTAL_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT), + NWidget(NWID_SPACER), SetMinimalSize(0, 1), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(2, 0), + EndContainer(), + EndContainer(), + /* Heliports. */ + NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BAW_HELIPORTS_PANEL), + NWidget(WWT_LABEL, COLOUR_DARK_GREEN, BAW_HELIPORTS_LABEL), SetMinimalSize(148, 14), SetDataTip(STR_HELIPORTS, STR_NULL), + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(2, 0), + NWidget(NWID_VERTICAL), + NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_HELIPORT), SetMinimalSize(144, 12), + SetDataTip(STR_HELIPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT), + NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_HELISTATION), SetMinimalSize(144, 12), + SetDataTip(STR_HELISTATION, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT), + NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_HELIDEPOT), SetMinimalSize(144, 12), + SetDataTip(STR_HELIDEPOT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT), + NWidget(NWID_SPACER), SetMinimalSize(0, 1), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(2, 0), + EndContainer(), + EndContainer(), + /* Bottom panel. */ + NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BAW_BOTTOMPANEL), + NWidget(WWT_LABEL, COLOUR_DARK_GREEN, BAW_COVERAGE_LABEL), SetMinimalSize(148, 14), SetDataTip(STR_3066_COVERAGE_AREA_HIGHLIGHT, STR_NULL), + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(14, 0), + NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_BTN_DONTHILIGHT), SetMinimalSize(60, 12), SetDataTip(STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE), + NWidget(WWT_TEXTBTN, COLOUR_GREY, BAW_BTN_DOHILIGHT), SetMinimalSize(60, 12), SetDataTip(STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA), + NWidget(NWID_SPACER), SetMinimalSize(14, 0), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0, 37), + EndContainer(), +}; + static const WindowDesc _build_airport_desc( WDP_AUTO, WDP_AUTO, 148, 245, 148, 245, WC_BUILD_STATION, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION, - _build_airport_picker_widgets + _build_airport_picker_widgets, _nested_build_airport_widgets, lengthof(_nested_build_airport_widgets) ); static void ShowBuildAirportPicker(Window *parent) diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index 157795e27..40717d09e 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -267,12 +267,33 @@ static const Widget _build_bridge_widgets[] = { { WIDGETS_END}, }; +static const NWidgetPart _nested_build_bridge_widgets[] = { + /* Header */ + NWidget(NWID_HORIZONTAL), + NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN, BBSW_CLOSEBOX), + NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, BBSW_CAPTION), SetFill(1, 0), SetDataTip(STR_100D_SELECT_RAIL_BRIDGE, STR_018C_WINDOW_TITLE_DRAG_THIS), + EndContainer(), + /* Sort order + criteria buttons */ + NWidget(NWID_HORIZONTAL), + NWidget(WWT_TEXTBTN, COLOUR_DARK_GREEN, BBSW_DROPDOWN_ORDER), SetMinimalSize(81, 12), SetDataTip(STR_SORT_BY, STR_SORT_ORDER_TIP), + NWidget(WWT_DROPDOWN, COLOUR_DARK_GREEN, BBSW_DROPDOWN_CRITERIA), SetMinimalSize(119, 12), SetDataTip(0x0, STR_SORT_CRITERIA_TIP), + EndContainer(), + /* Matrix + scrollbar */ + NWidget(NWID_HORIZONTAL), + NWidget(WWT_MATRIX, COLOUR_DARK_GREEN, BBSW_BRIDGE_LIST), SetMinimalSize(188, 88), SetResize(0, 1), SetDataTip(0x401, STR_101F_BRIDGE_SELECTION_CLICK), + NWidget(NWID_VERTICAL), + NWidget(WWT_SCROLLBAR, COLOUR_DARK_GREEN, BBSW_SCROLLBAR), SetFill(0, 1), + NWidget(WWT_RESIZEBOX, COLOUR_DARK_GREEN, BBSW_RESIZEBOX), + EndContainer(), + EndContainer(), +}; + /* Window definition for the rail bridge selection window */ static const WindowDesc _build_bridge_desc( WDP_AUTO, WDP_AUTO, 200, 114, 200, 114, WC_BUILD_BRIDGE, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE | WDF_CONSTRUCTION, - _build_bridge_widgets + _build_bridge_widgets, _nested_build_bridge_widgets, lengthof(_nested_build_bridge_widgets) ); /** diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index a77efd1a8..1d35eae12 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -55,6 +55,30 @@ static const Widget _build_vehicle_widgets[] = { { WIDGETS_END}, }; +static const NWidgetPart _nested_build_vehicle_widgets[] = { + NWidget(NWID_HORIZONTAL), + NWidget(WWT_CLOSEBOX, COLOUR_GREY, BUILD_VEHICLE_WIDGET_CLOSEBOX), + NWidget(WWT_CAPTION, COLOUR_GREY, BUILD_VEHICLE_WIDGET_CAPTION), SetFill(1, 0), SetResize(1, 0), SetDataTip(0x0, STR_018C_WINDOW_TITLE_DRAG_THIS), + EndContainer(), + /* Sort order + criteria button row. */ + NWidget(NWID_HORIZONTAL), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING), SetMinimalSize(81, 12), SetDataTip(STR_SORT_BY, STR_SORT_ORDER_TIP), + NWidget(WWT_DROPDOWN, COLOUR_GREY, BUILD_VEHICLE_WIDGET_SORT_DROPDOWN), SetMinimalSize(159, 12), SetResize(1, 0), SetDataTip(0x0, STR_SORT_CRITERIA_TIP), + EndContainer(), + /* Vehicle list. */ + NWidget(NWID_HORIZONTAL), + NWidget(WWT_MATRIX, COLOUR_GREY, BUILD_VEHICLE_WIDGET_LIST), SetMinimalSize(228, 14), SetResize(1, 1), SetDataTip(0x101, STR_NULL), + NWidget(WWT_SCROLLBAR, COLOUR_GREY, BUILD_VEHICLE_WIDGET_SCROLLBAR), + EndContainer(), + /* Panel with details. */ + NWidget(WWT_PANEL, COLOUR_GREY, BUILD_VEHICLE_WIDGET_PANEL), SetMinimalSize(240, 122), SetResize(1, 0), EndContainer(), + /* Build/rename buttons, resize button. */ + NWidget(NWID_HORIZONTAL), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BUILD_VEHICLE_WIDGET_BUILD), SetMinimalSize(115, 12), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BUILD_VEHICLE_WIDGET_RENAME), SetMinimalSize(113, 12), SetResize(1, 0), + NWidget(WWT_RESIZEBOX, COLOUR_GREY, BUILD_VEHICLE_WIDGET_RESIZE), + EndContainer(), +}; static bool _internal_sort_order; // descending/ascending static byte _last_sort_criteria[] = {0, 0, 0, 0}; @@ -1091,7 +1115,7 @@ static const WindowDesc _build_vehicle_desc( WDP_AUTO, WDP_AUTO, 240, 174, 240, 256, WC_BUILD_VEHICLE, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE | WDF_CONSTRUCTION, - _build_vehicle_widgets + _build_vehicle_widgets, _nested_build_vehicle_widgets, lengthof(_nested_build_vehicle_widgets) ); void ShowBuildVehicleWindow(TileIndex tile, VehicleType type) diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp index 3b0eb9e81..06998a766 100644 --- a/src/cheat_gui.cpp +++ b/src/cheat_gui.cpp @@ -132,6 +132,14 @@ static const Widget _cheat_widgets[] = { { WIDGETS_END}, }; +static const NWidgetPart _nested_cheat_widgets[] = { + NWidget(NWID_HORIZONTAL), + NWidget(WWT_CLOSEBOX, COLOUR_GREY, 0), + NWidget(WWT_CAPTION, COLOUR_GREY, 1), SetDataTip(STR_CHEATS, STR_018C_WINDOW_TITLE_DRAG_THIS), + EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, 2), SetMinimalSize(400, 156), SetDataTip(0x0, STR_CHEATS_TIP), EndContainer(), +}; + struct CheatWindow : Window { int clicked; @@ -238,7 +246,7 @@ static const WindowDesc _cheats_desc( 240, 22, 400, 170, 400, 170, WC_CHEATS, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, - _cheat_widgets + _cheat_widgets, _nested_cheat_widgets, lengthof(_nested_cheat_widgets) ); diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 6d933710d..afa69b560 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -115,6 +115,55 @@ static const Widget _group_widgets[] = { { WIDGETS_END}, }; +static const NWidgetPart _nested_group_widgets[] = { + NWidget(NWID_HORIZONTAL), // Window header + NWidget(WWT_CLOSEBOX, COLOUR_GREY, GRP_WIDGET_CLOSEBOX), + NWidget(WWT_CAPTION, COLOUR_GREY, GRP_WIDGET_CAPTION), SetMinimalSize(437, 14), + NWidget(WWT_STICKYBOX, COLOUR_GREY, GRP_WIDGET_STICKY), + EndContainer(), + + NWidget(NWID_HORIZONTAL), + /* left part */ + NWidget(NWID_VERTICAL), + + NWidget(WWT_PANEL, COLOUR_GREY, GRP_WIDGET_EMPTY_TOP_LEFT), SetMinimalSize(200, 12), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, GRP_WIDGET_ALL_VEHICLES), SetMinimalSize(200, 13), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, GRP_WIDGET_DEFAULT_VEHICLES), SetMinimalSize(200, 13), EndContainer(), + NWidget(NWID_HORIZONTAL), + NWidget(WWT_MATRIX, COLOUR_GREY, GRP_WIDGET_LIST_GROUP), SetMinimalSize(188, 117), SetDataTip(0x701, STR_GROUPS_CLICK_ON_GROUP_FOR_TIP), SetResize(0, 1), + NWidget(WWT_SCROLL2BAR, COLOUR_GREY, GRP_WIDGET_LIST_GROUP_SCROLLBAR), SetMinimalSize(12, 117), + EndContainer(), + NWidget(NWID_HORIZONTAL), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, GRP_WIDGET_CREATE_GROUP), SetMinimalSize(24, 25), SetDataTip(0x0, STR_GROUP_CREATE_TIP), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, GRP_WIDGET_DELETE_GROUP), SetMinimalSize(24, 25), SetDataTip(0x0, STR_GROUP_DELETE_TIP), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, GRP_WIDGET_RENAME_GROUP), SetMinimalSize(24, 25), SetDataTip(0x0, STR_GROUP_RENAME_TIP), + NWidget(WWT_PANEL, COLOUR_GREY, GRP_WIDGET_EMPTY1), SetMinimalSize(92, 25), SetFill(1, 0), EndContainer(), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, GRP_WIDGET_REPLACE_PROTECTION), SetMinimalSize(24, 25), SetDataTip(0x0, STR_GROUP_REPLACE_PROTECTION_TIP), + NWidget(WWT_PANEL, COLOUR_GREY, GRP_WIDGET_EMPTY2), SetMinimalSize(12, 25), EndContainer(), + EndContainer(), + EndContainer(), + /* right part */ + NWidget(NWID_VERTICAL), + NWidget(NWID_HORIZONTAL), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, GRP_WIDGET_SORT_BY_ORDER), SetMinimalSize(81, 12), SetDataTip(STR_SORT_BY, STR_SORT_ORDER_TIP), + NWidget(WWT_DROPDOWN, COLOUR_GREY, GRP_WIDGET_SORT_BY_DROPDOWN), SetMinimalSize(167, 12), SetDataTip(0x0, STR_SORT_CRITERIA_TIP), + NWidget(WWT_PANEL, COLOUR_GREY, GRP_WIDGET_EMPTY_TOP_RIGHT), SetMinimalSize(12, 12), SetResize(1, 0), EndContainer(), + EndContainer(), + NWidget(NWID_HORIZONTAL), + NWidget(WWT_MATRIX, COLOUR_GREY, GRP_WIDGET_LIST_VEHICLE), SetMinimalSize(248, 156), SetDataTip(0x701, STR_NULL), SetResize(1, 1), + NWidget(WWT_SCROLLBAR, COLOUR_GREY, GRP_WIDGET_LIST_VEHICLE_SCROLLBAR), SetMinimalSize(12, 156), + EndContainer(), + NWidget(NWID_HORIZONTAL), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, GRP_WIDGET_AVAILABLE_VEHICLES), SetMinimalSize(106, 12), SetDataTip(0x0, STR_AVAILABLE_ENGINES_TIP), + NWidget(WWT_DROPDOWN, COLOUR_GREY, GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN), SetMinimalSize(118, 12), SetDataTip(STR_MANAGE_LIST, STR_MANAGE_LIST_TIP), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, GRP_WIDGET_STOP_ALL), SetMinimalSize(12, 12), SetDataTip(SPR_FLAG_VEH_STOPPED, STR_MASS_STOP_LIST_TIP), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, GRP_WIDGET_START_ALL), SetMinimalSize(12, 12), SetDataTip(SPR_FLAG_VEH_RUNNING, STR_MASS_START_LIST_TIP), + NWidget(WWT_PANEL, COLOUR_GREY, GRP_WIDGET_EMPTY_BOTTOM_RIGHT), SetMinimalSize(0, 12), SetResize(1, 0), EndContainer(), + NWidget(WWT_RESIZEBOX, COLOUR_GREY, GRP_WIDGET_RESIZE), SetMinimalSize(12, 12), + EndContainer(), + EndContainer(), + EndContainer(), +}; class VehicleGroupWindow : public BaseVehicleListWindow { private: @@ -704,7 +753,7 @@ static WindowDesc _group_desc( WDP_AUTO, WDP_AUTO, 460, 194, 460, 246, WC_INVALID, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, - _group_widgets + _group_widgets, _nested_group_widgets, lengthof(_nested_group_widgets) ); void ShowCompanyGroup(CompanyID company, VehicleType vehicle_type) diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp index 3cb85625d..a54bfd682 100644 --- a/src/intro_gui.cpp +++ b/src/intro_gui.cpp @@ -59,29 +59,30 @@ static inline void SetNewLandscapeType(byte landscape) InvalidateWindowClasses(WC_SELECT_GAME); } +enum SelectGameIntroWidgets { + SGI_CLOSE, + SGI_CAPTION, + SGI_GENERATE_GAME, + SGI_LOAD_GAME, + SGI_PLAY_SCENARIO, + SGI_PLAY_HEIGHTMAP, + SGI_EDIT_SCENARIO, + SGI_PLAY_NETWORK, + SGI_TEMPERATE_LANDSCAPE, + SGI_ARCTIC_LANDSCAPE, + SGI_TROPIC_LANDSCAPE, + SGI_TOYLAND_LANDSCAPE, + SGI_OPTIONS, + SGI_DIFFICULTIES, + SGI_SETTINGS_OPTIONS, + SGI_GRF_SETTINGS, + SGI_CONTENT_DOWNLOAD, + SGI_AI_SETTINGS, + SGI_EXIT, +}; + struct SelectGameWindow : public Window { -private: - enum SelectGameIntroWidgets { - SGI_GENERATE_GAME = 2, - SGI_LOAD_GAME, - SGI_PLAY_SCENARIO, - SGI_PLAY_HEIGHTMAP, - SGI_EDIT_SCENARIO, - SGI_PLAY_NETWORK, - SGI_TEMPERATE_LANDSCAPE, - SGI_ARCTIC_LANDSCAPE, - SGI_TROPIC_LANDSCAPE, - SGI_TOYLAND_LANDSCAPE, - SGI_OPTIONS, - SGI_DIFFICULTIES, - SGI_SETTINGS_OPTIONS, - SGI_GRF_SETTINGS, - SGI_CONTENT_DOWNLOAD, - SGI_AI_SETTINGS, - SGI_EXIT, - }; - -public: + SelectGameWindow(const WindowDesc *desc) : Window(desc) { this->LowerWidget(_settings_newgame.game_creation.landscape + SGI_TEMPERATE_LANDSCAPE); @@ -151,11 +152,121 @@ public: } }; +static const NWidgetPart _nested_select_game_widgets[] = { + NWidget(WWT_CAPTION, COLOUR_BROWN, SGI_CLOSE), SetMinimalSize(336, 14), SetDataTip(STR_0307_OPENTTD, STR_NULL), + NWidget(WWT_PANEL, COLOUR_BROWN, SGI_CAPTION), + + NWidget(NWID_SPACER), SetMinimalSize(0, 8), + + /* 'generate game' and 'load game' buttons */ + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(10, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_GENERATE_GAME), SetMinimalSize(158, 12), + SetDataTip(STR_0140_NEW_GAME, STR_02FB_START_A_NEW_GAME), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_LOAD_GAME), SetMinimalSize(158, 12), + SetDataTip(STR_0141_LOAD_GAME, STR_02FC_LOAD_A_SAVED_GAME), + NWidget(NWID_SPACER), SetMinimalSize(10, 0), + EndContainer(), + + NWidget(NWID_SPACER), SetMinimalSize(0, 6), + + /* 'play scenario' and 'play heightmap' buttons */ + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(10, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_PLAY_SCENARIO), SetMinimalSize(158, 12), + SetDataTip(STR_029A_PLAY_SCENARIO, STR_0303_START_A_NEW_GAME_USING), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_PLAY_HEIGHTMAP), SetMinimalSize(158, 12), + SetDataTip(STR_PLAY_HEIGHTMAP, STR_PLAY_HEIGHTMAP_HINT), + NWidget(NWID_SPACER), SetMinimalSize(10, 0), + EndContainer(), + + NWidget(NWID_SPACER), SetMinimalSize(0, 6), + + /* 'edit scenario' and 'play multiplayer' buttons */ + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(10, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_EDIT_SCENARIO), SetMinimalSize(158, 12), + SetDataTip(STR_SCENARIO_EDITOR, STR_02FE_CREATE_A_CUSTOMIZED_GAME), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_PLAY_NETWORK), SetMinimalSize(158, 12), + SetDataTip(STR_MULTIPLAYER, STR_0300_SELECT_MULTIPLAYER_GAME), + NWidget(NWID_SPACER), SetMinimalSize(10, 0), + EndContainer(), + + NWidget(NWID_SPACER), SetMinimalSize(0, 7), + + /* climate selection buttons */ + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(2, 0), + NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, SGI_TEMPERATE_LANDSCAPE), SetMinimalSize(77, 55), + SetDataTip(SPR_SELECT_TEMPERATE, STR_030E_SELECT_TEMPERATE_LANDSCAPE), + NWidget(NWID_SPACER), SetMinimalSize(3, 0), + NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, SGI_ARCTIC_LANDSCAPE), SetMinimalSize(77, 55), + SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_030F_SELECT_SUB_ARCTIC_LANDSCAPE), + NWidget(NWID_SPACER), SetMinimalSize(3, 0), + NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, SGI_TROPIC_LANDSCAPE), SetMinimalSize(77, 55), + SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_0310_SELECT_SUB_TROPICAL_LANDSCAPE), + NWidget(NWID_SPACER), SetMinimalSize(3, 0), + NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, SGI_TOYLAND_LANDSCAPE), SetMinimalSize(77, 55), + SetDataTip(SPR_SELECT_TOYLAND, STR_0311_SELECT_TOYLAND_LANDSCAPE), + EndContainer(), + + NWidget(NWID_SPACER), SetMinimalSize(0, 7), + + /* 'game options' and 'difficulty options' buttons */ + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(10, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_OPTIONS), SetMinimalSize(158, 12), + SetDataTip(STR_0148_GAME_OPTIONS, STR_0301_DISPLAY_GAME_OPTIONS), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_DIFFICULTIES), SetMinimalSize(158, 12), + SetDataTip(STR_01FE_DIFFICULTY, STR_0302_DISPLAY_DIFFICULTY_OPTIONS), + NWidget(NWID_SPACER), SetMinimalSize(10, 0), + EndContainer(), + + NWidget(NWID_SPACER), SetMinimalSize(0, 6), + + /* 'advanced settings' and 'newgrf settings' buttons */ + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(10, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_SETTINGS_OPTIONS), SetMinimalSize(158, 12), + SetDataTip(STR_CONFIG_SETTING, STR_CONFIG_SETTING_TIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_GRF_SETTINGS), SetMinimalSize(158, 12), + SetDataTip(STR_NEWGRF_SETTINGS_BUTTON, STR_NEWGRF_SETTINGS_BUTTON_TIP), + NWidget(NWID_SPACER), SetMinimalSize(10, 0), + EndContainer(), + + NWidget(NWID_SPACER), SetMinimalSize(0, 6), + + /* 'online content' and 'ai settings' buttons */ + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(10, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_CONTENT_DOWNLOAD), SetMinimalSize(158, 12), + SetDataTip(STR_CONTENT_INTRO_BUTTON, STR_CONTENT_INTRO_BUTTON_TIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_AI_SETTINGS), SetMinimalSize(158, 12), + SetDataTip(STR_AI_SETTINGS_BUTTON, STR_AI_SETTINGS_BUTTON_TIP), + NWidget(NWID_SPACER), SetMinimalSize(10, 0), + EndContainer(), + + NWidget(NWID_SPACER), SetMinimalSize(0, 6), + + /* 'exit program' button */ + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(104, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_EXIT), SetMinimalSize(128, 12), + SetDataTip(STR_0304_QUIT, STR_0305_QUIT_OPENTTD), + NWidget(NWID_SPACER), SetMinimalSize(104, 0), + EndContainer(), + + NWidget(NWID_SPACER), SetMinimalSize(0, 8), + + EndContainer(), +}; + static const WindowDesc _select_game_desc( WDP_CENTER, WDP_CENTER, 336, 213, 336, 213, WC_SELECT_GAME, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, - _select_game_widgets + _select_game_widgets, + _nested_select_game_widgets, lengthof(_nested_select_game_widgets) ); void ShowSelectGameWindow() diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 60aa5d79b..ae6976a20 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -307,6 +307,22 @@ protected: public: NetworkGameWindow(const WindowDesc *desc) : QueryStringBaseWindow(NETWORK_NAME_LENGTH, desc) { + this->widget[NGWW_CLIENTS].left = this->widget[NGWW_NAME].right + 1; + this->widget[NGWW_MAPSIZE].left = this->widget[NGWW_NAME].right + 1; + this->widget[NGWW_DATE].left = this->widget[NGWW_NAME].right + 1; + this->widget[NGWW_YEARS].left = this->widget[NGWW_NAME].right + 1; + + this->widget[NGWW_CLIENTS].right = this->widget[NGWW_INFO].left - 1; + this->widget[NGWW_MAPSIZE].right = this->widget[NGWW_INFO].left - 1; + this->widget[NGWW_DATE].right = this->widget[NGWW_INFO].left - 1 - 20; + this->widget[NGWW_YEARS].right = this->widget[NGWW_INFO].left - 1 - 20; + + this->widget[NGWW_NAME].display_flags &= ~RESIZE_LRTB; + this->widget[NGWW_CLIENTS].display_flags &= ~RESIZE_LRTB; + this->widget[NGWW_MAPSIZE].display_flags &= ~RESIZE_LRTB; + this->widget[NGWW_DATE].display_flags &= ~RESIZE_LRTB; + this->widget[NGWW_YEARS].display_flags &= ~RESIZE_LRTB; + ttd_strlcpy(this->edit_str_buf, _settings_client.network.client_name, this->edit_str_size); this->afilter = CS_ALPHANUMERAL; InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, 120); @@ -813,11 +829,119 @@ static const Widget _network_game_window_widgets[] = { { WIDGETS_END}, }; +/* Generates incorrect display_flags for widgets NGWW_NAME, and incorrect + * display_flags and/or left/right side for the overlapping widgets + * NGWW_CLIENTS through NGWW_YEARS. + */ +NWidgetPart _nested_network_game_widgets[] = { + /* TOP */ + NWidget(NWID_HORIZONTAL), + NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE, NGWW_CLOSE), + NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE, NGWW_CAPTION), SetMinimalSize(439, 14), SetDataTip(STR_NETWORK_MULTIPLAYER, STR_NULL), // XXX Add default caption tooltip! + EndContainer(), + NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NGWW_MAIN), + NWidget(NWID_SPACER), SetMinimalSize(0, 8), SetResize(1, 0), + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(9, 0), + NWidget(NWID_VERTICAL), + NWidget(NWID_SPACER), SetMinimalSize(0,1), // Text is one pixel further down + NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NGWW_CONNECTION), SetMinimalSize(77, 13), SetDataTip(STR_NETWORK_CONNECTION, STR_NULL), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(4, 0), + NWidget(NWID_VERTICAL), + NWidget(WWT_DROPDOWNIN, COLOUR_LIGHT_BLUE, NGWW_CONN_BTN), SetMinimalSize(92, 12), + SetDataTip(STR_NETWORK_LAN_INTERNET_COMBO, STR_NETWORK_CONNECTION_TIP), + NWidget(NWID_SPACER), SetMinimalSize(0,2), // Text ends two pixels further down + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(108, 0), SetFill(1,0), SetResize(1,0), + NWidget(NWID_VERTICAL), + NWidget(WWT_EDITBOX, COLOUR_LIGHT_BLUE, NGWW_CLIENT), SetMinimalSize(151, 12), + SetDataTip(STR_NETWORK_PLAYER_NAME_OSKTITLE, STR_NETWORK_ENTER_NAME_TIP), + NWidget(NWID_SPACER), SetMinimalSize(0,2), // Text ends two pixels further down + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(9, 0), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0, 6), SetResize(1, 0), + NWidget(NWID_HORIZONTAL), + /* LEFT SIDE */ + NWidget(NWID_SPACER), SetMinimalSize(10, 0), SetResize(0, 1), + NWidget(NWID_VERTICAL), + NWidget(NWID_HORIZONTAL), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_NAME), SetMinimalSize(61, 12), SetResize(1, 0), + SetDataTip(STR_NETWORK_GAME_NAME, STR_NETWORK_GAME_NAME_TIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_CLIENTS), SetMinimalSize(20, 12), + SetDataTip(STR_NETWORK_CLIENTS_CAPTION, STR_NETWORK_CLIENTS_CAPTION_TIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_MAPSIZE), SetMinimalSize(20, 12), + SetDataTip(STR_NETWORK_MAP_SIZE_CAPTION, STR_NETWORK_MAP_SIZE_CAPTION_TIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_DATE), SetMinimalSize(20, 12), SetDataTip(STR_NETWORK_DATE_CAPTION, STR_NETWORK_DATE_CAPTION_TIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_YEARS), SetMinimalSize(20, 12), SetDataTip(STR_NETWORK_YEARS_CAPTION, STR_NETWORK_YEARS_CAPTION_TIP), + NWidget(NWID_SPACER), SetMinimalSize(0, 0), SetFill(0, 0), SetResize(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_INFO), SetMinimalSize(40, 12), SetDataTip(STR_EMPTY, STR_NETWORK_INFO_ICONS_TIP), + EndContainer(), + NWidget(WWT_MATRIX, COLOUR_LIGHT_BLUE, NGWW_MATRIX), SetMinimalSize(181, 155), SetResize(1,1), + SetDataTip((11 << 8) + 1, STR_NETWORK_CLICK_GAME_TO_SELECT), + NWidget(NWID_SPACER), SetMinimalSize(0, 2), SetResize(1, 0), + NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NGWW_LASTJOINED_LABEL), SetMinimalSize(181, 12), SetFill(1,0), + SetDataTip(STR_NETWORK_LAST_JOINED_SERVER, STR_NULL), SetResize(1, 0), + NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NGWW_LASTJOINED), SetMinimalSize(181, 14), SetFill(1,0), SetResize(1, 0), + SetDataTip(0x0, STR_NETWORK_CLICK_TO_SELECT_LAST), + EndContainer(), + EndContainer(), + NWidget(NWID_VERTICAL), + NWidget(WWT_SCROLLBAR, COLOUR_LIGHT_BLUE, NGWW_SCROLLBAR), SetMinimalSize(12, 165), + NWidget(NWID_SPACER), SetMinimalSize(0,28), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(7, 0), SetResize(0, 1), + /* RIGHT SIDE */ + NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NGWW_DETAILS), + NWidget(NWID_SPACER), SetMinimalSize(0, 155), SetResize(0, 1), + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(120, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_NEWGRF), SetMinimalSize(106, 12), SetDataTip(STR_NEWGRF_SETTINGS_BUTTON, STR_NULL), + NWidget(NWID_SPACER), SetMinimalSize(5, 0), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0, 6), + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(5, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_JOIN), SetMinimalSize(101, 12), SetDataTip(STR_NETWORK_JOIN_GAME, STR_NULL), + NWidget(NWID_SPACER), SetMinimalSize(14, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_REFRESH), SetMinimalSize(106, 12), SetDataTip(STR_NETWORK_REFRESH, STR_NETWORK_REFRESH_TIP), + NWidget(NWID_SPACER), SetMinimalSize(5, 0), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0, 10), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(9, 0), SetResize(0, 1), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0, 9), SetResize(1, 0), + /* BOTTOM */ + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(10, 0), + NWidget(NWID_VERTICAL), + NWidget(NWID_HORIZONTAL), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_FIND), SetMinimalSize(101, 12), SetDataTip(STR_NETWORK_FIND_SERVER, STR_NETWORK_FIND_SERVER_TIP), + NWidget(NWID_SPACER), SetMinimalSize(7, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_ADD), SetMinimalSize(101, 12), SetDataTip(STR_NETWORK_ADD_SERVER, STR_NETWORK_ADD_SERVER_TIP), + NWidget(NWID_SPACER), SetMinimalSize(7, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_START), SetMinimalSize(101, 12), SetDataTip(STR_NETWORK_START_SERVER, STR_NETWORK_START_SERVER_TIP), + NWidget(NWID_SPACER), SetMinimalSize(7, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_CANCEL), SetMinimalSize(101, 12), SetDataTip(STR_012E_CANCEL, STR_NULL), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0,6), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetResize(1, 0), + NWidget(NWID_VERTICAL), + NWidget(NWID_SPACER), SetMinimalSize(0, 6), + NWidget(WWT_RESIZEBOX, COLOUR_LIGHT_BLUE, NGWW_RESIZE), + EndContainer(), + EndContainer(), + EndContainer(), +}; + static const WindowDesc _network_game_window_desc( WDP_CENTER, WDP_CENTER, 450, 264, 780, 264, WC_NETWORK_WINDOW, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, - _network_game_window_widgets + _network_game_window_widgets, _nested_network_game_widgets, lengthof(_nested_network_game_widgets) ); void ShowNetworkGameWindow() diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 7628cf211..32d03f56b 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -336,11 +336,34 @@ static const Widget _news_type0_widgets[] = { { WIDGETS_END}, }; +static NWidgetPart _nested_news_type0_widgets[] = { + /* Caption + close box */ + NWidget(NWID_HORIZONTAL), + NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE, 1), SetMinimalSize(11, 14), SetDataTip(STR_00C5, STR_018B_CLOSE_WINDOW), + NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE, 2), SetMinimalSize(269, 14), SetDataTip(STR_012C_MESSAGE, STR_NULL), + EndContainer(), + + /* Main part */ + NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, 0), + NWidget(NWID_SPACER), SetMinimalSize(0, 2), + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(2, 0), + + NWidget(WWT_INSET, COLOUR_LIGHT_BLUE, 3), SetMinimalSize(276, 49), + EndContainer(), + + NWidget(NWID_SPACER), SetMinimalSize(2, 0), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0, 22), + EndContainer(), +}; + static WindowDesc _news_type0_desc( WDP_CENTER, 476, 280, 87, 280, 87, WC_NEWS_WINDOW, WC_NONE, WDF_DEF_WIDGET, - _news_type0_widgets + _news_type0_widgets, + _nested_news_type0_widgets, lengthof(_nested_news_type0_widgets) ); @@ -756,11 +779,29 @@ static const Widget _message_history_widgets[] = { { WIDGETS_END}, }; +static const NWidgetPart _nested_message_history[] = { + NWidget(NWID_HORIZONTAL), + NWidget(WWT_CLOSEBOX, COLOUR_BROWN, 0), SetMinimalSize(11, 14), SetDataTip(STR_00C5, STR_018B_CLOSE_WINDOW), + NWidget(WWT_CAPTION, COLOUR_BROWN, 1), SetMinimalSize(377, 14), SetDataTip(STR_MESSAGE_HISTORY, STR_018C_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_STICKYBOX, COLOUR_BROWN, 2), SetMinimalSize(12, 14), SetDataTip(0x0, STR_STICKY_BUTTON), + EndContainer(), + + NWidget(NWID_HORIZONTAL), + NWidget(WWT_PANEL, COLOUR_BROWN, 3), SetMinimalSize(388, 125), SetDataTip(0x0, STR_MESSAGE_HISTORY_TIP), SetResize(1, 1), + EndContainer(), + NWidget(NWID_VERTICAL), + NWidget(WWT_SCROLLBAR, COLOUR_BROWN, 4), SetMinimalSize(12, 114), SetDataTip(0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST), SetResize(0, 1), + NWidget(WWT_RESIZEBOX, COLOUR_BROWN, 5), SetMinimalSize(12, 12), SetDataTip(0x0, STR_RESIZE_BUTTON), + EndContainer(), + EndContainer(), +}; + static const WindowDesc _message_history_desc( 240, 22, 400, 140, 400, 140, WC_MESSAGE_HISTORY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, - _message_history_widgets + _message_history_widgets, + _nested_message_history, lengthof(_nested_message_history) ); /** Display window with news messages history */ diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 946f82dcb..f951f58b4 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -716,6 +716,45 @@ static const Widget _vehicle_list_widgets[] = { { WIDGETS_END}, }; +static const NWidgetPart _nested_vehicle_list[] = { + NWidget(NWID_HORIZONTAL), + NWidget(WWT_CLOSEBOX, COLOUR_GREY, VLW_WIDGET_CLOSEBOX), + NWidget(WWT_CAPTION, COLOUR_GREY, VLW_WIDGET_CAPTION), SetMinimalSize(237, 14), SetDataTip(0x0, STR_018C_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_STICKYBOX, COLOUR_GREY, VLW_WIDGET_STICKY), + EndContainer(), + + NWidget(NWID_HORIZONTAL), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, VLW_WIDGET_SORT_ORDER), SetMinimalSize(81, 12), SetDataTip(STR_SORT_BY, STR_SORT_ORDER_TIP), + NWidget(WWT_DROPDOWN, COLOUR_GREY, VLW_WIDGET_SORT_BY_PULLDOWN), SetMinimalSize(167, 12), SetDataTip(0x0, STR_SORT_CRITERIA_TIP), + NWidget(WWT_PANEL, COLOUR_GREY, VLW_WIDGET_EMPTY_TOP_RIGHT), SetMinimalSize(12, 12), SetResize(1, 0), + EndContainer(), + EndContainer(), + + NWidget(NWID_HORIZONTAL), + NWidget(WWT_MATRIX, COLOUR_GREY, VLW_WIDGET_LIST), SetMinimalSize(248, 156), SetResize(1,1), // vertical resize step size will be modified + NWidget(WWT_SCROLLBAR, COLOUR_GREY, VLW_WIDGET_SCROLLBAR), SetMinimalSize(12, 156), + EndContainer(), + + /* Widget to be shown for other companies hiding the following 6 widgets */ + NWidget(NWID_HORIZONTAL), + NWidget(WWT_PANEL, COLOUR_GREY, VLW_WIDGET_OTHER_COMPANY_FILLER), + NWidget(NWID_HORIZONTAL), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, VLW_WIDGET_AVAILABLE_VEHICLES), SetMinimalSize(106, 12), + SetDataTip(0x0, STR_AVAILABLE_ENGINES_TIP), + NWidget(WWT_DROPDOWN, COLOUR_GREY, VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN), SetMinimalSize(118, 12), + SetDataTip(STR_MANAGE_LIST, STR_MANAGE_LIST_TIP), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, VLW_WIDGET_STOP_ALL), SetMinimalSize(12, 12), + SetDataTip(SPR_FLAG_VEH_STOPPED, STR_MASS_STOP_LIST_TIP), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, VLW_WIDGET_START_ALL), SetMinimalSize(12, 12), + SetDataTip(SPR_FLAG_VEH_RUNNING, STR_MASS_START_LIST_TIP), + NWidget(WWT_PANEL, COLOUR_GREY, VLW_WIDGET_EMPTY_BOTTOM_RIGHT), SetMinimalSize(0, 12), SetResize(1, 0), + EndContainer(), + EndContainer(), + EndContainer(), + NWidget(WWT_RESIZEBOX, COLOUR_GREY, VLW_WIDGET_RESIZE), + EndContainer(), +}; + static void DrawSmallOrderList(const Vehicle *v, int left, int right, int y) { const Order *order; @@ -1138,7 +1177,8 @@ static WindowDesc _vehicle_list_desc( WDP_AUTO, WDP_AUTO, 260, 194, 260, 246, WC_INVALID, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, - _vehicle_list_widgets + _vehicle_list_widgets, + _nested_vehicle_list, lengthof(_nested_vehicle_list) ); static void ShowVehicleListWindowLocal(CompanyID company, uint16 VLW_flag, VehicleType vehicle_type, uint16 unique_number) |