diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index b6ed2177ff..5bf5ec97ab 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -140,7 +140,6 @@ static const WindowDesc _air_toolbar_desc = { WC_BUILD_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _air_toolbar_widgets, - NULL }; void ShowBuildAirToolbar() @@ -282,7 +281,6 @@ static const WindowDesc _build_airport_desc = { WC_BUILD_STATION, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _build_airport_picker_widgets, - NULL }; static void ShowBuildAirportPicker() diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index 87bdabdb2a..35ca3a9242 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -533,7 +533,6 @@ static const WindowDesc _replace_rail_vehicle_desc = { WC_REPLACE_VEHICLE, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _replace_vehicle_widgets, - NULL }; static const WindowDesc _replace_vehicle_desc = { @@ -541,7 +540,6 @@ static const WindowDesc _replace_vehicle_desc = { WC_REPLACE_VEHICLE, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _replace_vehicle_widgets, - NULL }; RailType ReplaceVehicleWindow::sel_railtype = RAILTYPE_RAIL; diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index 9cee4efa5b..745d96025c 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -283,7 +283,6 @@ static const WindowDesc _build_bridge_desc = { WC_BUILD_BRIDGE, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE, _build_bridge_widgets, - NULL }; /** diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index eb7333f559..26a1dad90d 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1182,7 +1182,6 @@ static const WindowDesc _build_vehicle_desc = { WC_BUILD_VEHICLE, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, _build_vehicle_widgets, - NULL }; void ShowBuildVehicleWindow(TileIndex tile, VehicleType type) diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp index 1bb1c5eba1..67d191cb4c 100644 --- a/src/cheat_gui.cpp +++ b/src/cheat_gui.cpp @@ -226,7 +226,6 @@ static const WindowDesc _cheats_desc = { WC_CHEATS, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _cheat_widgets, - NULL }; diff --git a/src/console.cpp b/src/console.cpp index 20464a71f0..b93100825f 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -248,7 +248,6 @@ static const WindowDesc _iconsole_window_desc = { WC_CONSOLE, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _iconsole_window_widgets, - NULL, }; void IConsoleInit() diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index ef4947d34b..b755bbfb84 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -107,7 +107,6 @@ static const WindowDesc _train_depot_desc = { WC_VEHICLE_DEPOT, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _depot_widgets, - NULL }; static const WindowDesc _road_depot_desc = { @@ -115,7 +114,6 @@ static const WindowDesc _road_depot_desc = { WC_VEHICLE_DEPOT, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _depot_widgets, - NULL }; static const WindowDesc _ship_depot_desc = { @@ -123,7 +121,6 @@ static const WindowDesc _ship_depot_desc = { WC_VEHICLE_DEPOT, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _depot_widgets, - NULL }; static const WindowDesc _aircraft_depot_desc = { @@ -131,7 +128,6 @@ static const WindowDesc _aircraft_depot_desc = { WC_VEHICLE_DEPOT, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _depot_widgets, - NULL }; extern int WagonLengthToPixels(int len); diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 84cd10092b..811f2cdb15 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -226,7 +226,6 @@ static const WindowDesc _build_docks_toolbar_desc = { WC_BUILD_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _build_docks_toolb_widgets, - NULL }; void ShowBuildDocksToolbar() @@ -311,7 +310,6 @@ static const WindowDesc _build_dock_station_desc = { WC_BUILD_STATION, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _build_dock_station_widgets, - NULL }; static void ShowBuildDockStationPicker() @@ -386,7 +384,6 @@ static const WindowDesc _build_docks_depot_desc = { WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _build_docks_depot_widgets, - NULL }; diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp index ab58b729c3..b5a2c79c31 100644 --- a/src/engine_gui.cpp +++ b/src/engine_gui.cpp @@ -107,7 +107,6 @@ static const WindowDesc _engine_preview_desc = { WC_ENGINE_PREVIEW, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _engine_preview_widgets, - NULL }; diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 446762959a..6d5ab4dc0b 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -554,7 +554,6 @@ static const WindowDesc _generate_landscape_desc = { WC_GENERATE_LANDSCAPE, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _generate_landscape_widgets, - NULL, }; static const WindowDesc _heightmap_load_desc = { @@ -562,7 +561,6 @@ static const WindowDesc _heightmap_load_desc = { WC_GENERATE_LANDSCAPE, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS, _heightmap_load_widgets, - NULL, }; static void _ShowGenerateLandscape(glwp_modes mode) @@ -801,7 +799,6 @@ static const WindowDesc _create_scenario_desc = { WC_GENERATE_LANDSCAPE, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS, _create_scenario_widgets, - NULL, }; void ShowCreateScenario() @@ -823,7 +820,6 @@ static const WindowDesc _generate_progress_desc = { WC_GENERATE_PROGRESS_WINDOW, WC_NONE, WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _generate_progress_widgets, - NULL }; struct tp_info { diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index 8c5918a796..2cc1fe12db 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -101,7 +101,6 @@ static const WindowDesc _graph_legend_desc = { WC_GRAPH_LEGEND, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _graph_legend_widgets, - NULL }; static void ShowGraphLegend() @@ -442,7 +441,6 @@ static const WindowDesc _operating_profit_desc = { WC_OPERATING_PROFIT, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _operating_profit_widgets, - NULL }; @@ -482,7 +480,6 @@ static const WindowDesc _income_graph_desc = { WC_INCOME_GRAPH, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _income_graph_widgets, - NULL }; void ShowIncomeGraph() @@ -520,7 +517,6 @@ static const WindowDesc _delivered_cargo_graph_desc = { WC_DELIVERED_CARGO, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _delivered_cargo_graph_widgets, - NULL }; void ShowDeliveredCargoGraph() @@ -565,7 +561,6 @@ static const WindowDesc _performance_history_desc = { WC_PERFORMANCE_HISTORY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _performance_history_widgets, - NULL }; void ShowPerformanceHistoryGraph() @@ -603,7 +598,6 @@ static const WindowDesc _company_value_graph_desc = { WC_COMPANY_VALUE, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _company_value_graph_widgets, - NULL }; void ShowCompanyValueGraph() @@ -728,7 +722,6 @@ static const WindowDesc _cargo_payment_rates_desc = { WC_PAYMENT_RATES, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _cargo_payment_rates_widgets, - NULL }; @@ -817,7 +810,6 @@ static const WindowDesc _company_league_desc = { WC_COMPANY_LEAGUE, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _company_league_widgets, - NULL }; void ShowCompanyLeagueTable() @@ -1049,7 +1041,6 @@ static const WindowDesc _performance_rating_detail_desc = { WC_PERFORMANCE_DETAIL, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _performance_rating_detail_widgets, - NULL }; void ShowPerformanceRatingDetail() diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 65c7959fb9..d40ef46d92 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -757,7 +757,6 @@ static const WindowDesc _group_desc = { WC_TRAINS_LIST, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _group_widgets, - NULL }; void ShowPlayerGroup(PlayerID player, VehicleType vehicle_type) diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 1d8a264d39..8be5d4f5db 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -91,7 +91,6 @@ static const WindowDesc _build_industry_desc = { WC_BUILD_INDUSTRY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE, _build_industry_widgets, - NULL, }; class BuildIndustryWindow : public Window { @@ -680,7 +679,6 @@ static const WindowDesc _industry_view_desc = { WC_INDUSTRY_VIEW, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _industry_view_widgets, - NULL }; void ShowIndustryViewWindow(int industry) @@ -968,7 +966,6 @@ static const WindowDesc _industry_directory_desc = { WC_INDUSTRY_DIRECTORY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _industry_directory_widgets, - NULL }; void ShowIndustryDirectory() diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp index 97f1f6b0ac..8ff4d46dfe 100644 --- a/src/intro_gui.cpp +++ b/src/intro_gui.cpp @@ -133,7 +133,6 @@ static const WindowDesc _select_game_desc = { WC_SELECT_GAME, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _select_game_widgets, - NULL }; void ShowSelectGameWindow() diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index d78d4fe03e..4e5ea1b14c 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -69,7 +69,6 @@ static const WindowDesc _land_info_desc = { WC_LAND_INFO, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _land_info_widgets, - NULL }; class LandInfoWindow : public Window { @@ -219,7 +218,6 @@ static const WindowDesc _about_desc = { WC_GAME_OPTIONS, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _about_widgets, - NULL }; struct AboutWindow : public Window { @@ -1074,7 +1072,6 @@ static const WindowDesc _query_string_desc = { WC_QUERY_STRING, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _query_string_widgets, - NULL }; /** Show a query popup window with a textbox in it. @@ -1208,7 +1205,6 @@ static const WindowDesc _query_desc = { WC_CONFIRM_POPUP_QUERY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_UNCLICK_BUTTONS | WDF_DEF_WIDGET | WDF_MODAL, _query_widgets, - NULL }; /** Show a modal confirmation window with standard 'yes' and 'no' buttons @@ -1589,7 +1585,6 @@ static const WindowDesc _load_dialog_desc = { WC_SAVELOAD, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, _load_dialog_widgets, - NULL, }; static const WindowDesc _save_dialog_desc = { @@ -1597,7 +1592,6 @@ static const WindowDesc _save_dialog_desc = { WC_SAVELOAD, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, _save_dialog_widgets, - NULL, }; /** These values are used to convert the file/operations mode into a corresponding file type. diff --git a/src/music_gui.cpp b/src/music_gui.cpp index 73da98ed8b..060da7c670 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -351,7 +351,6 @@ static const WindowDesc _music_track_selection_desc = { WC_MUSIC_TRACK_SELECTION, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _music_track_selection_widgets, - NULL }; static void ShowMusicTrackSelection() @@ -553,7 +552,6 @@ static const WindowDesc _music_window_desc = { WC_MUSIC_WINDOW, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _music_window_widgets, - NULL }; void ShowMusicWindow() diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 49542410f1..d7081bdec0 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -642,7 +642,6 @@ static const WindowDesc _network_game_window_desc = { WC_NETWORK_WINDOW, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, _network_game_window_widgets, - NULL, }; void ShowNetworkGameWindow() @@ -977,7 +976,6 @@ static const WindowDesc _network_start_server_window_desc = { WC_NETWORK_WINDOW, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _network_start_server_window_widgets, - NULL, }; static void ShowNetworkStartServerWindow() @@ -1191,7 +1189,6 @@ static const WindowDesc _network_lobby_window_desc = { WC_NETWORK_WINDOW, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _network_lobby_window_widgets, - NULL, }; /* Show the networklobbywindow with the selected server @@ -1237,12 +1234,11 @@ static const Widget _client_list_popup_widgets[] = { { WIDGETS_END}, }; -static WindowDesc _client_list_desc = { +static const WindowDesc _client_list_desc = { WDP_AUTO, WDP_AUTO, 250, 1, 250, 1, WC_CLIENT_LIST, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _client_list_widgets, - NULL }; // Finds the Xth client-info that is active @@ -1665,7 +1661,6 @@ static const WindowDesc _network_join_status_window_desc = { WC_NETWORK_STATUS_WINDOW, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_MODAL, _network_join_status_window_widget, - NULL, }; void ShowJoinStatusWindow() @@ -1909,7 +1904,6 @@ static const WindowDesc _chat_window_desc = { WC_SEND_NETWORK_MSG, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET, _chat_window_widgets, - NULL }; void ShowNetworkChatQueryWindow(DestType type, int dest) @@ -2018,7 +2012,6 @@ static const WindowDesc _ncp_window_desc = { WC_COMPANY_PASSWORD_WINDOW, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _ncp_window_widgets, - NULL }; void ShowNetworkCompanyPasswordWindow(Window *parent) diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index da8fa65076..70b0ac6b8e 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -250,7 +250,6 @@ static const WindowDesc _newgrf_add_dlg_desc = { WC_SAVELOAD, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, _newgrf_add_dlg_widgets, - NULL, }; @@ -552,7 +551,6 @@ static const WindowDesc _newgrf_desc = { WC_GAME_OPTIONS, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, _newgrf_widgets, - NULL, }; /** Callback function for the newgrf 'apply changes' confirmation window diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 51ec297494..3b2b250a56 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -445,7 +445,6 @@ static WindowDesc _news_type13_desc = { WC_NEWS_WINDOW, WC_NONE, WDF_DEF_WIDGET, _news_type13_widgets, - NULL }; static const Widget _news_type2_widgets[] = { @@ -459,7 +458,6 @@ static WindowDesc _news_type2_desc = { WC_NEWS_WINDOW, WC_NONE, WDF_DEF_WIDGET, _news_type2_widgets, - NULL }; static const Widget _news_type0_widgets[] = { @@ -475,7 +473,6 @@ static WindowDesc _news_type0_desc = { WC_NEWS_WINDOW, WC_NONE, WDF_DEF_WIDGET, _news_type0_widgets, - NULL }; @@ -763,7 +760,6 @@ static const WindowDesc _message_history_desc = { 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, - NULL }; /** Display window with news messages history */ @@ -971,7 +967,6 @@ static const WindowDesc _message_options_desc = { WC_GAME_OPTIONS, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _message_options_widgets, - NULL }; void ShowMessageOptions() diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 82c0cbb3e6..0b90e24c0f 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -1063,7 +1063,6 @@ static const WindowDesc _orders_train_desc = { WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE, _orders_train_widgets, - NULL }; /** @@ -1104,7 +1103,6 @@ static const WindowDesc _orders_desc = { WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE, _orders_widgets, - NULL }; /** @@ -1145,7 +1143,6 @@ static const WindowDesc _other_orders_desc = { WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, _other_orders_widgets, - NULL }; void ShowOrdersWindow(const Vehicle *v) diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp index d67b7d1a0a..bd7bc16bd1 100644 --- a/src/osk_gui.cpp +++ b/src/osk_gui.cpp @@ -283,12 +283,11 @@ static const Widget _osk_widgets[] = { { WIDGETS_END}, }; -WindowDesc _osk_desc = { +static const WindowDesc _osk_desc = { WDP_CENTER, WDP_CENTER, 256, 140, 256, 140, WC_OSK, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _osk_widgets, - NULL }; /** diff --git a/src/player_gui.cpp b/src/player_gui.cpp index 211de10c9a..dd9a1b8d7b 100644 --- a/src/player_gui.cpp +++ b/src/player_gui.cpp @@ -230,7 +230,6 @@ static const WindowDesc _player_finances_desc = { WC_FINANCES, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _player_finances_widgets, - NULL }; static const WindowDesc _player_finances_small_desc = { @@ -238,7 +237,6 @@ static const WindowDesc _player_finances_small_desc = { WC_FINANCES, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _player_finances_small_widgets, - NULL }; /** @@ -543,7 +541,6 @@ static const WindowDesc _select_player_livery_desc = { WC_PLAYER_COLOR, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _select_player_livery_widgets, - NULL }; /** @@ -1010,7 +1007,6 @@ static const WindowDesc _select_player_face_desc = { WC_PLAYER_FACE, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _select_player_face_widgets, - NULL }; /** advanced player face selection window description */ @@ -1019,7 +1015,6 @@ static const WindowDesc _select_player_face_adv_desc = { WC_PLAYER_FACE, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _select_player_face_adv_widgets, - NULL }; /** @@ -1348,7 +1343,6 @@ static const WindowDesc _player_company_desc = { WC_COMPANY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _player_company_widgets, - NULL }; void ShowPlayerCompany(PlayerID player) @@ -1407,7 +1401,6 @@ static const WindowDesc _buy_company_desc = { WC_BUY_COMPANY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _buy_company_widgets, - NULL }; @@ -1578,7 +1571,6 @@ static const WindowDesc _highscore_desc = { WC_HIGHSCORE, WC_NONE, 0, _highscore_widgets, - NULL }; static const WindowDesc _endgame_desc = { @@ -1586,7 +1578,6 @@ static const WindowDesc _endgame_desc = { WC_ENDSCREEN, WC_NONE, 0, _highscore_widgets, - NULL }; /** Show the highscore table for a given difficulty. When called from diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 2e665b6b07..944b531429 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -801,7 +801,6 @@ static const WindowDesc _build_rail_desc = { WC_BUILD_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _build_rail_widgets, - NULL }; @@ -1323,7 +1322,6 @@ static const WindowDesc _station_builder_desc = { WC_BUILD_STATION, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _station_builder_widgets, - NULL }; /** High level window description of the newGRF station-build window */ @@ -1332,7 +1330,6 @@ static const WindowDesc _newstation_builder_desc = { WC_BUILD_STATION, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _newstation_builder_widgets, - NULL }; /** Open station build window */ @@ -1486,7 +1483,6 @@ static const WindowDesc _signal_builder_desc = { WC_BUILD_SIGNAL, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _signal_builder_widgets, - NULL }; /** @@ -1561,7 +1557,6 @@ static const WindowDesc _build_depot_desc = { WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _build_depot_widgets, - NULL }; static void ShowBuildTrainDepotPicker() @@ -1663,7 +1658,6 @@ static const WindowDesc _build_waypoint_desc = { WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _build_waypoint_widgets, - NULL }; static void ShowBuildWaypointPicker() diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 8611e8cacc..f46f9811cd 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -643,7 +643,6 @@ static const WindowDesc _build_road_desc = { WC_BUILD_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _build_road_widgets, - NULL }; /** Widget definition of the build tram toolbar */ @@ -672,7 +671,6 @@ static const WindowDesc _build_tramway_desc = { WC_BUILD_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _build_tramway_widgets, - NULL }; void ShowBuildRoadToolbar(RoadType roadtype) @@ -709,7 +707,6 @@ static const WindowDesc _build_road_scen_desc = { WC_SCEN_BUILD_ROAD, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _build_road_scen_widgets, - NULL }; void ShowBuildRoadScenToolbar() @@ -789,7 +786,6 @@ static const WindowDesc _build_road_depot_desc = { WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _build_road_depot_widgets, - NULL }; static void ShowRoadDepotPicker() @@ -932,7 +928,6 @@ static const WindowDesc _rv_station_picker_desc = { WC_BUS_STATION, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _rv_station_picker_widgets, - NULL }; static void ShowRVStationPicker(RoadStopType rs) diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 8a7b5e42f9..2dc563b542 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -349,7 +349,6 @@ static const WindowDesc _game_options_desc = { WC_GAME_OPTIONS, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _game_options_widgets, - NULL }; @@ -468,7 +467,6 @@ static const WindowDesc _game_difficulty_desc = { WC_GAME_OPTIONS, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _game_difficulty_widgets, - NULL }; struct GameDifficultyWindow : public Window { @@ -1064,7 +1062,6 @@ static const WindowDesc _patches_selection_desc = { WC_GAME_OPTIONS, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _patches_selection_widgets, - NULL, }; void ShowPatchesSelection() @@ -1295,7 +1292,6 @@ static const WindowDesc _cust_currency_desc = { WC_CUSTOM_CURRENCY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _cust_currency_widgets, - NULL, }; static void ShowCustCurrency() diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index 7ce8072f73..8a9aae2411 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -139,7 +139,6 @@ static const WindowDesc _sign_list_desc = { WC_SIGN_LIST, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE, _sign_list_widget, - NULL }; @@ -300,7 +299,6 @@ static const WindowDesc _query_sign_edit_desc = { WC_QUERY_STRING, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _query_sign_edit_widgets, - NULL }; void ShowRenameSignWindow(const Sign *si) diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index 0d25b28b58..2094397ed7 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -1078,7 +1078,6 @@ static const WindowDesc _smallmap_desc = { WC_SMALLMAP, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE, _smallmap_widgets, - NULL }; void ShowSmallMap() @@ -1224,7 +1223,6 @@ static const WindowDesc _extra_view_port_desc = { WC_EXTRA_VIEW_PORT, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _extra_view_port_widgets, - NULL }; void ShowExtraViewPortWindow(TileIndex tile) diff --git a/src/station_gui.cpp b/src/station_gui.cpp index d9535480ca..ba2abc5ee5 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -615,7 +615,6 @@ static const WindowDesc _player_stations_desc = { WC_STATION_LIST, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE, _player_stations_widgets, - NULL }; /** @@ -987,7 +986,6 @@ static const WindowDesc _station_view_desc = { WC_STATION_VIEW, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _station_view_widgets, - NULL }; /** diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp index aa3a3c90ca..8f2b46b4e7 100644 --- a/src/statusbar_gui.cpp +++ b/src/statusbar_gui.cpp @@ -168,7 +168,6 @@ static WindowDesc _main_status_desc = { WC_STATUS_BAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _main_status_widgets, - NULL }; /** diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp index d4b41bedb2..ed03ba1a49 100644 --- a/src/subsidy_gui.cpp +++ b/src/subsidy_gui.cpp @@ -179,7 +179,6 @@ static const WindowDesc _subsidies_list_desc = { WC_SUBSIDIES_LIST, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE, _subsidies_list_widgets, - NULL }; diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 44d112eb37..49c87b642d 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -313,7 +313,6 @@ static const WindowDesc _terraform_desc = { WC_SCEN_LAND_GEN, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _terraform_widgets, - NULL }; void ShowTerraformToolbar(Window *link) @@ -692,7 +691,6 @@ static const WindowDesc _scen_edit_land_gen_desc = { WC_SCEN_LAND_GEN, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _scen_edit_land_gen_widgets, - NULL, }; void ShowEditorTerraformToolbar() diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index 70a72bef3a..0052a5f092 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -298,7 +298,6 @@ static const WindowDesc _timetable_desc = { WC_VEHICLE_TIMETABLE, WC_VEHICLE_VIEW, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _timetable_widgets, - NULL }; void ShowTimetableWindow(const Vehicle *v) diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index d555a94c15..5f977a2ad0 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -858,7 +858,6 @@ static const WindowDesc _toolb_normal_desc = { WC_MAIN_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET, _toolb_normal_widgets, - NULL }; @@ -1107,7 +1106,6 @@ static const WindowDesc _toolb_scen_desc = { WC_MAIN_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _toolb_scen_widgets, - NULL }; /* --- Rendering/handling the drop down menus --- */ diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 1b7f186abf..1afbf2d6f9 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -264,7 +264,6 @@ static const WindowDesc _town_authority_desc = { WC_TOWN_AUTHORITY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _town_authority_widgets, - NULL }; static void ShowTownAuthorityWindow(uint town) @@ -397,7 +396,6 @@ static const WindowDesc _town_view_desc = { WC_TOWN_VIEW, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _town_view_widgets, - NULL }; void ShowTownViewWindow(TownID town) @@ -583,7 +581,6 @@ static const WindowDesc _town_directory_desc = { 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, - NULL }; void ShowTownDirectory() @@ -710,7 +707,6 @@ static const WindowDesc _scen_edit_town_gen_desc = { WC_SCEN_TOWN_GEN, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _scen_edit_town_gen_widgets, - NULL, }; void ShowBuildTownWindow() diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp index 33ace78987..8f9954e011 100644 --- a/src/transparency_gui.cpp +++ b/src/transparency_gui.cpp @@ -125,7 +125,6 @@ static const WindowDesc _transparency_desc = { WC_TRANSPARENCY_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _transparency_widgets, - NULL }; void ShowTransparencyToolbar(void) diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp index f1c6d4b061..410d4724d3 100644 --- a/src/tree_gui.cpp +++ b/src/tree_gui.cpp @@ -175,7 +175,6 @@ static const WindowDesc _build_trees_desc = { WC_BUILD_TREES, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _build_trees_widgets, - NULL }; void ShowBuildTreesToolbar() diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index f1b649c54d..1e8af36afe 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -432,7 +432,6 @@ static const WindowDesc _vehicle_refit_desc = { WC_VEHICLE_REFIT, WC_VEHICLE_VIEW, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, _vehicle_refit_widgets, - NULL }; /** Show the refit window for a vehicle @@ -1158,7 +1157,6 @@ static const WindowDesc _player_vehicle_list_train_desc = { WC_TRAINS_LIST, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _vehicle_list_widgets, - NULL }; static const WindowDesc _player_vehicle_list_road_veh_desc = { @@ -1166,7 +1164,6 @@ static const WindowDesc _player_vehicle_list_road_veh_desc = { WC_ROADVEH_LIST, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _vehicle_list_widgets, - NULL }; static const WindowDesc _player_vehicle_list_ship_desc = { @@ -1174,7 +1171,6 @@ static const WindowDesc _player_vehicle_list_ship_desc = { WC_SHIPS_LIST, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _vehicle_list_widgets, - NULL }; static const WindowDesc _player_vehicle_list_aircraft_desc = { @@ -1182,7 +1178,6 @@ static const WindowDesc _player_vehicle_list_aircraft_desc = { WC_AIRCRAFT_LIST, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _vehicle_list_widgets, - NULL }; static void ShowVehicleListWindowLocal(PlayerID player, uint16 VLW_flag, VehicleType vehicle_type, uint16 unique_number) @@ -1613,7 +1608,6 @@ static const WindowDesc _vehicle_details_desc = { WC_VEHICLE_DETAILS, WC_VEHICLE_VIEW, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, _vehicle_details_widgets, - NULL }; /** Shows the vehicle details window of the given vehicle. */ @@ -1655,7 +1649,6 @@ static const WindowDesc _vehicle_view_desc = { WC_VEHICLE_VIEW, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _vehicle_view_widgets, - NULL }; /** Vehicle view window descriptor for trains. Only minimum_height and @@ -1666,7 +1659,6 @@ static const WindowDesc _train_view_desc = { WC_VEHICLE_VIEW, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _vehicle_view_widgets, - NULL }; diff --git a/src/window.cpp b/src/window.cpp index 4f5e1cc7aa..0416d6a22b 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -48,169 +48,6 @@ bool _scrolling_viewport; byte _special_mouse_mode; -/** - * Call the window event handler for handling event \a e. - * This is a temporary helper functions that will be removed - * once all windows that still rely on WindowEvent and - * WindowEventCodes have been rewritten to use the 'OnXXX' - * event handlers. - * @param e Window event to handle - */ -void Window::HandleWindowEvent(WindowEvent *e) -{ - if (wndproc != NULL) wndproc(this, e); -} - -void Window::OnPaint() -{ - WindowEvent e; - e.event = WE_PAINT; - this->HandleWindowEvent(&e); -} - -Window::EventState Window::OnKeyPress(uint16 key, uint16 keycode) -{ - WindowEvent e; - e.event = WE_KEYPRESS; - e.we.keypress.key = key; - e.we.keypress.keycode = keycode; - e.we.keypress.cont = true; - this->HandleWindowEvent(&e); - - return e.we.keypress.cont ? ES_NOT_HANDLED : ES_HANDLED; -} - -Window::EventState Window::OnCTRLStateChange() -{ - WindowEvent e; - e.event = WE_CTRL_CHANGED; - e.we.ctrl.cont = true; - this->HandleWindowEvent(&e); - - return e.we.ctrl.cont ? ES_NOT_HANDLED : ES_HANDLED; -} - -void Window::OnClick(Point pt, int widget) -{ - WindowEvent e; - e.event = WE_CLICK; - e.we.click.pt = pt; - e.we.click.widget = widget; - this->HandleWindowEvent(&e); -} - -void Window::OnMouseLoop() -{ - WindowEvent e; - e.event = WE_MOUSELOOP; - this->HandleWindowEvent(&e); -} - -void Window::OnTick() -{ - WindowEvent e; - e.event = WE_TICK; - this->HandleWindowEvent(&e); -} - -void Window::OnHundredthTick() -{ - WindowEvent e; - e.event = WE_100_TICKS; - this->HandleWindowEvent(&e); -} - -void Window::OnTimeout() -{ - WindowEvent e; - e.event = WE_TIMEOUT; - this->HandleWindowEvent(&e); -} - -void Window::OnResize(Point new_size, Point delta) -{ - WindowEvent e; - e.event = WE_RESIZE; - e.we.sizing.size = new_size; - e.we.sizing.diff = delta; - this->HandleWindowEvent(&e); -} - -void Window::OnDropdownSelect(int widget, int index) -{ - WindowEvent e; - e.event = WE_DROPDOWN_SELECT; - e.we.dropdown.button = widget; - e.we.dropdown.index = index; - this->HandleWindowEvent(&e); -} - -void Window::OnQueryTextFinished(char *str) -{ - WindowEvent e; - e.event = WE_ON_EDIT_TEXT; - e.we.edittext.str = str; - this->HandleWindowEvent(&e); -} - -void Window::OnInvalidateData(int data) -{ - WindowEvent e; - e.event = WE_INVALIDATE_DATA; - e.we.invalidate.data = data; - this->HandleWindowEvent(&e); -} - -void Window::OnPlaceObject(Point pt, TileIndex tile) -{ - WindowEvent e; - e.event = WE_PLACE_OBJ; - e.we.place.pt = pt; - e.we.place.tile = tile; - this->HandleWindowEvent(&e); -} - -void Window::OnPlaceObjectAbort() -{ - WindowEvent e; - e.event = WE_ABORT_PLACE_OBJ; - this->HandleWindowEvent(&e); -} - - -void Window::OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) -{ - WindowEvent e; - e.event = WE_PLACE_DRAG; - e.we.place.select_method = select_method; - e.we.place.select_proc = select_proc; - e.we.place.pt = pt; - this->HandleWindowEvent(&e); -} - -void Window::OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) -{ - WindowEvent e; - e.event = WE_PLACE_MOUSEUP; - e.we.place.select_method = select_method; - e.we.place.select_proc = select_proc; - e.we.place.pt = pt; - e.we.place.tile = end_tile; - e.we.place.starttile = start_tile; - this->HandleWindowEvent(&e); -} - -void Window::OnPlacePresize(Point pt, TileIndex tile) -{ - WindowEvent e; - e.event = WE_PLACE_PRESIZE; - e.we.place.pt = pt; - e.we.place.tile = tile; - this->HandleWindowEvent(&e); -} - - - void CDECL Window::SetWidgetsDisabledState(bool disab_stat, int widgets, ...) { va_list wdg_list; @@ -581,9 +418,6 @@ Window::~Window() child = FindChildWindow(this); } - WindowEvent e; - e.event = WE_DESTROY; - this->HandleWindowEvent(&e); if (this->viewport != NULL) DeleteWindowViewport(this); this->SetDirty(); @@ -831,14 +665,13 @@ static void AssignWidgetToWindow(Window *w, const Widget *widget) * @param y offset in pixels from the top of the screen * @param min_width minimum width in pixels of the window * @param min_height minimum height in pixels of the window - * @param *proc see WindowProc function to call when any messages/updates happen to the window * @param cls see WindowClass class of the window, used for identification and grouping * @param *widget see Widget pointer to the window layout and various elements * @param window_number number being assigned to the new window * @return Window pointer of the newly created window */ void Window::Initialize(int x, int y, int min_width, int min_height, - WindowProc *proc, WindowClass cls, const Widget *widget, int window_number) + WindowClass cls, const Widget *widget, int window_number) { /* We have run out of windows, close one and use that as the place for our new one */ if (_last_z_window == endof(_z_windows)) { @@ -855,7 +688,6 @@ void Window::Initialize(int x, int y, int min_width, int min_height, this->top = y; this->width = min_width; this->height = min_height; - this->wndproc = proc; AssignWidgetToWindow(this, widget); this->resize.width = min_width; this->resize.height = min_height; @@ -884,10 +716,6 @@ void Window::Initialize(int x, int y, int min_width, int min_height, *wz = this; _last_z_window++; - - WindowEvent e; - e.event = WE_CREATE; - this->HandleWindowEvent(&e); } /** @@ -969,7 +797,7 @@ void Window::FindWindowPlacementAndResize(const WindowDesc *desc) */ Window::Window(int x, int y, int width, int height, WindowClass cls, const Widget *widget) { - this->Initialize(x, y, width, height, NULL, cls, widget, 0); + this->Initialize(x, y, width, height, cls, widget, 0); } @@ -1161,10 +989,8 @@ static Point LocalGetWindowPlacement(const WindowDesc *desc, int window_number) Window::Window(const WindowDesc *desc, WindowNumber window_number) { Point pt = LocalGetWindowPlacement(desc, window_number); - this->Initialize(pt.x, pt.y, desc->minimum_width, desc->minimum_height, desc->proc, desc->cls, desc->widgets, window_number); + this->Initialize(pt.x, pt.y, desc->minimum_width, desc->minimum_height, desc->cls, desc->widgets, window_number); this->desc_flags = desc->flags; - - if (desc->proc != NULL) this->FindWindowPlacementAndResize(desc->default_width, desc->default_height); } /** Do a search for a window at specific coordinates. For this we start diff --git a/src/window_gui.h b/src/window_gui.h index 66ce5a0eb7..bc2df770db 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -103,88 +103,6 @@ DECLARE_ENUM_AS_BIT_SET(FrameFlags); /* wiget.cpp */ void DrawFrameRect(int left, int top, int right, int bottom, int color, FrameFlags flags); -/** - * Available window events - */ -enum WindowEventCodes { - WE_CREATE, ///< Initialize the Window - WE_DESTROY, ///< Prepare for deletion of the window - WE_PAINT, ///< Repaint the window contents - WE_KEYPRESS, ///< Key pressed - WE_CLICK, ///< Left mouse button click - WE_MOUSELOOP, ///< Event for each mouse event in the game (at least once every game tick) - WE_TICK, ///< Regularly occurring event (every game tick) - WE_100_TICKS, ///< Regularly occurring event (every 100 game ticks, approximatelly 3 seconds) - WE_TIMEOUT, - WE_PLACE_OBJ, - WE_ABORT_PLACE_OBJ, - WE_ON_EDIT_TEXT, - WE_PLACE_DRAG, - WE_PLACE_MOUSEUP, - WE_PLACE_PRESIZE, - WE_DROPDOWN_SELECT, - WE_RESIZE, ///< Request to resize the window, @see WindowEvent.we.resize - WE_INVALIDATE_DATA, ///< Notification that data displayed by the window is obsolete - WE_CTRL_CHANGED, ///< CTRL key has changed state -}; - -/** - * Data structures for additional data associated with a window event - * @see WindowEventCodes - */ -struct WindowEvent { - byte event; - union { - struct { - Point pt; - int widget; - } click; - - struct { - Point pt; - TileIndex tile; - TileIndex starttile; - ViewportPlaceMethod select_method; - ViewportDragDropSelectionProcess select_proc; - } place; - - struct { - Point pt; - int widget; - } dragdrop; - - struct { - Point size; - Point diff; - } sizing; - - struct { - char *str; - } edittext; - - struct { - int button; - int index; - } dropdown; - - struct { - bool cont; ///< continue the search? (default true) - uint16 key; ///< 16-bit Unicode value of the key - uint16 keycode; ///< untranslated key (including shift-state) - } keypress; - - struct { - int data; - } invalidate; - - struct { - bool cont; ///< continue the search? (default true) - } ctrl; - } we; -}; - -typedef void WindowProc(Window *w, WindowEvent *e); - /** * High level window description */ @@ -199,7 +117,6 @@ struct WindowDesc { WindowClass parent_cls; ///< Class of the parent window, @see WindowClass uint32 flags; ///< Flags, @see WindowDefaultFlags const Widget *widgets; ///< List of widgets with their position and size for the window - WindowProc *proc; ///< Window event handler function for the window }; /** @@ -271,13 +188,9 @@ struct Window : ZeroedMemoryAllocator { ES_NOT_HANDLED, }; -private: - WindowProc *wndproc; ///< Event handler function for the window. Do not use directly, call HandleWindowEvent() instead. - void HandleWindowEvent(WindowEvent *e); - protected: void Initialize(int x, int y, int min_width, int min_height, - WindowProc *proc, WindowClass cls, const Widget *widget, int window_number); + WindowClass cls, const Widget *widget, int window_number); void FindWindowPlacementAndResize(int def_width, int def_height); void FindWindowPlacementAndResize(const WindowDesc *desc); @@ -343,7 +256,7 @@ public: /** * This window is currently being repainted. */ - virtual void OnPaint(); + virtual void OnPaint() {} /** @@ -353,14 +266,14 @@ public: * @return ES_HANDLED if the key press has been handled and no other * window should receive the event. */ - virtual EventState OnKeyPress(uint16 key, uint16 keycode); + virtual EventState OnKeyPress(uint16 key, uint16 keycode) { return ES_NOT_HANDLED; } /** * The state of the control key has changed * @return ES_HANDLED if the change has been handled and no other * window should receive the event. */ - virtual EventState OnCTRLStateChange(); + virtual EventState OnCTRLStateChange() { return ES_NOT_HANDLED; } /** @@ -368,7 +281,7 @@ public: * @param pt the point inside the window that has been clicked. * @param widget the clicked widget. */ - virtual void OnClick(Point pt, int widget); + virtual void OnClick(Point pt, int widget) {} /** * A double click with the left mouse button has been made on the window. @@ -415,22 +328,22 @@ public: /** * Called for every mouse loop run, which is at least once per (game) tick. */ - virtual void OnMouseLoop(); + virtual void OnMouseLoop() {} /** * Called once per (game) tick. */ - virtual void OnTick(); + virtual void OnTick() {} /** * Called once every 100 (game) ticks. */ - virtual void OnHundredthTick(); + virtual void OnHundredthTick() {} /** * Called when this window's timeout has been reached. */ - virtual void OnTimeout(); + virtual void OnTimeout() {} /** @@ -438,27 +351,27 @@ public: * @param new_size the new size of the window. * @param delta the amount of which the window size changed. */ - virtual void OnResize(Point new_size, Point delta); + virtual void OnResize(Point new_size, Point delta) {} /** * A dropdown option associated to this window has been selected. * @param widget the widget (button) that the dropdown is associated with. * @param index the element in the dropdown that is selected. */ - virtual void OnDropdownSelect(int widget, int index); + virtual void OnDropdownSelect(int widget, int index) {} /** * The query window opened from this window has closed. * @param str the new value of the string or NULL if the window * was cancelled. */ - virtual void OnQueryTextFinished(char *str); + virtual void OnQueryTextFinished(char *str) {} /** * Some data on this window has become invalid. * @param data information about the changed data. */ - virtual void OnInvalidateData(int data = 0); + virtual void OnInvalidateData(int data = 0) {} /** @@ -467,12 +380,12 @@ public: * @param pt the exact point on the map that has been clicked. * @param tile the tile on the map that has been clicked. */ - virtual void OnPlaceObject(Point pt, TileIndex tile); + virtual void OnPlaceObject(Point pt, TileIndex tile) {} /** * The user cancelled a tile highlight mode that has been set. */ - virtual void OnPlaceObjectAbort(); + virtual void OnPlaceObjectAbort() {} /** @@ -482,7 +395,7 @@ public: * @param select_proc what will be created when the drag is over. * @param pt the exact point on the map where the mouse is. */ - virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt); + virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) {} /** * The user has dragged over the map when the tile highlight mode @@ -493,7 +406,7 @@ public: * @param start_tile the begin tile of the drag. * @param end_tile the end tile of the drag. */ - virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile); + virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) {} /** * The user moves over the map when a tile highlight mode has been set @@ -502,7 +415,7 @@ public: * @param pt the exact point on the map where the mouse is. * @param tile the tile on the map where the mouse is. */ - virtual void OnPlacePresize(Point pt, TileIndex tile); + virtual void OnPlacePresize(Point pt, TileIndex tile) {} /*** End of the event handling ***/ };