summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ai/ai_gui.cpp8
-rw-r--r--src/airport_gui.cpp2
-rw-r--r--src/autoreplace_gui.cpp8
-rw-r--r--src/bridge_gui.cpp2
-rw-r--r--src/build_vehicle_gui.cpp2
-rw-r--r--src/depot_gui.cpp2
-rw-r--r--src/fios_gui.cpp6
-rw-r--r--src/group_gui.cpp4
-rw-r--r--src/industry_gui.cpp6
-rw-r--r--src/network/network_content_gui.cpp2
-rw-r--r--src/network/network_gui.cpp6
-rw-r--r--src/newgrf_debug_gui.cpp4
-rw-r--r--src/newgrf_gui.cpp6
-rw-r--r--src/news_gui.cpp2
-rw-r--r--src/order_gui.cpp6
-rw-r--r--src/rail_gui.cpp2
-rw-r--r--src/settings_gui.cpp2
-rw-r--r--src/signs_gui.cpp2
-rw-r--r--src/station_gui.cpp6
-rw-r--r--src/subsidy_gui.cpp2
-rw-r--r--src/timetable_gui.cpp6
-rw-r--r--src/town_gui.cpp4
-rw-r--r--src/vehicle_gui.cpp6
-rw-r--r--src/widget.cpp54
-rw-r--r--src/widget_type.h24
-rw-r--r--src/widgets/dropdown.cpp2
-rw-r--r--src/window.cpp2
27 files changed, 76 insertions, 102 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index 365ce2a71..4938b7ece 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -195,7 +195,7 @@ static const NWidgetPart _nested_ai_list_widgets[] = {
NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_AI_LIST_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_MATRIX, COLOUR_MAUVE, AIL_WIDGET_LIST), SetMinimalSize(188, 112), SetFill(1, 1), SetResize(1, 1), SetDataTip(0x501, STR_AI_LIST_TOOLTIP),
+ NWidget(WWT_MATRIX, COLOUR_MAUVE, AIL_WIDGET_LIST), SetMinimalSize(188, 112), SetFill(1, 1), SetResize(1, 1), SetDataTip(0x501, STR_AI_LIST_TOOLTIP), SetScrollbar(AIL_WIDGET_SCROLLBAR),
NWidget(WWT_SCROLLBAR, COLOUR_MAUVE, AIL_WIDGET_SCROLLBAR),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_MAUVE, AIL_WIDGET_INFO_BG), SetMinimalTextLines(8, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM), SetResize(1, 0),
@@ -425,7 +425,7 @@ static const NWidgetPart _nested_ai_settings_widgets[] = {
NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_AI_SETTINGS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_MATRIX, COLOUR_MAUVE, AIS_WIDGET_BACKGROUND), SetMinimalSize(188, 182), SetResize(1, 1), SetFill(1, 0), SetDataTip(0x501, STR_NULL),
+ NWidget(WWT_MATRIX, COLOUR_MAUVE, AIS_WIDGET_BACKGROUND), SetMinimalSize(188, 182), SetResize(1, 1), SetFill(1, 0), SetDataTip(0x501, STR_NULL), SetScrollbar(AIS_WIDGET_SCROLLBAR),
NWidget(WWT_SCROLLBAR, COLOUR_MAUVE, AIS_WIDGET_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL),
@@ -492,7 +492,7 @@ static const NWidgetPart _nested_ai_config_widgets[] = {
EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_MATRIX, COLOUR_MAUVE, AIC_WIDGET_LIST), SetMinimalSize(288, 112), SetFill(1, 0), SetDataTip(0x801, STR_AI_CONFIG_LIST_TOOLTIP),
+ NWidget(WWT_MATRIX, COLOUR_MAUVE, AIC_WIDGET_LIST), SetMinimalSize(288, 112), SetFill(1, 0), SetDataTip(0x801, STR_AI_CONFIG_LIST_TOOLTIP), SetScrollbar(AIC_WIDGET_SCROLLBAR),
NWidget(WWT_SCROLLBAR, COLOUR_MAUVE, AIC_WIDGET_SCROLLBAR),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 9),
@@ -1102,7 +1102,7 @@ static const NWidgetPart _nested_ai_debug_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(NWID_VERTICAL),
/* Log panel */
- NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_LOG_PANEL), SetMinimalSize(287, 180), SetResize(1, 1),
+ 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),
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index d3bcd8a3a..ce8feb64c 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -537,7 +537,7 @@ static const NWidgetPart _nested_build_airport_widgets[] = {
NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CLASS_LABEL, STR_NULL), SetFill(1, 0),
NWidget(WWT_DROPDOWN, COLOUR_GREY, BAIRW_CLASS_DROPDOWN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NULL),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_MATRIX, COLOUR_GREY, BAIRW_AIRPORT_LIST), SetFill(1, 0), SetDataTip(0x501, STR_NULL),
+ NWidget(WWT_MATRIX, COLOUR_GREY, BAIRW_AIRPORT_LIST), SetFill(1, 0), SetDataTip(0x501, STR_NULL), SetScrollbar(BAIRW_SCROLLBAR),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, BAIRW_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL),
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index b1b6f03f9..6a628e75f 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -516,9 +516,9 @@ static const NWidgetPart _nested_replace_rail_vehicle_widgets[] = {
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
- NWidget(WWT_MATRIX, COLOUR_GREY, RVW_WIDGET_LEFT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_LEFT_ARRAY), SetResize(1, 1),
+ NWidget(WWT_MATRIX, COLOUR_GREY, RVW_WIDGET_LEFT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_LEFT_ARRAY), SetResize(1, 1), SetScrollbar(RVW_WIDGET_LEFT_SCROLLBAR),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, RVW_WIDGET_LEFT_SCROLLBAR),
- NWidget(WWT_MATRIX, COLOUR_GREY, RVW_WIDGET_RIGHT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_RIGHT_ARRAY), SetResize(1, 1),
+ NWidget(WWT_MATRIX, COLOUR_GREY, RVW_WIDGET_RIGHT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_RIGHT_ARRAY), SetResize(1, 1), SetScrollbar(RVW_WIDGET_RIGHT_SCROLLBAR),
NWidget(WWT_SCROLL2BAR, COLOUR_GREY, RVW_WIDGET_RIGHT_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
@@ -556,9 +556,9 @@ static const NWidgetPart _nested_replace_vehicle_widgets[] = {
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
- NWidget(WWT_MATRIX, COLOUR_GREY, RVW_WIDGET_LEFT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_LEFT_ARRAY), SetResize(1, 1),
+ NWidget(WWT_MATRIX, COLOUR_GREY, RVW_WIDGET_LEFT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_LEFT_ARRAY), SetResize(1, 1), SetScrollbar(RVW_WIDGET_LEFT_SCROLLBAR),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, RVW_WIDGET_LEFT_SCROLLBAR),
- NWidget(WWT_MATRIX, COLOUR_GREY, RVW_WIDGET_RIGHT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_RIGHT_ARRAY), SetResize(1, 1),
+ NWidget(WWT_MATRIX, COLOUR_GREY, RVW_WIDGET_RIGHT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_RIGHT_ARRAY), SetResize(1, 1), SetScrollbar(RVW_WIDGET_RIGHT_SCROLLBAR),
NWidget(WWT_SCROLL2BAR, COLOUR_GREY, RVW_WIDGET_RIGHT_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp
index 89703005e..ba5c2b887 100644
--- a/src/bridge_gui.cpp
+++ b/src/bridge_gui.cpp
@@ -321,7 +321,7 @@ static const NWidgetPart _nested_build_bridge_widgets[] = {
NWidget(WWT_DROPDOWN, COLOUR_DARK_GREEN, BBSW_DROPDOWN_CRITERIA), SetFill(1, 0), SetDataTip(0x0, STR_TOOLTIP_SORT_CRITERIA),
EndContainer(),
/* Matrix. */
- NWidget(WWT_MATRIX, COLOUR_DARK_GREEN, BBSW_BRIDGE_LIST), SetFill(1, 0), SetResize(0, 22), SetDataTip(0x401, STR_SELECT_BRIDGE_SELECTION_TOOLTIP),
+ NWidget(WWT_MATRIX, COLOUR_DARK_GREEN, BBSW_BRIDGE_LIST), SetFill(1, 0), SetResize(0, 22), SetDataTip(0x401, STR_SELECT_BRIDGE_SELECTION_TOOLTIP), SetScrollbar(BBSW_SCROLLBAR),
EndContainer(),
/* scrollbar + resize button */
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index ab2e66530..b69150336 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -77,7 +77,7 @@ static const NWidgetPart _nested_build_vehicle_widgets[] = {
EndContainer(),
/* Vehicle list. */
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_MATRIX, COLOUR_GREY, BUILD_VEHICLE_WIDGET_LIST), SetResize(1, 1), SetFill(1, 0), SetDataTip(0x101, STR_NULL),
+ NWidget(WWT_MATRIX, COLOUR_GREY, BUILD_VEHICLE_WIDGET_LIST), SetResize(1, 1), SetFill(1, 0), SetDataTip(0x101, STR_NULL), SetScrollbar(BUILD_VEHICLE_WIDGET_SCROLLBAR),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, BUILD_VEHICLE_WIDGET_SCROLLBAR),
EndContainer(),
/* Panel with details. */
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index eaf7fcb22..050632e4a 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -70,7 +70,7 @@ static const NWidgetPart _nested_train_depot_widgets[] = {
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_VERTICAL),
- NWidget(WWT_MATRIX, COLOUR_GREY, DEPOT_WIDGET_MATRIX), SetDataTip(0x0, STR_NULL), SetResize(1, 1),
+ NWidget(WWT_MATRIX, COLOUR_GREY, DEPOT_WIDGET_MATRIX), SetDataTip(0x0, STR_NULL), SetResize(1, 1), SetScrollbar(DEPOT_WIDGET_V_SCROLL),
NWidget(WWT_HSCROLLBAR, COLOUR_GREY, DEPOT_WIDGET_H_SCROLL),
EndContainer(),
NWidget(NWID_VERTICAL),
diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp
index 466f1d1b5..4f83c309f 100644
--- a/src/fios_gui.cpp
+++ b/src/fios_gui.cpp
@@ -99,7 +99,7 @@ static const NWidgetPart _nested_load_dialog_widgets[] = {
NWidget(WWT_PANEL, COLOUR_GREY, SLWW_FILE_BACKGROUND),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_INSET, COLOUR_GREY, SLWW_DRIVES_DIRECTORIES_LIST), SetFill(1, 1), SetPadding(2, 1, 2, 2),
- SetDataTip(0x0, STR_SAVELOAD_LIST_TOOLTIP), SetResize(1, 10), EndContainer(),
+ SetDataTip(0x0, STR_SAVELOAD_LIST_TOOLTIP), SetResize(1, 10), SetScrollbar(SLWW_SCROLLBAR), EndContainer(),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, SLWW_SCROLLBAR),
EndContainer(),
NWidget(NWID_SELECTION, INVALID_COLOUR, SLWW_CONTENT_DOWNLOAD_SEL),
@@ -139,7 +139,7 @@ static const NWidgetPart _nested_load_heightmap_dialog_widgets[] = {
NWidget(WWT_PANEL, COLOUR_GREY, SLWW_FILE_BACKGROUND),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_INSET, COLOUR_GREY, SLWW_DRIVES_DIRECTORIES_LIST), SetFill(1, 1), SetPadding(2, 1, 2, 2),
- SetDataTip(0x0, STR_SAVELOAD_LIST_TOOLTIP), SetResize(1, 10), EndContainer(),
+ SetDataTip(0x0, STR_SAVELOAD_LIST_TOOLTIP), SetResize(1, 10), SetScrollbar(SLWW_SCROLLBAR), EndContainer(),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, SLWW_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL),
@@ -170,7 +170,7 @@ static const NWidgetPart _nested_save_dialog_widgets[] = {
NWidget(WWT_PANEL, COLOUR_GREY, SLWW_FILE_BACKGROUND),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_INSET, COLOUR_GREY, SLWW_DRIVES_DIRECTORIES_LIST), SetPadding(2, 1, 0, 2),
- SetDataTip(0x0, STR_SAVELOAD_LIST_TOOLTIP), SetResize(1, 10), EndContainer(),
+ SetDataTip(0x0, STR_SAVELOAD_LIST_TOOLTIP), SetResize(1, 10), SetScrollbar(SLWW_SCROLLBAR), EndContainer(),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, SLWW_SCROLLBAR),
EndContainer(),
NWidget(WWT_EDITBOX, COLOUR_GREY, SLWW_SAVE_OSK_TITLE), SetPadding(3, 2, 2, 2), SetFill(1, 0), SetResize(1, 0),
diff --git a/src/group_gui.cpp b/src/group_gui.cpp
index 79d1a4546..8c5e5b00d 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -69,7 +69,7 @@ static const NWidgetPart _nested_group_widgets[] = {
NWidget(WWT_PANEL, COLOUR_GREY, GRP_WIDGET_DEFAULT_VEHICLES), SetMinimalSize(200, 13), SetFill(1, 0), EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_MATRIX, COLOUR_GREY, GRP_WIDGET_LIST_GROUP), SetMinimalSize(188, 0), SetDataTip(0x701, STR_GROUPS_CLICK_ON_GROUP_FOR_TOOLTIP),
- SetFill(1, 0), SetResize(0, 1),
+ SetFill(1, 0), SetResize(0, 1), SetScrollbar(GRP_WIDGET_LIST_GROUP_SCROLLBAR),
NWidget(WWT_SCROLL2BAR, COLOUR_GREY, GRP_WIDGET_LIST_GROUP_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL),
@@ -93,7 +93,7 @@ static const NWidgetPart _nested_group_widgets[] = {
NWidget(WWT_PANEL, COLOUR_GREY), SetMinimalSize(12, 12), SetResize(1, 0), EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_MATRIX, COLOUR_GREY, GRP_WIDGET_LIST_VEHICLE), SetMinimalSize(248, 0), SetDataTip(0x701, STR_NULL), SetResize(1, 1), SetFill(1, 0),
+ NWidget(WWT_MATRIX, COLOUR_GREY, GRP_WIDGET_LIST_VEHICLE), SetMinimalSize(248, 0), SetDataTip(0x701, STR_NULL), SetResize(1, 1), SetFill(1, 0), SetScrollbar(GRP_WIDGET_LIST_VEHICLE_SCROLLBAR),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, GRP_WIDGET_LIST_VEHICLE_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL),
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index a8182e909..9db3e6485 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -179,7 +179,7 @@ static const NWidgetPart _nested_build_industry_widgets[] = {
NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_MATRIX, COLOUR_DARK_GREEN, DPIW_MATRIX_WIDGET), SetDataTip(0x801, STR_FUND_INDUSTRY_SELECTION_TOOLTIP), SetFill(1, 0), SetResize(1, 1),
+ NWidget(WWT_MATRIX, COLOUR_DARK_GREEN, DPIW_MATRIX_WIDGET), SetDataTip(0x801, STR_FUND_INDUSTRY_SELECTION_TOOLTIP), SetFill(1, 0), SetResize(1, 1), SetScrollbar(DPIW_SCROLLBAR),
NWidget(WWT_SCROLLBAR, COLOUR_DARK_GREEN, DPIW_SCROLLBAR),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, DPIW_INFOPANEL), SetResize(1, 0),
@@ -951,7 +951,7 @@ static const NWidgetPart _nested_industry_directory_widgets[] = {
NWidget(WWT_DROPDOWN, COLOUR_BROWN, IDW_DROPDOWN_CRITERIA), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_SORT_CRITERIA),
NWidget(WWT_PANEL, COLOUR_BROWN), SetResize(1, 0), EndContainer(),
EndContainer(),
- NWidget(WWT_PANEL, COLOUR_BROWN, IDW_INDUSTRY_LIST), SetDataTip(0x0, STR_INDUSTRY_DIRECTORY_LIST_CAPTION), SetResize(1, 1), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_BROWN, IDW_INDUSTRY_LIST), SetDataTip(0x0, STR_INDUSTRY_DIRECTORY_LIST_CAPTION), SetResize(1, 1), SetScrollbar(IDW_SCROLLBAR), EndContainer(),
EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(WWT_SCROLLBAR, COLOUR_BROWN, IDW_SCROLLBAR),
@@ -1310,7 +1310,7 @@ static const NWidgetPart _nested_industry_cargoes_widgets[] = {
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_VERTICAL),
- NWidget(WWT_PANEL, COLOUR_BROWN, ICW_PANEL), SetResize(1, 10), SetMinimalSize(200, 90), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_BROWN, ICW_PANEL), SetResize(1, 10), SetMinimalSize(200, 90), SetScrollbar(ICW_SCROLLBAR), EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_TEXTBTN, COLOUR_BROWN, ICW_NOTIFY),
SetDataTip(STR_INDUSTRY_CARGOES_NOTIFY_SMALLMAP, STR_INDUSTRY_CARGOES_NOTIFY_SMALLMAP_TOOLTIP),
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp
index 764843abc..138cea9bd 100644
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -825,7 +825,7 @@ static const NWidgetPart _nested_network_content_list_widgets[] = {
NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_NAME), SetResize(1, 0), SetFill(1, 0),
SetDataTip(STR_CONTENT_NAME_CAPTION, STR_CONTENT_NAME_CAPTION_TOOLTIP),
EndContainer(),
- NWidget(WWT_MATRIX, COLOUR_LIGHT_BLUE, NCLWW_MATRIX), SetResize(1, 14), SetFill(1, 1),
+ NWidget(WWT_MATRIX, COLOUR_LIGHT_BLUE, NCLWW_MATRIX), SetResize(1, 14), SetFill(1, 1), SetScrollbar(NCLWW_SCROLLBAR),
EndContainer(),
NWidget(WWT_SCROLLBAR, COLOUR_LIGHT_BLUE, NCLWW_SCROLLBAR),
EndContainer(),
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 9a2347ba2..cc37bcfe7 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -945,7 +945,7 @@ static const NWidgetPart _nested_network_game_widgets[] = {
NWidget(NWID_VERTICAL),
NWidgetFunction(MakeResizableHeader),
NWidget(WWT_MATRIX, COLOUR_LIGHT_BLUE, NGWW_MATRIX), SetResize(1, 1), SetFill(1, 0),
- SetDataTip(0, STR_NETWORK_SERVER_LIST_CLICK_GAME_TO_SELECT),
+ SetDataTip(0, STR_NETWORK_SERVER_LIST_CLICK_GAME_TO_SELECT), SetScrollbar(NGWW_SCROLLBAR),
EndContainer(),
NWidget(WWT_SCROLLBAR, COLOUR_LIGHT_BLUE, NGWW_SCROLLBAR),
EndContainer(),
@@ -1353,7 +1353,7 @@ static const NWidgetPart _nested_network_start_server_window_widgets[] = {
NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_SELECT_MAP_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_SELECT_MAP, STR_NULL),
NWidget(NWID_SPACER), SetMinimalSize(0, 6), SetFill(1, 0),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NSSW_SELMAP), SetMinimalSize(250, 0), SetFill(1, 1), SetDataTip(STR_NULL, STR_NETWORK_START_SERVER_SELECT_MAP_TOOLTIP), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NSSW_SELMAP), SetMinimalSize(250, 0), SetFill(1, 1), SetDataTip(STR_NULL, STR_NETWORK_START_SERVER_SELECT_MAP_TOOLTIP), SetScrollbar(NSSW_SCROLLBAR), EndContainer(),
NWidget(WWT_SCROLLBAR, COLOUR_LIGHT_BLUE, NSSW_SCROLLBAR),
EndContainer(),
EndContainer(),
@@ -1686,7 +1686,7 @@ static const NWidgetPart _nested_network_lobby_window_widgets[] = {
/* Company list. */
NWidget(NWID_VERTICAL),
NWidget(WWT_PANEL, COLOUR_WHITE, NLWW_HEADER), SetMinimalSize(146, 0), SetResize(1, 0), SetFill(1, 0), EndContainer(),
- NWidget(WWT_MATRIX, COLOUR_LIGHT_BLUE, NLWW_MATRIX), SetMinimalSize(146, 0), SetResize(1, 1), SetFill(1, 1), SetDataTip(0, STR_NETWORK_GAME_LOBBY_COMPANY_LIST_TOOLTIP),
+ NWidget(WWT_MATRIX, COLOUR_LIGHT_BLUE, NLWW_MATRIX), SetMinimalSize(146, 0), SetResize(1, 1), SetFill(1, 1), SetDataTip(0, STR_NETWORK_GAME_LOBBY_COMPANY_LIST_TOOLTIP), SetScrollbar(NLWW_SCROLLBAR),
EndContainer(),
NWidget(WWT_SCROLLBAR, COLOUR_LIGHT_BLUE, NLWW_SCROLLBAR),
NWidget(NWID_SPACER), SetMinimalSize(5, 0), SetResize(0, 1),
diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp
index 4e4d89955..a6e5a2695 100644
--- a/src/newgrf_debug_gui.cpp
+++ b/src/newgrf_debug_gui.cpp
@@ -465,7 +465,7 @@ static const NWidgetPart _nested_newgrf_inspect_widgets[] = {
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_GREY, NIW_MAINPANEL), SetMinimalSize(300, 0), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_GREY, NIW_MAINPANEL), SetMinimalSize(300, 0), SetScrollbar(NIW_SCROLLBAR), EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, NIW_SCROLLBAR),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
@@ -792,7 +792,7 @@ static const NWidgetPart _nested_sprite_aligner_widgets[] = {
NWidget(NWID_VERTICAL), SetPIP(10, 5, 10),
NWidget(WWT_TEXTBTN, COLOUR_GREY, SAW_PICKER), SetDataTip(STR_SPRITE_ALIGNER_PICKER_BUTTON, STR_SPRITE_ALIGNER_PICKER_TOOLTIP), SetFill(1, 0),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_MATRIX, COLOUR_GREY, SAW_LIST), SetResize(1, 1), SetDataTip(0x101, STR_NULL), SetFill(1, 1),
+ NWidget(WWT_MATRIX, COLOUR_GREY, SAW_LIST), SetResize(1, 1), SetDataTip(0x101, STR_NULL), SetFill(1, 1), SetScrollbar(SAW_SCROLLBAR),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, SAW_SCROLLBAR),
EndContainer(),
EndContainer(),
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 4256793c9..887f71746 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -342,7 +342,7 @@ static const NWidgetPart _nested_newgrf_parameter_widgets[] = {
NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_NEWGRF_PARAMETERS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_MATRIX, COLOUR_MAUVE, GRFPAR_WIDGET_BACKGROUND), SetMinimalSize(188, 182), SetResize(1, 1), SetFill(1, 0), SetDataTip(0x501, STR_NULL),
+ NWidget(WWT_MATRIX, COLOUR_MAUVE, GRFPAR_WIDGET_BACKGROUND), SetMinimalSize(188, 182), SetResize(1, 1), SetFill(1, 0), SetDataTip(0x501, STR_NULL), SetScrollbar(GRFPAR_WIDGET_SCROLLBAR),
NWidget(WWT_SCROLLBAR, COLOUR_MAUVE, GRFPAR_WIDGET_SCROLLBAR),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_MAUVE, GRFPAR_WIDGET_DESCRIPTION), SetResize(1, 0), SetFill(1, 0),
@@ -1385,7 +1385,7 @@ static const NWidgetPart _nested_newgrf_actives_widgets[] = {
NWidget(NWID_HORIZONTAL), SetPadding(0, 2, 0, 2),
NWidget(WWT_PANEL, COLOUR_MAUVE),
NWidget(WWT_INSET, COLOUR_MAUVE, SNGRFS_FILE_LIST), SetMinimalSize(100, 1), SetPadding(2, 2, 2, 2),
- SetFill(1, 1), SetResize(1, 1),
+ SetFill(1, 1), SetResize(1, 1), SetScrollbar(SNGRFS_SCROLLBAR),
EndContainer(),
EndContainer(),
NWidget(WWT_SCROLLBAR, COLOUR_MAUVE, SNGRFS_SCROLLBAR),
@@ -1419,7 +1419,7 @@ static const NWidgetPart _nested_newgrf_availables_widgets[] = {
NWidget(NWID_HORIZONTAL), SetPadding(0, 2, 0, 2),
NWidget(WWT_PANEL, COLOUR_MAUVE),
NWidget(WWT_INSET, COLOUR_MAUVE, SNGRFS_AVAIL_LIST), SetMinimalSize(100, 1), SetPadding(2, 2, 2, 2),
- SetFill(1, 1), SetResize(1, 1),
+ SetFill(1, 1), SetResize(1, 1), SetScrollbar(SNGRFS_SCROLL2BAR),
EndContainer(),
EndContainer(),
NWidget(WWT_SCROLL2BAR, COLOUR_MAUVE, SNGRFS_SCROLL2BAR),
diff --git a/src/news_gui.cpp b/src/news_gui.cpp
index 793e00b6d..3d8881b34 100644
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -1045,7 +1045,7 @@ static const NWidgetPart _nested_message_history[] = {
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_BROWN, MHW_BACKGROUND), SetMinimalSize(200, 125), SetDataTip(0x0, STR_MESSAGE_HISTORY_TOOLTIP), SetResize(1, 12),
+ NWidget(WWT_PANEL, COLOUR_BROWN, MHW_BACKGROUND), SetMinimalSize(200, 125), SetDataTip(0x0, STR_MESSAGE_HISTORY_TOOLTIP), SetResize(1, 12), SetScrollbar(MHW_SCROLLBAR),
EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(WWT_SCROLLBAR, COLOUR_BROWN, MHW_SCROLLBAR),
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index 621230adb..494ff4e79 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -1388,7 +1388,7 @@ static const NWidgetPart _nested_orders_train_widgets[] = {
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_GREY, ORDER_WIDGET_ORDER_LIST), SetMinimalSize(372, 62), SetDataTip(0x0, STR_ORDERS_LIST_TOOLTIP), SetResize(1, 1), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_GREY, ORDER_WIDGET_ORDER_LIST), SetMinimalSize(372, 62), SetDataTip(0x0, STR_ORDERS_LIST_TOOLTIP), SetResize(1, 1), SetScrollbar(ORDER_WIDGET_SCROLLBAR), EndContainer(),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, ORDER_WIDGET_SCROLLBAR),
EndContainer(),
@@ -1452,7 +1452,7 @@ static const NWidgetPart _nested_orders_widgets[] = {
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_GREY, ORDER_WIDGET_ORDER_LIST), SetMinimalSize(372, 62), SetDataTip(0x0, STR_ORDERS_LIST_TOOLTIP), SetResize(1, 1), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_GREY, ORDER_WIDGET_ORDER_LIST), SetMinimalSize(372, 62), SetDataTip(0x0, STR_ORDERS_LIST_TOOLTIP), SetResize(1, 1), SetScrollbar(ORDER_WIDGET_SCROLLBAR), EndContainer(),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, ORDER_WIDGET_SCROLLBAR),
EndContainer(),
@@ -1517,7 +1517,7 @@ static const NWidgetPart _nested_other_orders_widgets[] = {
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_GREY, ORDER_WIDGET_ORDER_LIST), SetMinimalSize(372, 72), SetDataTip(0x0, STR_ORDERS_LIST_TOOLTIP), SetResize(1, 1), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_GREY, ORDER_WIDGET_ORDER_LIST), SetMinimalSize(372, 72), SetDataTip(0x0, STR_ORDERS_LIST_TOOLTIP), SetResize(1, 1), SetScrollbar(ORDER_WIDGET_SCROLLBAR), EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, ORDER_WIDGET_SCROLLBAR),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index cbd51c35e..776ef8a15 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -1397,7 +1397,7 @@ static const NWidgetPart _nested_station_builder_widgets[] = {
NWidget(NWID_VERTICAL),
NWidget(WWT_DROPDOWN, COLOUR_GREY, BRSW_NEWST_DROPDOWN), SetMinimalSize(134, 12), SetFill(1, 0), SetPadding(3, 7, 3, 7), SetDataTip(STR_BLACK_STRING, STR_STATION_BUILD_STATION_CLASS_TOOLTIP),
NWidget(NWID_HORIZONTAL), SetPIP(7, 0, 7),
- NWidget(WWT_MATRIX, COLOUR_GREY, BRSW_NEWST_LIST), SetMinimalSize(122, 71), SetFill(1, 0), SetDataTip(0x501, STR_STATION_BUILD_STATION_TYPE_TOOLTIP),
+ NWidget(WWT_MATRIX, COLOUR_GREY, BRSW_NEWST_LIST), SetMinimalSize(122, 71), SetFill(1, 0), SetDataTip(0x501, STR_STATION_BUILD_STATION_TYPE_TOOLTIP), SetScrollbar(BRSW_NEWST_SCROLL),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, BRSW_NEWST_SCROLL),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 1),
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index de83a435d..81f9f6b97 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1707,7 +1707,7 @@ static const NWidgetPart _nested_settings_selection_widgets[] = {
NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_CONFIG_SETTING_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_MAUVE, SETTINGSEL_OPTIONSPANEL), SetMinimalSize(400, 174), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_MAUVE, SETTINGSEL_OPTIONSPANEL), SetMinimalSize(400, 174), SetScrollbar(SETTINGSEL_SCROLLBAR), EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(WWT_SCROLLBAR, COLOUR_MAUVE, SETTINGSEL_SCROLLBAR),
NWidget(WWT_RESIZEBOX, COLOUR_MAUVE),
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index db9ce47af..4e28bd15f 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -206,7 +206,7 @@ static const NWidgetPart _nested_sign_list_widgets[] = {
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PANEL, COLOUR_GREY, SLW_LIST), SetMinimalSize(WD_FRAMETEXT_LEFT + 16 + MAX_LENGTH_SIGN_NAME_PIXELS + WD_FRAMETEXT_RIGHT, 50),
- SetResize(1, 10), SetFill(1, 0), EndContainer(),
+ SetResize(1, 10), SetFill(1, 0), SetScrollbar(SLW_SCROLLBAR), EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, SLW_SCROLLBAR),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index cf2946454..d0c07aca9 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -777,7 +777,7 @@ static const NWidgetPart _nested_company_stations_widgets[] = {
NWidget(WWT_PANEL, COLOUR_GREY), SetDataTip(0x0, STR_NULL), SetResize(1, 0), SetFill(1, 1), EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_GREY, SLW_LIST), SetMinimalSize(346, 125), SetResize(1, 10), SetDataTip(0x0, STR_STATION_LIST_TOOLTIP), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_GREY, SLW_LIST), SetMinimalSize(346, 125), SetResize(1, 10), SetDataTip(0x0, STR_STATION_LIST_TOOLTIP), SetScrollbar(SLW_SCROLLBAR), EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, SLW_SCROLLBAR),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
@@ -812,7 +812,7 @@ static const NWidgetPart _nested_station_view_widgets[] = {
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_GREY, SVW_WAITING), SetMinimalSize(237, 52), SetResize(1, 10), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_GREY, SVW_WAITING), SetMinimalSize(237, 52), SetResize(1, 10), SetScrollbar(SVW_SCROLLBAR), EndContainer(),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, SVW_SCROLLBAR),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, SVW_ACCEPTLIST), SetMinimalSize(249, 32), SetResize(1, 0), EndContainer(),
@@ -1338,7 +1338,7 @@ static const NWidgetPart _nested_select_station_widgets[] = {
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, JSW_WIDGET_CAPTION), SetDataTip(STR_JOIN_STATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_DARK_GREEN, JSW_PANEL), SetResize(1, 0), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_DARK_GREEN, JSW_PANEL), SetResize(1, 0), SetScrollbar(JSW_SCROLLBAR), EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(WWT_SCROLLBAR, COLOUR_DARK_GREEN, JSW_SCROLLBAR),
NWidget(WWT_RESIZEBOX, COLOUR_DARK_GREEN),
diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp
index 09c43bd84..930b11714 100644
--- a/src/subsidy_gui.cpp
+++ b/src/subsidy_gui.cpp
@@ -230,7 +230,7 @@ static const NWidgetPart _nested_subsidies_list_widgets[] = {
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_BROWN, SLW_PANEL), SetDataTip(0x0, STR_SUBSIDIES_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER), SetResize(1, 1), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_BROWN, SLW_PANEL), SetDataTip(0x0, STR_SUBSIDIES_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER), SetResize(1, 1), SetScrollbar(SLW_SCROLLBAR), EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(WWT_SCROLLBAR, COLOUR_BROWN, SLW_SCROLLBAR),
NWidget(WWT_RESIZEBOX, COLOUR_BROWN),
diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp
index e38e0d938..7d9c6e910 100644
--- a/src/timetable_gui.cpp
+++ b/src/timetable_gui.cpp
@@ -32,7 +32,6 @@ enum TimetableViewWindowWidgets {
TTV_CAPTION,
TTV_ORDER_VIEW,
TTV_TIMETABLE_PANEL,
- TTV_FAKE_SCROLLBAR, ///< So the timetable panel 'sees' the scrollbar too
TTV_ARRIVAL_DEPARTURE_PANEL, ///< Panel with the expected/scheduled arrivals
TTV_SCROLLBAR,
TTV_SUMMARY_PANEL,
@@ -614,10 +613,9 @@ static const NWidgetPart _nested_timetable_widgets[] = {
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_GREY, TTV_TIMETABLE_PANEL), SetMinimalSize(388, 82), SetResize(1, 10), SetDataTip(STR_NULL, STR_TIMETABLE_TOOLTIP), EndContainer(),
- NWidget(WWT_SCROLLBAR, COLOUR_GREY, TTV_FAKE_SCROLLBAR), SetMinimalSize(0, 0), // Hack so the timetable panel can 'use' the scrollbar too
+ NWidget(WWT_PANEL, COLOUR_GREY, TTV_TIMETABLE_PANEL), SetMinimalSize(388, 82), SetResize(1, 10), SetDataTip(STR_NULL, STR_TIMETABLE_TOOLTIP), SetScrollbar(TTV_SCROLLBAR), EndContainer(),
NWidget(NWID_SELECTION, INVALID_COLOUR, TTV_ARRIVAL_DEPARTURE_SELECTION),
- NWidget(WWT_PANEL, COLOUR_GREY, TTV_ARRIVAL_DEPARTURE_PANEL), SetMinimalSize(110, 0), SetFill(0, 1), SetDataTip(STR_NULL, STR_TIMETABLE_TOOLTIP), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_GREY, TTV_ARRIVAL_DEPARTURE_PANEL), SetMinimalSize(110, 0), SetFill(0, 1), SetDataTip(STR_NULL, STR_TIMETABLE_TOOLTIP), SetScrollbar(TTV_SCROLLBAR), EndContainer(),
EndContainer(),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, TTV_SCROLLBAR),
EndContainer(),
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index f9e70cc6d..7e78a5ee6 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -59,7 +59,7 @@ static const NWidgetPart _nested_town_authority_widgets[] = {
EndContainer(),
NWidget(WWT_PANEL, COLOUR_BROWN, TWA_RATING_INFO), SetMinimalSize(317, 92), SetResize(1, 1), EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_BROWN, TWA_COMMAND_LIST), SetMinimalSize(305, 52), SetResize(1, 0), SetDataTip(0x0, STR_LOCAL_AUTHORITY_ACTIONS_TOOLTIP), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_BROWN, TWA_COMMAND_LIST), SetMinimalSize(305, 52), SetResize(1, 0), SetDataTip(0x0, STR_LOCAL_AUTHORITY_ACTIONS_TOOLTIP), SetScrollbar(TWA_SCROLLBAR), EndContainer(),
NWidget(WWT_SCROLLBAR, COLOUR_BROWN, TWA_SCROLLBAR),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_BROWN, TWA_ACTION_INFO), SetMinimalSize(317, 52), SetResize(1, 0), EndContainer(),
@@ -630,7 +630,7 @@ static const NWidgetPart _nested_town_directory_widgets[] = {
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, TDW_SORTPOPULATION), SetMinimalSize(97, 12), SetDataTip(STR_SORT_BY_CAPTION_POPULATION, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_BROWN, TDW_CENTERTOWN), SetMinimalSize(196, 164), SetDataTip(0x0, STR_TOWN_DIRECTORY_LIST_TOOLTIP),
- SetFill(1, 0), SetResize(0, 10), EndContainer(),
+ SetFill(1, 0), SetResize(0, 10), SetScrollbar(TDW_SCROLLBAR), EndContainer(),
NWidget(WWT_PANEL, COLOUR_BROWN, TDW_BOTTOM_PANEL),
NWidget(WWT_TEXT, COLOUR_BROWN, TDW_BOTTOM_TEXT), SetPadding(2, 0, 0, 2), SetMinimalSize(196, 12), SetFill(1, 0), SetDataTip(STR_TOWN_POPULATION, STR_NULL),
EndContainer(),
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index de7c44287..d7dd934b1 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -565,7 +565,7 @@ static const NWidgetPart _nested_vehicle_refit_widgets[] = {
NWidget(WWT_TEXTBTN, COLOUR_GREY, VRW_SELECTHEADER), SetDataTip(STR_REFIT_TITLE, STR_NULL), SetResize(1, 0),
/* Matrix + scrollbar. */
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_MATRIX, COLOUR_GREY, VRW_MATRIX), SetMinimalSize(228, 112), SetResize(1, 14), SetFill(1, 1), SetDataTip(0x801, STR_NULL),
+ NWidget(WWT_MATRIX, COLOUR_GREY, VRW_MATRIX), SetMinimalSize(228, 112), SetResize(1, 14), SetFill(1, 1), SetDataTip(0x801, STR_NULL), SetScrollbar(VRW_SCROLLBAR),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, VRW_SCROLLBAR),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, VRW_INFOPANEL), SetMinimalTextLines(2, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM), SetResize(1, 0), EndContainer(),
@@ -864,7 +864,7 @@ static const NWidgetPart _nested_vehicle_list[] = {
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_MATRIX, COLOUR_GREY, VLW_WIDGET_LIST), SetMinimalSize(248, 0), SetFill(1, 0), SetResize(1, 1),
+ NWidget(WWT_MATRIX, COLOUR_GREY, VLW_WIDGET_LIST), SetMinimalSize(248, 0), SetFill(1, 0), SetResize(1, 1), SetScrollbar(VLW_WIDGET_SCROLLBAR),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, VLW_WIDGET_SCROLLBAR),
EndContainer(),
@@ -1427,7 +1427,7 @@ static const NWidgetPart _nested_train_vehicle_details_widgets[] = {
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, VLD_WIDGET_TOP_DETAILS), SetResize(1, 0), SetMinimalSize(405, 42), EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_MATRIX, COLOUR_GREY, VLD_WIDGET_MATRIX), SetResize(1, 1), SetMinimalSize(393, 45), SetDataTip(0x701, STR_NULL), SetFill(1, 0),
+ NWidget(WWT_MATRIX, COLOUR_GREY, VLD_WIDGET_MATRIX), SetResize(1, 1), SetMinimalSize(393, 45), SetDataTip(0x701, STR_NULL), SetFill(1, 0), SetScrollbar(VLD_WIDGET_SCROLLBAR),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, VLD_WIDGET_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL),
diff --git a/src/widget.cpp b/src/widget.cpp
index e8c03593f..6b58ff9fb 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -854,18 +854,6 @@ NWidgetCore *NWidgetCore::GetWidgetFromPos(int x, int y)
}
/**
- * @fn Scrollbar *NWidgetCore::FindScrollbar(Window *w, bool allow_next = true) const
- * Find the scrollbar of the widget through the Window::nested_array.
- * @param w Window containing the widgets and the scrollbar,
- * @param allow_next Search may be extended to the next widget.
- *
- * @todo This implementation uses the constraint that a scrollbar must be the next item in the #Window::nested_array, and the scrollbar
- * data is stored in the #Window structure (#Window::vscroll, #Window::vscroll2, and #Window::hscroll).
- * Alternative light-weight implementations may be considered, eg by sub-classing a canvas-like widget, and/or by having
- * an explicit link between the scrollbar and the widget being scrolled.
- */
-
-/**
* Constructor container baseclass.
* @param tp Type of the container.
*/
@@ -1578,19 +1566,6 @@ NWidgetCore *NWidgetBackground::GetWidgetFromPos(int x, int y)
return nwid;
}
-Scrollbar *NWidgetBackground::FindScrollbar(Window *w, bool allow_next) const
-{
- if (this->index >= 0 && allow_next && this->child == NULL && (uint)(this->index) + 1 < w->nested_array_size) {
- /* GetWidget ensures that the widget is of the given type.
- * As we might have cases where the next widget in the array
- * is a non-Core widget (e.g. NWID_SELECTION) we first get
- * the base class and then dynamic_cast that. */
- const NWidgetCore *next_wid = dynamic_cast<NWidgetCore*>(w->GetWidget<NWidgetBase>(this->index + 1));
- if (next_wid != NULL) return next_wid->FindScrollbar(w, false);
- }
- return NULL;
-}
-
NWidgetBase *NWidgetBackground::GetWidgetOfType(WidgetType tp)
{
NWidgetBase *nwid = NULL;
@@ -1632,11 +1607,6 @@ void NWidgetViewport::Draw(const Window *w)
}
}
-Scrollbar *NWidgetViewport::FindScrollbar(Window *w, bool allow_next) const
-{
- return NULL;
-}
-
/**
* Initialize the viewport of the window.
* @param w Window owning the viewport.
@@ -2092,22 +2062,6 @@ void NWidgetLeaf::Draw(const Window *w)
}
}
-Scrollbar *NWidgetLeaf::FindScrollbar(Window *w, bool allow_next) const
-{
- if (this->type == WWT_SCROLLBAR) return &w->vscroll;
- if (this->type == WWT_SCROLL2BAR) return &w->vscroll2;
-
- if (this->index >= 0 && allow_next && (uint)(this->index) + 1 < w->nested_array_size) {
- /* GetWidget ensures that the widget is of the given type.
- * As we might have cases where the next widget in the array
- * is a non-Core widget (e.g. NWID_SELECTION) we first get
- * the base class and then dynamic_cast that. */
- const NWidgetCore *next_wid = dynamic_cast<NWidgetCore*>(w->GetWidget<NWidgetBase>(this->index + 1));
- if (next_wid != NULL) return next_wid->FindScrollbar(w, false);
- }
- return NULL;
-}
-
/**
* For a #NWID_BUTTON_DROPDOWN, test whether \a pt refers to the button or to the drop-down.
* @param pt Point in the widget.
@@ -2249,6 +2203,14 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest,
break;
}
+ case WPT_SCROLLBAR: {
+ NWidgetCore *nwc = dynamic_cast<NWidgetCore *>(*dest);
+ if (nwc != NULL) {
+ nwc->scrollbar_index = parts->u.widget.index;
+ }
+ break;
+ }
+
case WPT_ENDCONTAINER:
return num_used;
diff --git a/src/widget_type.h b/src/widget_type.h
index 39312dcba..da871df55 100644
--- a/src/widget_type.h
+++ b/src/widget_type.h
@@ -91,6 +91,7 @@ enum WidgetType {
WPT_PIPSPACE, ///< Widget part for specifying pre/inter/post space for containers.
WPT_ENDCONTAINER, ///< Widget part to denote end of a container.
WPT_FUNCTION, ///< Widget part for calling a user function.
+ WPT_SCROLLBAR, ///< Widget part for attaching a scrollbar.
/* Pushable window widget types. */
WWT_MASK = 0x7F,
@@ -278,13 +279,12 @@ public:
/* virtual */ void FillNestedArray(NWidgetBase **array, uint length);
/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y);
- virtual Scrollbar *FindScrollbar(Window *w, bool allow_next = true) const = 0;
-
NWidgetDisplay disp_flags; ///< Flags that affect display and interaction with the widget.
Colours colour; ///< Colour of this widget.
int index; ///< Index of the nested widget in the widget array of the window (\c -1 means 'not used').
uint16 widget_data; ///< Data of the widget. @see Widget::data
StringID tool_tip; ///< Tooltip of the widget. @see Widget::tootips
+ int scrollbar_index; ///< Index of an attached scrollbar.
};
/**
@@ -476,7 +476,6 @@ public:
/* virtual */ void Draw(const Window *w);
/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y);
/* virtual */ NWidgetBase *GetWidgetOfType(WidgetType tp);
- /* virtual */ Scrollbar *FindScrollbar(Window *w, bool allow_next = true) const;
private:
NWidgetPIPContainer *child; ///< Child widget.
@@ -497,7 +496,6 @@ public:
/* virtual */ void SetupSmallestSize(Window *w, bool init_array);
/* virtual */ void Draw(const Window *w);
- /* virtual */ Scrollbar *FindScrollbar(Window *w, bool allow_next = true) const;
void InitializeViewport(Window *w, uint32 follow_flags, ZoomLevel zoom);
void UpdateViewportCoordinates(Window *w);
@@ -513,7 +511,6 @@ public:
/* virtual */ void SetupSmallestSize(Window *w, bool init_array);
/* virtual */ void Draw(const Window *w);
- /* virtual */ Scrollbar *FindScrollbar(Window *w, bool allow_next = true) const;
bool ButtonHit(const Point &pt);
@@ -812,6 +809,23 @@ static inline NWidgetPart SetPIP(uint8 pre, uint8 inter, uint8 post)
}
/**
+ * Attach a scrollbar to a widget.
+ * The scrollbar is controlled when using the mousewheel on the widget.
+ * Multipe widgets can refer to the same scrollbar to make the mousewheel work in all of them.
+ * @param index Widget index of the scrollbar.
+ * @ingroup NestedWidgetParts
+ */
+static inline NWidgetPart SetScrollbar(int index)
+{
+ NWidgetPart part;
+
+ part.type = WPT_SCROLLBAR;
+ part.u.widget.index = index;
+
+ return part;
+}
+
+/**
* Widget part function for starting a new 'real' widget.
* @param tp Type of the new nested widget.
* @param col Colour of the new widget.
diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp
index c3c99ad7a..1297ae4ca 100644
--- a/src/widgets/dropdown.cpp
+++ b/src/widgets/dropdown.cpp
@@ -75,7 +75,7 @@ enum DropdownMenuWidgets {
static const NWidgetPart _nested_dropdown_menu_widgets[] = {
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_END, DDM_ITEMS), SetMinimalSize(1, 1), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_END, DDM_ITEMS), SetMinimalSize(1, 1), SetScrollbar(DDM_SCROLL), EndContainer(),
NWidget(WWT_SCROLLBAR, COLOUR_END, DDM_SCROLL),
EndContainer(),
};
diff --git a/src/window.cpp b/src/window.cpp
index a002de09b..c20bc49f4 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -502,7 +502,7 @@ static void DispatchMouseWheelEvent(Window *w, const NWidgetCore *nwid, int whee
}
/* Scroll the widget attached to the scrollbar. */
- Scrollbar *sb = nwid->FindScrollbar(w);
+ Scrollbar *sb = (nwid->scrollbar_index >= 0 ? w->GetScrollbar(nwid->scrollbar_index) : NULL);
if (sb != NULL && sb->GetCount() > sb->GetCapacity()) {
sb->UpdatePosition(wheel);
w->SetDirty();