diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/airport_gui.cpp | 20 | ||||
-rw-r--r-- | src/autoreplace_gui.cpp | 4 | ||||
-rw-r--r-- | src/build_vehicle_gui.cpp | 2 | ||||
-rw-r--r-- | src/depot_gui.cpp | 16 | ||||
-rw-r--r-- | src/dock_gui.cpp | 14 | ||||
-rw-r--r-- | src/genworld_gui.cpp | 64 | ||||
-rw-r--r-- | src/graph_gui.cpp | 36 | ||||
-rw-r--r-- | src/group_gui.cpp | 12 | ||||
-rw-r--r-- | src/industry_gui.cpp | 2 | ||||
-rw-r--r-- | src/intro_gui.cpp | 12 | ||||
-rw-r--r-- | src/main_gui.cpp | 74 | ||||
-rw-r--r-- | src/misc_gui.cpp | 12 | ||||
-rw-r--r-- | src/music_gui.cpp | 10 | ||||
-rw-r--r-- | src/network/network_gui.cpp | 14 | ||||
-rw-r--r-- | src/newgrf_gui.cpp | 16 | ||||
-rw-r--r-- | src/news_gui.cpp | 8 | ||||
-rw-r--r-- | src/order_gui.cpp | 56 | ||||
-rw-r--r-- | src/player_gui.cpp | 90 | ||||
-rw-r--r-- | src/rail_gui.cpp | 106 | ||||
-rw-r--r-- | src/road_gui.cpp | 54 | ||||
-rw-r--r-- | src/settings_gui.cpp | 36 | ||||
-rw-r--r-- | src/signs_gui.cpp | 2 | ||||
-rw-r--r-- | src/smallmap_gui.cpp | 30 | ||||
-rw-r--r-- | src/station_gui.cpp | 66 | ||||
-rw-r--r-- | src/timetable_gui.cpp | 26 | ||||
-rw-r--r-- | src/town_gui.cpp | 4 | ||||
-rw-r--r-- | src/transparency_gui.cpp | 2 | ||||
-rw-r--r-- | src/vehicle_gui.cpp | 46 | ||||
-rw-r--r-- | src/viewport.cpp | 4 | ||||
-rw-r--r-- | src/widget.cpp | 16 | ||||
-rw-r--r-- | src/window.cpp | 16 |
31 files changed, 435 insertions, 435 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index adb391ca0..a65c54504 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -145,9 +145,9 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e) { switch (e->event) { case WE_CREATE: - SetWindowWidgetLoweredState(w, 16, !_station_show_coverage); - SetWindowWidgetLoweredState(w, 17, _station_show_coverage); - LowerWindowWidget(w, _selected_airport_type + 7); + w->SetWidgetLoweredState(16, !_station_show_coverage); + w->SetWidgetLoweredState(17, _station_show_coverage); + w->LowerWidget(_selected_airport_type + 7); break; case WE_PAINT: { @@ -159,10 +159,10 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e) avail_airports = GetValidAirports(); - RaiseWindowWidget(w, _selected_airport_type + 7); + w->RaiseWidget(_selected_airport_type + 7); if (!HasBit(avail_airports, 0) && _selected_airport_type == AT_SMALL) _selected_airport_type = AT_LARGE; if (!HasBit(avail_airports, 1) && _selected_airport_type == AT_LARGE) _selected_airport_type = AT_SMALL; - LowerWindowWidget(w, _selected_airport_type + 7); + w->LowerWidget(_selected_airport_type + 7); /* 'Country Airport' starts at widget 7, and if its bit is set, it is * available, so take its opposite value to set the disabled state. @@ -170,7 +170,7 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e) * XXX TODO : all airports should be held in arrays, with all relevant data. * This should be part of newgrf-airports, i suppose */ - for (i = 0; i < 9; i++) SetWindowWidgetDisabledState(w, i + 7, !HasBit(avail_airports, i)); + for (i = 0; i < 9; i++) w->SetWidgetDisabledState(i + 7, !HasBit(avail_airports, i)); // select default the coverage area to 'Off' (16) airport = GetAirport(_selected_airport_type); @@ -190,16 +190,16 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e) case WE_CLICK: { switch (e->we.click.widget) { case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: - RaiseWindowWidget(w, _selected_airport_type + 7); + w->RaiseWidget(_selected_airport_type + 7); _selected_airport_type = e->we.click.widget - 7; - LowerWindowWidget(w, _selected_airport_type + 7); + w->LowerWidget(_selected_airport_type + 7); SndPlayFx(SND_15_BEEP); SetWindowDirty(w); break; case 16: case 17: _station_show_coverage = (e->we.click.widget != 16); - SetWindowWidgetLoweredState(w, 16, !_station_show_coverage); - SetWindowWidgetLoweredState(w, 17, _station_show_coverage); + w->SetWidgetLoweredState(16, !_station_show_coverage); + w->SetWidgetLoweredState(17, _station_show_coverage); SndPlayFx(SND_15_BEEP); SetWindowDirty(w); break; diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index ee415140d..38362f8f6 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -249,7 +249,7 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e) * Either list is empty * or The selected replacement engine has a replacement (to prevent loops) * or The right list (new replacement) has the existing replacement vehicle selected */ - SetWindowWidgetDisabledState(w, 4, + w->SetWidgetDisabledState(4, selected_id[0] == INVALID_ENGINE || selected_id[1] == INVALID_ENGINE || EngineReplacementForPlayer(p, selected_id[1], selected_group) != INVALID_ENGINE || @@ -258,7 +258,7 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e) /* Disable the "Stop Replacing" button if: * The left list (existing vehicle) is empty * or The selected vehicle has no replacement set up */ - SetWindowWidgetDisabledState(w, 6, + w->SetWidgetDisabledState(6, selected_id[0] == INVALID_ENGINE || !EngineHasReplacementForPlayer(p, selected_id[0], selected_group)); diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 3e40584ea..81c6652d4 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -888,7 +888,7 @@ static void DrawBuildVehicleWindow(Window *w) const buildvehicle_d *bv = &WP(w, buildvehicle_d); uint max = min(w->vscroll.pos + w->vscroll.cap, EngList_Count(&bv->eng_list)); - SetWindowWidgetDisabledState(w, BUILD_VEHICLE_WIDGET_BUILD, w->window_number <= VEH_END); + w->SetWidgetDisabledState(BUILD_VEHICLE_WIDGET_BUILD, w->window_number <= VEH_END); SetVScrollCount(w, EngList_Count(&bv->eng_list)); SetDParam(0, bv->filter.railtype + STR_881C_NEW_RAIL_VEHICLES); // This should only affect rail vehicles diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 0fe361861..e61765762 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -216,7 +216,7 @@ static void DrawDepotWindow(Window *w) uint16 boxes_in_each_row = w->widget[DEPOT_WIDGET_MATRIX].data & 0xFF; /* setup disabled buttons */ - SetWindowWidgetsDisabledState(w, !IsTileOwner(tile, _local_player), + w->SetWidgetsDisabledState(!IsTileOwner(tile, _local_player), DEPOT_WIDGET_STOP_ALL, DEPOT_WIDGET_START_ALL, DEPOT_WIDGET_SELL, @@ -724,7 +724,7 @@ static void CreateDepotListWindow(Window *w, VehicleType type) + (type == VEH_TRAIN ? 1 : w->hscroll.cap); // number of boxes in each row. Trains always have just one - SetWindowWidgetsHiddenState(w, type != VEH_TRAIN, + w->SetWidgetsHiddenState(type != VEH_TRAIN, DEPOT_WIDGET_H_SCROLL, DEPOT_WIDGET_SELL_CHAIN, WIDGET_LIST_END); @@ -795,9 +795,9 @@ static void DepotWndProc(Window *w, WindowEvent *e) case DEPOT_WIDGET_CLONE: // Clone button InvalidateWidget(w, DEPOT_WIDGET_CLONE); - ToggleWidgetLoweredState(w, DEPOT_WIDGET_CLONE); + w->ToggleWidgetLoweredState(DEPOT_WIDGET_CLONE); - if (IsWindowWidgetLowered(w, DEPOT_WIDGET_CLONE)) { + if (w->IsWidgetLowered(DEPOT_WIDGET_CLONE)) { static const CursorID clone_icons[] = { SPR_CURSOR_CLONE_TRAIN, SPR_CURSOR_CLONE_ROADVEH, SPR_CURSOR_CLONE_SHIP, SPR_CURSOR_CLONE_AIRPLANE @@ -855,7 +855,7 @@ static void DepotWndProc(Window *w, WindowEvent *e) } break; case WE_ABORT_PLACE_OBJ: { - RaiseWindowWidget(w, DEPOT_WIDGET_CLONE); + w->RaiseWidget(DEPOT_WIDGET_CLONE); InvalidateWidget(w, DEPOT_WIDGET_CLONE); } break; @@ -864,7 +864,7 @@ static void DepotWndProc(Window *w, WindowEvent *e) const Vehicle *v = _place_clicked_vehicle; /* since OTTD checks all open depot windows, we will make sure that it triggers the one with a clicked clone button */ - if (v != NULL && IsWindowWidgetLowered(w, DEPOT_WIDGET_CLONE)) { + if (v != NULL && w->IsWidgetLowered(DEPOT_WIDGET_CLONE)) { _place_clicked_vehicle = NULL; HandleCloneVehClick(v, w); } @@ -906,14 +906,14 @@ static void DepotWndProc(Window *w, WindowEvent *e) } break; case DEPOT_WIDGET_SELL: case DEPOT_WIDGET_SELL_CHAIN: - if (!IsWindowWidgetDisabled(w, DEPOT_WIDGET_SELL) && + if (!w->IsWidgetDisabled(DEPOT_WIDGET_SELL) && WP(w, depot_d).sel != INVALID_VEHICLE) { Vehicle *v; uint command; int sell_cmd; bool is_engine; - if (IsWindowWidgetDisabled(w, e->we.click.widget)) return; + if (w->IsWidgetDisabled(e->we.click.widget)) return; if (WP(w, depot_d).sel == INVALID_VEHICLE) return; HandleButtonClick(w, e->we.click.widget); diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 64822ea3f..2d42afb33 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -128,7 +128,7 @@ static void BuildDocksToolbWndProc(Window *w, WindowEvent *e) switch (e->event) { case WE_PAINT: DrawWindowWidgets(w); - SetWindowWidgetsDisabledState(w, !CanBuildVehicleInfrastructure(VEH_SHIP), 7, 8, 9, WIDGET_LIST_END); + w->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_SHIP), 7, 8, 9, WIDGET_LIST_END); break; case WE_CLICK: @@ -237,7 +237,7 @@ void ShowBuildDocksToolbar() static void BuildDockStationWndProc(Window *w, WindowEvent *e) { switch (e->event) { - case WE_CREATE: LowerWindowWidget(w, _station_show_coverage + 3); break; + case WE_CREATE: w->LowerWidget(_station_show_coverage + 3); break; case WE_PAINT: { int rad = (_patches.modified_catchment) ? CA_DOCK : 4; @@ -259,9 +259,9 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e) switch (e->we.click.widget) { case 3: case 4: - RaiseWindowWidget(w, _station_show_coverage + 3); + w->RaiseWidget(_station_show_coverage + 3); _station_show_coverage = (e->we.click.widget != 3); - LowerWindowWidget(w, _station_show_coverage + 3); + w->LowerWidget(_station_show_coverage + 3); SndPlayFx(SND_15_BEEP); SetWindowDirty(w); break; @@ -318,7 +318,7 @@ static void UpdateDocksDirection() static void BuildDocksDepotWndProc(Window *w, WindowEvent *e) { switch (e->event) { - case WE_CREATE: LowerWindowWidget(w, _ship_depot_direction + 3); break; + case WE_CREATE: w->LowerWidget(_ship_depot_direction + 3); break; case WE_PAINT: DrawWindowWidgets(w); @@ -333,9 +333,9 @@ static void BuildDocksDepotWndProc(Window *w, WindowEvent *e) switch (e->we.click.widget) { case 3: case 4: - RaiseWindowWidget(w, _ship_depot_direction + 3); + w->RaiseWidget(_ship_depot_direction + 3); _ship_depot_direction = (e->we.click.widget == 3 ? AXIS_X : AXIS_Y); - LowerWindowWidget(w, _ship_depot_direction + 3); + w->LowerWidget(_ship_depot_direction + 3); SndPlayFx(SND_15_BEEP); UpdateDocksDirection(); SetWindowDirty(w); diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 75ca16c64..4da42dab7 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -228,7 +228,7 @@ static void GenerateLandscapeWndProc(Window *w, WindowEvent *e) switch (e->event) { case WE_CREATE: - LowerWindowWidget(w, _opt_newgame.landscape + GLAND_TEMPERATE); + w->LowerWidget(_opt_newgame.landscape + GLAND_TEMPERATE); snprintf(_genseed_buffer, sizeof(_genseed_buffer), "%u", _patches_newgame.generation_seed); InitializeTextBuffer(&_genseed_query.text, _genseed_buffer, lengthof(_genseed_buffer), 120); @@ -239,28 +239,28 @@ static void GenerateLandscapeWndProc(Window *w, WindowEvent *e) case WE_PAINT: /* You can't select smoothness if not terragenesis */ if (mode == GLWP_GENERATE) { - SetWindowWidgetDisabledState(w, GLAND_SMOOTHNESS_TEXT, _patches_newgame.land_generator == 0); - SetWindowWidgetDisabledState(w, GLAND_SMOOTHNESS_PULLDOWN, _patches_newgame.land_generator == 0); + w->SetWidgetDisabledState(GLAND_SMOOTHNESS_TEXT, _patches_newgame.land_generator == 0); + w->SetWidgetDisabledState(GLAND_SMOOTHNESS_PULLDOWN, _patches_newgame.land_generator == 0); } /* Disable snowline if not hilly */ - SetWindowWidgetDisabledState(w, GLAND_SNOW_LEVEL_TEXT, _opt_newgame.landscape != LT_ARCTIC); + w->SetWidgetDisabledState(GLAND_SNOW_LEVEL_TEXT, _opt_newgame.landscape != LT_ARCTIC); /* Disable town, industry and trees in SE */ - SetWindowWidgetDisabledState(w, GLAND_TOWN_TEXT, _game_mode == GM_EDITOR); - SetWindowWidgetDisabledState(w, GLAND_TOWN_PULLDOWN, _game_mode == GM_EDITOR); - SetWindowWidgetDisabledState(w, GLAND_INDUSTRY_TEXT, _game_mode == GM_EDITOR); - SetWindowWidgetDisabledState(w, GLAND_INDUSTRY_PULLDOWN, _game_mode == GM_EDITOR); - SetWindowWidgetDisabledState(w, GLAND_TREE_TEXT, _game_mode == GM_EDITOR); - SetWindowWidgetDisabledState(w, GLAND_TREE_PULLDOWN, _game_mode == GM_EDITOR); - - SetWindowWidgetDisabledState(w, GLAND_START_DATE_DOWN, _patches_newgame.starting_year <= MIN_YEAR); - SetWindowWidgetDisabledState(w, GLAND_START_DATE_UP, _patches_newgame.starting_year >= MAX_YEAR); - SetWindowWidgetDisabledState(w, GLAND_SNOW_LEVEL_DOWN, _patches_newgame.snow_line_height <= 2 || _opt_newgame.landscape != LT_ARCTIC); - SetWindowWidgetDisabledState(w, GLAND_SNOW_LEVEL_UP, _patches_newgame.snow_line_height >= MAX_SNOWLINE_HEIGHT || _opt_newgame.landscape != LT_ARCTIC); - - SetWindowWidgetLoweredState(w, GLAND_TEMPERATE, _opt_newgame.landscape == LT_TEMPERATE); - SetWindowWidgetLoweredState(w, GLAND_ARCTIC, _opt_newgame.landscape == LT_ARCTIC); - SetWindowWidgetLoweredState(w, GLAND_TROPICAL, _opt_newgame.landscape == LT_TROPIC); - SetWindowWidgetLoweredState(w, GLAND_TOYLAND, _opt_newgame.landscape == LT_TOYLAND); + w->SetWidgetDisabledState(GLAND_TOWN_TEXT, _game_mode == GM_EDITOR); + w->SetWidgetDisabledState(GLAND_TOWN_PULLDOWN, _game_mode == GM_EDITOR); + w->SetWidgetDisabledState(GLAND_INDUSTRY_TEXT, _game_mode == GM_EDITOR); + w->SetWidgetDisabledState(GLAND_INDUSTRY_PULLDOWN, _game_mode == GM_EDITOR); + w->SetWidgetDisabledState(GLAND_TREE_TEXT, _game_mode == GM_EDITOR); + w->SetWidgetDisabledState(GLAND_TREE_PULLDOWN, _game_mode == GM_EDITOR); + + w->SetWidgetDisabledState(GLAND_START_DATE_DOWN, _patches_newgame.starting_year <= MIN_YEAR); + w->SetWidgetDisabledState(GLAND_START_DATE_UP, _patches_newgame.starting_year >= MAX_YEAR); + w->SetWidgetDisabledState(GLAND_SNOW_LEVEL_DOWN, _patches_newgame.snow_line_height <= 2 || _opt_newgame.landscape != LT_ARCTIC); + w->SetWidgetDisabledState(GLAND_SNOW_LEVEL_UP, _patches_newgame.snow_line_height >= MAX_SNOWLINE_HEIGHT || _opt_newgame.landscape != LT_ARCTIC); + + w->SetWidgetLoweredState(GLAND_TEMPERATE, _opt_newgame.landscape == LT_TEMPERATE); + w->SetWidgetLoweredState(GLAND_ARCTIC, _opt_newgame.landscape == LT_ARCTIC); + w->SetWidgetLoweredState(GLAND_TROPICAL, _opt_newgame.landscape == LT_TROPIC); + w->SetWidgetLoweredState(GLAND_TOYLAND, _opt_newgame.landscape == LT_TOYLAND); DrawWindowWidgets(w); y = (mode == GLWP_HEIGHTMAP) ? 22 : 0; @@ -335,7 +335,7 @@ static void GenerateLandscapeWndProc(Window *w, WindowEvent *e) switch (e->we.click.widget) { case 0: DeleteWindow(w); break; case GLAND_TEMPERATE: case GLAND_ARCTIC: case GLAND_TROPICAL: case GLAND_TOYLAND: - RaiseWindowWidget(w, _opt_newgame.landscape + GLAND_TEMPERATE); + w->RaiseWidget(_opt_newgame.landscape + GLAND_TEMPERATE); SetNewLandscapeType(e->we.click.widget - GLAND_TEMPERATE); break; case GLAND_MAPSIZE_X_TEXT: case GLAND_MAPSIZE_X_PULLDOWN: // Mapsize X @@ -605,18 +605,18 @@ static void CreateScenarioWndProc(Window *w, WindowEvent *e) static const StringID mapsizes[] = {STR_64, STR_128, STR_256, STR_512, STR_1024, STR_2048, INVALID_STRING_ID}; switch (e->event) { - case WE_CREATE: LowerWindowWidget(w, _opt_newgame.landscape + CSCEN_TEMPERATE); break; + case WE_CREATE: w->LowerWidget(_opt_newgame.landscape + CSCEN_TEMPERATE); break; case WE_PAINT: - SetWindowWidgetDisabledState(w, CSCEN_START_DATE_DOWN, _patches_newgame.starting_year <= MIN_YEAR); - SetWindowWidgetDisabledState(w, CSCEN_START_DATE_UP, _patches_newgame.starting_year >= MAX_YEAR); - SetWindowWidgetDisabledState(w, CSCEN_FLAT_LAND_HEIGHT_DOWN, _patches_newgame.se_flat_world_height <= 0); - SetWindowWidgetDisabledState(w, CSCEN_FLAT_LAND_HEIGHT_UP, _patches_newgame.se_flat_world_height >= MAX_TILE_HEIGHT); - - SetWindowWidgetLoweredState(w, CSCEN_TEMPERATE, _opt_newgame.landscape == LT_TEMPERATE); - SetWindowWidgetLoweredState(w, CSCEN_ARCTIC, _opt_newgame.landscape == LT_ARCTIC); - SetWindowWidgetLoweredState(w, CSCEN_TROPICAL, _opt_newgame.landscape == LT_TROPIC); - SetWindowWidgetLoweredState(w, CSCEN_TOYLAND, _opt_newgame.landscape == LT_TOYLAND); + w->SetWidgetDisabledState(CSCEN_START_DATE_DOWN, _patches_newgame.starting_year <= MIN_YEAR); + w->SetWidgetDisabledState(CSCEN_START_DATE_UP, _patches_newgame.starting_year >= MAX_YEAR); + w->SetWidgetDisabledState(CSCEN_FLAT_LAND_HEIGHT_DOWN, _patches_newgame.se_flat_world_height <= 0); + w->SetWidgetDisabledState(CSCEN_FLAT_LAND_HEIGHT_UP, _patches_newgame.se_flat_world_height >= MAX_TILE_HEIGHT); + + w->SetWidgetLoweredState(CSCEN_TEMPERATE, _opt_newgame.landscape == LT_TEMPERATE); + w->SetWidgetLoweredState(CSCEN_ARCTIC, _opt_newgame.landscape == LT_ARCTIC); + w->SetWidgetLoweredState(CSCEN_TROPICAL, _opt_newgame.landscape == LT_TROPIC); + w->SetWidgetLoweredState(CSCEN_TOYLAND, _opt_newgame.landscape == LT_TOYLAND); DrawWindowWidgets(w); DrawStringRightAligned(211, 97, STR_MAPSIZE, TC_FROMSTRING); @@ -636,7 +636,7 @@ static void CreateScenarioWndProc(Window *w, WindowEvent *e) case WE_CLICK: switch (e->we.click.widget) { case CSCEN_TEMPERATE: case CSCEN_ARCTIC: case CSCEN_TROPICAL: case CSCEN_TOYLAND: - RaiseWindowWidget(w, _opt_newgame.landscape + CSCEN_TEMPERATE); + w->RaiseWidget(_opt_newgame.landscape + CSCEN_TEMPERATE); SetNewLandscapeType(e->we.click.widget - CSCEN_TEMPERATE); break; case CSCEN_MAPSIZE_X_TEXT: case CSCEN_MAPSIZE_X_PULLDOWN: // Mapsize X diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index ee97a5f7a..7c2543011 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -250,7 +250,7 @@ static void GraphLegendWndProc(Window *w, WindowEvent *e) switch (e->event) { case WE_CREATE: for (uint i = 3; i < w->widget_count; i++) { - if (!HasBit(_legend_excluded_players, i - 3)) LowerWindowWidget(w, i); + if (!HasBit(_legend_excluded_players, i - 3)) w->LowerWidget(i); } break; @@ -261,7 +261,7 @@ static void GraphLegendWndProc(Window *w, WindowEvent *e) if (p->is_active) continue; SetBit(_legend_excluded_players, p->index); - RaiseWindowWidget(w, p->index + 3); + w->RaiseWidget(p->index + 3); } DrawWindowWidgets(w); @@ -282,7 +282,7 @@ static void GraphLegendWndProc(Window *w, WindowEvent *e) if (!IsInsideMM(e->we.click.widget, 3, 11)) return; ToggleBit(_legend_excluded_players, e->we.click.widget - 3); - ToggleWidgetLoweredState(w, e->we.click.widget); + w->ToggleWidgetLoweredState(e->we.click.widget); SetWindowDirty(w); InvalidateWindow(WC_INCOME_GRAPH, 0); InvalidateWindow(WC_OPERATING_PROFIT, 0); @@ -733,7 +733,7 @@ static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e) * both the text and the colored box have to be manually painted. * clk_dif will move one pixel down and one pixel to the right * when the button is clicked */ - byte clk_dif = IsWindowWidgetLowered(w, i + 3) ? 1 : 0; + byte clk_dif = w->IsWidgetLowered(i + 3) ? 1 : 0; GfxFillRect(x + clk_dif, y + clk_dif, x + 8 + clk_dif, y + 5 + clk_dif, 0); GfxFillRect(x + 1 + clk_dif, y + 1 + clk_dif, x + 7 + clk_dif, y + 4 + clk_dif, cs->legend_colour); @@ -761,7 +761,7 @@ static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e) case WE_CLICK: if (e->we.click.widget >= 3) { ToggleBit(_legend_excluded_cargo, e->we.click.widget - 3); - ToggleWidgetLoweredState(w, e->we.click.widget); + w->ToggleWidgetLoweredState(e->we.click.widget); SetWindowDirty(w); } break; @@ -816,7 +816,7 @@ void ShowCargoPaymentRates() wi->data = 0; wi->tooltips = STR_7064_TOGGLE_GRAPH_FOR_CARGO; - if (!HasBit(_legend_excluded_cargo, i)) LowerWindowWidget(w, i + 3); + if (!HasBit(_legend_excluded_cargo, i)) w->LowerWidget(i + 3); } SetWindowDirty(w); @@ -932,8 +932,8 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e) if (_performance_rating_detail_player == INVALID_PLAYER || !GetPlayer(_performance_rating_detail_player)->is_active) { if (_performance_rating_detail_player != INVALID_PLAYER) { /* Raise and disable the widget for the previous selection. */ - RaiseWindowWidget(w, _performance_rating_detail_player + 13); - DisableWindowWidget(w, _performance_rating_detail_player + 13); + w->RaiseWidget(_performance_rating_detail_player + 13); + w->DisableWidget(_performance_rating_detail_player + 13); SetWindowDirty(w); _performance_rating_detail_player = INVALID_PLAYER; @@ -942,7 +942,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e) for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) { if (GetPlayer(i)->is_active) { /* Lower the widget corresponding to this player. */ - LowerWindowWidget(w, i + 13); + w->LowerWidget(i + 13); SetWindowDirty(w); _performance_rating_detail_player = i; @@ -958,9 +958,9 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e) for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) { if (!GetPlayer(i)->is_active) { /* Check if we have the player as an active player */ - if (!IsWindowWidgetDisabled(w, i + 13)) { + if (!w->IsWidgetDisabled(i + 13)) { /* Bah, player gone :( */ - DisableWindowWidget(w, i + 13); + w->DisableWidget(i + 13); /* We need a repaint */ SetWindowDirty(w); @@ -969,9 +969,9 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e) } /* Check if we have the player marked as inactive */ - if (IsWindowWidgetDisabled(w, i + 13)) { + if (w->IsWidgetDisabled(i + 13)) { /* New player! Yippie :p */ - EnableWindowWidget(w, i + 13); + w->EnableWidget(i + 13); /* We need a repaint */ SetWindowDirty(w); } @@ -1052,10 +1052,10 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e) /* Check which button is clicked */ if (IsInsideMM(e->we.click.widget, 13, 21)) { /* Is it no on disable? */ - if (!IsWindowWidgetDisabled(w, e->we.click.widget)) { - RaiseWindowWidget(w, _performance_rating_detail_player + 13); + if (!w->IsWidgetDisabled(e->we.click.widget)) { + w->RaiseWidget(_performance_rating_detail_player + 13); _performance_rating_detail_player = (PlayerID)(e->we.click.widget - 13); - LowerWindowWidget(w, _performance_rating_detail_player + 13); + w->LowerWidget(_performance_rating_detail_player + 13); SetWindowDirty(w); } } @@ -1066,7 +1066,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e) /* Disable the players who are not active */ for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) { - SetWindowWidgetDisabledState(w, i + 13, !GetPlayer(i)->is_active); + w->SetWidgetDisabledState(i + 13, !GetPlayer(i)->is_active); } /* Update all player stats with the current data * (this is because _score_info is not saved to a savegame) */ @@ -1077,7 +1077,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e) w->custom[0] = DAY_TICKS; w->custom[1] = 5; - if (_performance_rating_detail_player != INVALID_PLAYER) LowerWindowWidget(w, _performance_rating_detail_player + 13); + if (_performance_rating_detail_player != INVALID_PLAYER) w->LowerWidget(_performance_rating_detail_player + 13); SetWindowDirty(w); break; diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 335e7ced0..a4cd5581a 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -266,7 +266,7 @@ static void CreateVehicleGroupWindow(Window *w) */ static void UpdateGroupActionDropdown(Window *w, GroupID gid, bool refresh = true) { - if (refresh && !IsWindowWidgetLowered(w, GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN)) return; + if (refresh && !w->IsWidgetLowered(GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN)) return; static StringID action_str[] = { STR_REPLACE_VEHICLES, @@ -329,8 +329,8 @@ static void GroupWndProc(Window *w, WindowEvent *e) SetVScroll2Count(w, gv->l.list_length); /* The drop down menu is out, *but* it may not be used, retract it. */ - if (gv->l.list_length == 0 && IsWindowWidgetLowered(w, GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN)) { - RaiseWindowWidget(w, GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN); + if (gv->l.list_length == 0 && w->IsWidgetLowered(GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN)) { + w->RaiseWidget(GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN); Window **w2; FOR_ALL_WINDOWS(w2) { if (w->window_class == WP(*w2, dropdown_d).parent_wnd_class && @@ -342,7 +342,7 @@ static void GroupWndProc(Window *w, WindowEvent *e) } /* Disable all lists management button when the list is empty */ - SetWindowWidgetsDisabledState(w, gv->l.list_length == 0 || _local_player != owner, + w->SetWidgetsDisabledState(gv->l.list_length == 0 || _local_player != owner, GRP_WIDGET_STOP_ALL, GRP_WIDGET_START_ALL, GRP_WIDGET_MANAGE_VEHICLES, @@ -350,7 +350,7 @@ static void GroupWndProc(Window *w, WindowEvent *e) WIDGET_LIST_END); /* Disable the group specific function when we select the default group or all vehicles */ - SetWindowWidgetsDisabledState(w, IsDefaultGroupID(gv->group_sel) || IsAllGroupID(gv->group_sel) || _local_player != owner, + w->SetWidgetsDisabledState(IsDefaultGroupID(gv->group_sel) || IsAllGroupID(gv->group_sel) || _local_player != owner, GRP_WIDGET_DELETE_GROUP, GRP_WIDGET_RENAME_GROUP, GRP_WIDGET_REPLACE_PROTECTION, @@ -362,7 +362,7 @@ static void GroupWndProc(Window *w, WindowEvent *e) * verify, whether you are the owner of the vehicle, * so it doesn't have to be disabled */ - SetWindowWidgetsDisabledState(w, _local_player != owner, + w->SetWidgetsDisabledState(_local_player != owner, GRP_WIDGET_CREATE_GROUP, GRP_WIDGET_AVAILABLE_VEHICLES, WIDGET_LIST_END); diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 127d63090..9593a593b 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -152,7 +152,7 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e) } else { w->widget[DYNA_INDU_FUND_WIDGET].data = (_patches.raw_industry_construction == 2 && indsp->IsRawIndustry()) ? STR_PROSPECT_NEW_INDUSTRY : STR_FUND_NEW_INDUSTRY; } - SetWindowWidgetDisabledState(w, DYNA_INDU_FUND_WIDGET, !_fund_gui.enabled[WP(w, fnd_d).index]); + w->SetWidgetDisabledState(DYNA_INDU_FUND_WIDGET, !_fund_gui.enabled[WP(w, fnd_d).index]); SetVScrollCount(w, _fund_gui.count); diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp index 2961dc801..488ac2892 100644 --- a/src/intro_gui.cpp +++ b/src/intro_gui.cpp @@ -53,13 +53,13 @@ static inline void SetNewLandscapeType(byte landscape) static void SelectGameWndProc(Window *w, WindowEvent *e) { switch (e->event) { - case WE_CREATE: LowerWindowWidget(w, _opt_newgame.landscape + 8); break; + case WE_CREATE: w->LowerWidget(_opt_newgame.landscape + 8); break; case WE_PAINT: - SetWindowWidgetLoweredState(w, 8, _opt_newgame.landscape == LT_TEMPERATE); - SetWindowWidgetLoweredState(w, 9, _opt_newgame.landscape == LT_ARCTIC); - SetWindowWidgetLoweredState(w, 10, _opt_newgame.landscape == LT_TROPIC); - SetWindowWidgetLoweredState(w, 11, _opt_newgame.landscape == LT_TOYLAND); + w->SetWidgetLoweredState(8, _opt_newgame.landscape == LT_TEMPERATE); + w->SetWidgetLoweredState(9, _opt_newgame.landscape == LT_ARCTIC); + w->SetWidgetLoweredState(10, _opt_newgame.landscape == LT_TROPIC); + w->SetWidgetLoweredState(11, _opt_newgame.landscape == LT_TOYLAND); SetDParam(0, STR_6801_EASY + _opt_newgame.diff_level); DrawWindowWidgets(w); break; @@ -85,7 +85,7 @@ static void SelectGameWndProc(Window *w, WindowEvent *e) } break; case 8: case 9: case 10: case 11: - RaiseWindowWidget(w, _opt_newgame.landscape + 8); + w->RaiseWidget(_opt_newgame.landscape + 8); SetNewLandscapeType(e->we.click.widget - 8); break; case 12: ShowGameOptions(); break; diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 4dfbdd705..40172f27c 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -121,18 +121,18 @@ void HandleOnEditText(const char *str) */ bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, ViewportHighlightMode mode, PlaceProc *placeproc) { - if (IsWindowWidgetDisabled(w, widget)) return false; + if (w->IsWidgetDisabled(widget)) return false; SndPlayFx(SND_15_BEEP); SetWindowDirty(w); - if (IsWindowWidgetLowered(w, widget)) { + if (w->IsWidgetLowered(widget)) { ResetObjectToPlace(); return false; } SetObjectToPlace(cursor, PAL_NONE, mode, w->window_class, w->window_number); - LowerWindowWidget(w, widget); + w->LowerWidget(widget); _place_proc = placeproc; return true; } @@ -468,7 +468,7 @@ static void MenuWndProc(Window *w, WindowEvent *e) case WE_DESTROY: { Window *v = FindWindowById(WC_MAIN_TOOLBAR, 0); - RaiseWindowWidget(v, WP(w,menu_d).main_button); + v->RaiseWidget(WP(w,menu_d).main_button); SetWindowDirty(v); return; } @@ -603,7 +603,7 @@ static void PlayerMenuWndProc(Window *w, WindowEvent *e) case WE_DESTROY: { Window *v = FindWindowById(WC_MAIN_TOOLBAR, 0); - RaiseWindowWidget(v, WP(w,menu_d).main_button); + v->RaiseWidget(WP(w,menu_d).main_button); SetWindowDirty(v); return; } @@ -705,7 +705,7 @@ static Window *PopupMainToolbMenu(Window *w, uint16 parent_button, StringID base int x = w->widget[GB(parent_button, 0, 8)].left; assert(disabled_mask == 0 || item_count <= 8); - LowerWindowWidget(w, parent_button); + w->LowerWidget(parent_button); InvalidateWidget(w, parent_button); DeleteWindowById(WC_TOOLBAR_MENU, 0); @@ -740,7 +740,7 @@ static Window *PopupMainPlayerToolbMenu(Window *w, int main_button, int gray) { int x = w->widget[main_button].left + w->left; - LowerWindowWidget(w, main_button); + w->LowerWidget(main_button); InvalidateWidget(w, main_button); DeleteWindowById(WC_TOOLBAR_MENU, 0); @@ -1309,7 +1309,7 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e) } while (--n); } - if (IsWindowWidgetLowered(w, 5) || IsWindowWidgetLowered(w, 6)) // change area-size if raise/lower corner is selected + if (w->IsWidgetLowered(5) || w->IsWidgetLowered(6)) // change area-size if raise/lower corner is selected SetTileSelectSize(_terraform_size, _terraform_size); break; @@ -1359,8 +1359,8 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e) case WE_TIMEOUT: { uint i; for (i = 0; i < w->widget_count; i++) { - if (IsWindowWidgetLowered(w, i)) { - RaiseWindowWidget(w, i); + if (w->IsWidgetLowered(i)) { + w->RaiseWidget(i); InvalidateWidget(w, i); } if (i == 3) i = 11; @@ -1456,7 +1456,7 @@ static void ScenEditTownGenWndProc(Window *w, WindowEvent *e) break; case WE_CREATE: - LowerWindowWidget(w, _scengen_town_size + 7); + w->LowerWidget(_scengen_town_size + 7); break; case WE_CLICK: @@ -1492,17 +1492,17 @@ static void ScenEditTownGenWndProc(Window *w, WindowEvent *e) } case 7: case 8: case 9: case 10: - RaiseWindowWidget(w, _scengen_town_size + 7); + w->RaiseWidget(_scengen_town_size + 7); _scengen_town_size = e->we.click.widget - 7; - LowerWindowWidget(w, _scengen_town_size + 7); + w->LowerWidget(_scengen_town_size + 7); SetWindowDirty(w); break; } break; case WE_TIMEOUT: - RaiseWindowWidget(w, 5); - RaiseWindowWidget(w, 6); + w->RaiseWidget(5); + w->RaiseWidget(6); SetWindowDirty(w); break; case WE_PLACE_OBJ: @@ -1510,7 +1510,7 @@ static void ScenEditTownGenWndProc(Window *w, WindowEvent *e) break; case WE_ABORT_PLACE_OBJ: RaiseWindowButtons(w); - LowerWindowWidget(w, _scengen_town_size + 7); + w->LowerWidget(_scengen_town_size + 7); SetWindowDirty(w); break; } @@ -1608,18 +1608,18 @@ static void MainToolbarWndProc(Window *w, WindowEvent *e) /* If spectator, disable all construction buttons * ie : Build road, rail, ships, airports and landscaping * Since enabled state is the default, just disable when needed */ - SetWindowWidgetsDisabledState(w, _current_player == PLAYER_SPECTATOR, 19, 20, 21, 22, 23, WIDGET_LIST_END); + w->SetWidgetsDisabledState(_current_player == PLAYER_SPECTATOR, 19, 20, 21, 22, 23, WIDGET_LIST_END); /* disable company list drop downs, if there are no companies */ - SetWindowWidgetsDisabledState(w, ActivePlayerCount() == 0, 7, 8, 13, 14, 15, 16, WIDGET_LIST_END); + w->SetWidgetsDisabledState(ActivePlayerCount() == 0, 7, 8, 13, 14, 15, 16, WIDGET_LIST_END); - SetWindowWidgetDisabledState(w, 19, !CanBuildVehicleInfrastructure(VEH_TRAIN)); - SetWindowWidgetDisabledState(w, 22, !CanBuildVehicleInfrastructure(VEH_AIRCRAFT)); + w->SetWidgetDisabledState(19, !CanBuildVehicleInfrastructure(VEH_TRAIN)); + w->SetWidgetDisabledState(22, !CanBuildVehicleInfrastructure(VEH_AIRCRAFT)); DrawWindowWidgets(w); break; case WE_CLICK: { - if (_game_mode != GM_MENU && !IsWindowWidgetDisabled(w, e->we.click.widget)) + if (_game_mode != GM_MENU && !w->IsWidgetDisabled(e->we.click.widget)) _toolbar_button_procs[e->we.click.widget](w); } break; @@ -1672,18 +1672,18 @@ static void MainToolbarWndProc(Window *w, WindowEvent *e) } break; case WE_ABORT_PLACE_OBJ: { - RaiseWindowWidget(w, 25); + w->RaiseWidget(25); SetWindowDirty(w); } break; case WE_MOUSELOOP: - if (IsWindowWidgetLowered(w, 0) != !!_pause_game) { - ToggleWidgetLoweredState(w, 0); + if (w->IsWidgetLowered(0) != !!_pause_game) { + w->ToggleWidgetLoweredState(0); InvalidateWidget(w, 0); } - if (IsWindowWidgetLowered(w, 1) != !!_fast_forward) { - ToggleWidgetLoweredState(w, 1); + if (w->IsWidgetLowered(1) != !!_fast_forward) { + w->ToggleWidgetLoweredState(1); InvalidateWidget(w, 1); } break; @@ -1718,8 +1718,8 @@ static void MainToolbarWndProc(Window *w, WindowEvent *e) case WE_TIMEOUT: { uint i; for (i = 2; i < w->widget_count; i++) { - if (IsWindowWidgetLowered(w, i)) { - RaiseWindowWidget(w, i); + if (w->IsWidgetLowered(i)) { + w->RaiseWidget(i); InvalidateWidget(w, i); } } @@ -1849,8 +1849,8 @@ static void ScenEditToolbarWndProc(Window *w, WindowEvent *e) { switch (e->event) { case WE_PAINT: - SetWindowWidgetDisabledState(w, 6, _patches_newgame.starting_year <= MIN_YEAR); - SetWindowWidgetDisabledState(w, 7, _patches_newgame.starting_year >= MAX_YEAR); + w->SetWidgetDisabledState(6, _patches_newgame.starting_year <= MIN_YEAR); + w->SetWidgetDisabledState(7, _patches_newgame.starting_year >= MAX_YEAR); /* Draw brown-red toolbar bg. */ GfxFillRect(0, 0, w->width-1, w->height-1, 0xB2); @@ -1900,7 +1900,7 @@ static void ScenEditToolbarWndProc(Window *w, WindowEvent *e) } break; case WE_ABORT_PLACE_OBJ: { - RaiseWindowWidget(w, 25); + w->RaiseWidget(25); SetWindowDirty(w); } break; @@ -1971,13 +1971,13 @@ static void ScenEditToolbarWndProc(Window *w, WindowEvent *e) } break; case WE_MOUSELOOP: - if (IsWindowWidgetLowered(w, 0) != !!_pause_game) { - ToggleWidgetLoweredState(w, 0); + if (w->IsWidgetLowered(0) != !!_pause_game) { + w->ToggleWidgetLoweredState(0); SetWindowDirty(w); } - if (IsWindowWidgetLowered(w, 1) != !!_fast_forward) { - ToggleWidgetLoweredState(w, 1); + if (w->IsWidgetLowered(1) != !!_fast_forward) { + w->ToggleWidgetLoweredState(1); SetWindowDirty(w); } break; @@ -2374,8 +2374,8 @@ void ShowVitalWindows() CLRBITS(w->flags4, WF_WHITE_BORDER_MASK); - SetWindowWidgetDisabledState(w, 0, _networking && !_network_server); // if not server, disable pause button - SetWindowWidgetDisabledState(w, 1, _networking); // if networking, disable fast-forward button + w->SetWidgetDisabledState(0, _networking && !_network_server); // if not server, disable pause button + w->SetWidgetDisabledState(1, _networking); // if networking, disable fast-forward button /* 'w' is for sure a WC_MAIN_TOOLBAR */ PositionMainToolbar(w); diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index e5f923cef..b6b698cfb 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -376,7 +376,7 @@ static void BuildTreesWndProc(Window *w, WindowEvent *e) break; case 16: // place trees randomly over the landscape - LowerWindowWidget(w, 16); + w->LowerWidget(16); w->flags4 |= 5 << WF_TIMEOUT_SHL; SndPlayFx(SND_15_BEEP); PlaceTreesRandomly(); @@ -402,7 +402,7 @@ static void BuildTreesWndProc(Window *w, WindowEvent *e) break; case WE_TIMEOUT: - RaiseWindowWidget(w, 16); + w->RaiseWidget(16); break; case WE_ABORT_PLACE_OBJ: @@ -1220,7 +1220,7 @@ void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, WP(w, querystr_d).orig = orig_str_buf; } - LowerWindowWidget(w, QUERY_STR_WIDGET_TEXT); + w->LowerWidget(QUERY_STR_WIDGET_TEXT); WP(w, querystr_d).caption = caption; WP(w, querystr_d).afilter = afilter; InitializeTextBuffer(&WP(w, querystr_d).text, _edit_str_buf, realmaxlen, maxwidth); @@ -1599,7 +1599,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e) * in those two saveload mode */ if (!(_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO)) break; - if (IsWindowWidgetLowered(w, 11)) { // Delete button clicked + if (w->IsWidgetLowered(11)) { // Delete button clicked if (!FiosDelete(WP(w, querystr_d).text.buf)) { ShowErrorMessage(INVALID_STRING_ID, STR_4008_UNABLE_TO_DELETE_FILE, 0, 0); } else { @@ -1610,7 +1610,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e) UpdateTextBufferSize(&WP(w, querystr_d).text); SetWindowDirty(w); - } else if (IsWindowWidgetLowered(w, 12)) { // Save button clicked + } else if (w->IsWidgetLowered(12)) { // Save button clicked _switch_mode = SM_SAVE; FiosMakeSavegameName(_file_to_saveload.name, WP(w, querystr_d).text.buf, sizeof(_file_to_saveload.name)); @@ -1691,7 +1691,7 @@ void ShowSaveLoadDialog(int mode) assert((uint)mode < lengthof(saveload_captions)); w = AllocateWindowDesc(sld); w->widget[1].data = saveload_captions[mode]; - LowerWindowWidget(w, 7); + w->LowerWidget(7); WP(w, querystr_d).afilter = CS_ALPHANUMERAL; InitializeTextBuffer(&WP(w, querystr_d).text, _edit_str_buf, lengthof(_edit_str_buf), 240); diff --git a/src/music_gui.cpp b/src/music_gui.cpp index ccc279b72..d97048610 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -199,9 +199,9 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e) uint i; int y; - SetWindowWidgetDisabledState(w, 11, msf.playlist <= 3); - LowerWindowWidget(w, 3); - LowerWindowWidget(w, 4); + w->SetWidgetDisabledState(11, msf.playlist <= 3); + w->LowerWidget(3); + w->LowerWidget(4); DrawWindowWidgets(w); GfxFillRect(3, 23, 3 + 177, 23 + 191, 0); @@ -342,8 +342,8 @@ static void MusicWindowWndProc(Window *w, WindowEvent *e) uint i; StringID str; - RaiseWindowWidget(w, 7); - RaiseWindowWidget(w, 9); + w->RaiseWidget(7); + w->RaiseWidget(9); DrawWindowWidgets(w); GfxFillRect(187, 16, 200, 33, 0); diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 50af415a7..84227c531 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -272,15 +272,15 @@ static void NetworkGameWindowWndProc(Window *w, WindowEvent *e) if (ld->flags & VL_RESORT) SortNetworkGameList(&WP(w, network_ql_d)); /* 'Refresh' button invisible if no server selected */ - SetWindowWidgetDisabledState(w, NGWW_REFRESH, sel == NULL); + w->SetWidgetDisabledState(NGWW_REFRESH, sel == NULL); /* 'Join' button disabling conditions */ - SetWindowWidgetDisabledState(w, NGWW_JOIN, sel == NULL || // no Selected Server + w->SetWidgetDisabledState(NGWW_JOIN, sel == NULL || // no Selected Server !sel->online || // Server offline sel->info.clients_on >= sel->info.clients_max || // Server full !sel->info.compatible); // Revision mismatch /* 'NewGRF Settings' button invisible if no NewGRF is used */ - SetWindowWidgetHiddenState(w, NGWW_NEWGRF, sel == NULL || + w->SetWidgetHiddenState(NGWW_NEWGRF, sel == NULL || !sel->online || sel->info.grfconfig == NULL); @@ -997,11 +997,11 @@ static void NetworkLobbyWindowWndProc(Window *w, WindowEvent *e) int y = NET_PRC__OFFSET_TOP_WIDGET_COMPANY, pos; /* Join button is disabled when no company is selected */ - SetWindowWidgetDisabledState(w, NLWW_JOIN, nd->company == INVALID_PLAYER); + w->SetWidgetDisabledState(NLWW_JOIN, nd->company == INVALID_PLAYER); /* Cannot start new company if there are too many */ - SetWindowWidgetDisabledState(w, NLWW_NEW, gi->companies_on >= gi->companies_max); + w->SetWidgetDisabledState(NLWW_NEW, gi->companies_on >= gi->companies_max); /* Cannot spectate if there are too many spectators */ - SetWindowWidgetDisabledState(w, NLWW_SPECTATE, gi->spectators_on >= gi->spectators_max); + w->SetWidgetDisabledState(NLWW_SPECTATE, gi->spectators_on >= gi->spectators_max); /* Draw window widgets */ SetDParamStr(0, gi->server_name); @@ -1880,7 +1880,7 @@ void ShowNetworkChatQueryWindow(DestType type, int dest) w = AllocateWindowDesc(&_chat_window_desc); - LowerWindowWidget(w, 2); + w->LowerWidget(2); WP(w, chatquerystr_d).caption = type; // Misuse of caption WP(w, chatquerystr_d).dest = dest; WP(w, chatquerystr_d).afilter = CS_ALPHANUMERAL; diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index d2ad51ceb..cc731e7c1 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -127,7 +127,7 @@ static void NewGRFAddDlgWndProc(Window *w, WindowEvent *e) w->vscroll.cap = (w->widget[3].bottom - w->widget[3].top) / 10; SetVScrollCount(w, n); - SetWindowWidgetDisabledState(w, 6, WP(w, newgrf_add_d).sel == NULL || WP(w, newgrf_add_d).sel->IsOpenTTDBaseGRF()); + w->SetWidgetDisabledState(6, WP(w, newgrf_add_d).sel == NULL || WP(w, newgrf_add_d).sel->IsOpenTTDBaseGRF()); DrawWindowWidgets(w); GfxFillRect(w->widget[3].left + 1, w->widget[3].top + 1, w->widget[3].right, w->widget[3].bottom, 0xD7); @@ -269,20 +269,20 @@ static void SetupNewGRFState(Window *w) { bool disable_all = WP(w, newgrf_d).sel == NULL || !WP(w, newgrf_d).editable; - SetWindowWidgetDisabledState(w, 3, !WP(w, newgrf_d).editable); - SetWindowWidgetsDisabledState(w, disable_all, + w->SetWidgetDisabledState(3, !WP(w, newgrf_d).editable); + w->SetWidgetsDisabledState(disable_all, SNGRFS_REMOVE, SNGRFS_MOVE_UP, SNGRFS_MOVE_DOWN, WIDGET_LIST_END ); - SetWindowWidgetDisabledState(w, SNGRFS_SET_PARAMETERS, !WP(w, newgrf_d).show_params || disable_all); + w->SetWidgetDisabledState(SNGRFS_SET_PARAMETERS, !WP(w, newgrf_d).show_params || disable_all); if (!disable_all) { /* All widgets are now enabled, so disable widgets we can't use */ - if (WP(w, newgrf_d).sel == *WP(w, newgrf_d).list) DisableWindowWidget(w, SNGRFS_MOVE_UP); - if (WP(w, newgrf_d).sel->next == NULL) DisableWindowWidget(w, SNGRFS_MOVE_DOWN); - if (WP(w, newgrf_d).sel->IsOpenTTDBaseGRF()) DisableWindowWidget(w, SNGRFS_REMOVE); + if (WP(w, newgrf_d).sel == *WP(w, newgrf_d).list) w->DisableWidget(SNGRFS_MOVE_UP); + if (WP(w, newgrf_d).sel->next == NULL) w->DisableWidget(SNGRFS_MOVE_DOWN); + if (WP(w, newgrf_d).sel->IsOpenTTDBaseGRF()) w->DisableWidget(SNGRFS_REMOVE); } } @@ -296,7 +296,7 @@ static void SetupNewGRFWindow(Window *w) w->vscroll.cap = (w->widget[SNGRFS_FILE_LIST].bottom - w->widget[SNGRFS_FILE_LIST].top) / 14 + 1; SetVScrollCount(w, i); - SetWindowWidgetDisabledState(w, SNGRFS_APPLY_CHANGES, !WP(w, newgrf_d).editable); + w->SetWidgetDisabledState(SNGRFS_APPLY_CHANGES, !WP(w, newgrf_d).editable); } diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 728b561db..2bf4c5acd 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -801,8 +801,8 @@ static void SetMessageButtonStates(Window *w, byte value, int element) { element *= NB_WIDG_PER_SETTING; - SetWindowWidgetDisabledState(w, element + WIDGET_NEWSOPT_START_OPTION, value == 0); - SetWindowWidgetDisabledState(w, element + WIDGET_NEWSOPT_START_OPTION + 2, value == 2); + w->SetWidgetDisabledState(element + WIDGET_NEWSOPT_START_OPTION, value == 0); + w->SetWidgetDisabledState(element + WIDGET_NEWSOPT_START_OPTION + 2, value == 2); } /** @@ -836,7 +836,7 @@ static void MessageOptionsWndProc(Window *w, WindowEvent *e) uint32 val = _news_display_opt; int i, y; - if (_news_ticker_sound) LowerWindowWidget(w, WIDGET_NEWSOPT_SOUNDTICKER); + if (_news_ticker_sound) w->LowerWidget(WIDGET_NEWSOPT_SOUNDTICKER); DrawWindowWidgets(w); /* Draw the string of each setting on each button. */ @@ -859,7 +859,7 @@ static void MessageOptionsWndProc(Window *w, WindowEvent *e) case WIDGET_NEWSOPT_SOUNDTICKER: // Change ticker sound on/off _news_ticker_sound ^= 1; - ToggleWidgetLoweredState(w, e->we.click.widget); + w->ToggleWidgetLoweredState(e->we.click.widget); InvalidateWidget(w, e->we.click.widget); break; diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 22e90cb3c..42641a39e 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -129,50 +129,50 @@ static void DrawOrdersWindow(Window *w) if (v->owner == _local_player) { /* skip */ - SetWindowWidgetDisabledState(w, ORDER_WIDGET_SKIP, v->num_orders <= 1); + w->SetWidgetDisabledState(ORDER_WIDGET_SKIP, v->num_orders <= 1); /* delete */ - SetWindowWidgetDisabledState(w, ORDER_WIDGET_DELETE, + w->SetWidgetDisabledState(ORDER_WIDGET_DELETE, (uint)v->num_orders + ((shared_orders || v->num_orders != 0) ? 1 : 0) <= (uint)WP(w, order_d).sel); /* non-stop only for trains */ - SetWindowWidgetDisabledState(w, ORDER_WIDGET_NON_STOP, v->type != VEH_TRAIN || order == NULL); - SetWindowWidgetDisabledState(w, ORDER_WIDGET_FULL_LOAD, order == NULL); // full load - SetWindowWidgetDisabledState(w, ORDER_WIDGET_UNLOAD, order == NULL); // unload - SetWindowWidgetDisabledState(w, ORDER_WIDGET_TRANSFER, order == NULL); // transfer + w->SetWidgetDisabledState(ORDER_WIDGET_NON_STOP, v->type != VEH_TRAIN || order == NULL); + w->SetWidgetDisabledState(ORDER_WIDGET_FULL_LOAD, order == NULL); // full load + w->SetWidgetDisabledState(ORDER_WIDGET_UNLOAD, order == NULL); // unload + w->SetWidgetDisabledState(ORDER_WIDGET_TRANSFER, order == NULL); // transfer /* Disable list of vehicles with the same shared orders if there is no list */ - SetWindowWidgetDisabledState(w, ORDER_WIDGET_SHARED_ORDER_LIST, !shared_orders || v->orders == NULL); - SetWindowWidgetDisabledState(w, ORDER_WIDGET_REFIT, order == NULL); // Refit - HideWindowWidget(w, ORDER_WIDGET_REFIT); // Refit + w->SetWidgetDisabledState(ORDER_WIDGET_SHARED_ORDER_LIST, !shared_orders || v->orders == NULL); + w->SetWidgetDisabledState(ORDER_WIDGET_REFIT, order == NULL); // Refit + w->HideWidget(ORDER_WIDGET_REFIT); // Refit } else { - DisableWindowWidget(w, ORDER_WIDGET_TRANSFER); + w->DisableWidget(ORDER_WIDGET_TRANSFER); } - ShowWindowWidget(w, ORDER_WIDGET_UNLOAD); // Unload + w->ShowWidget(ORDER_WIDGET_UNLOAD); // Unload if (order != NULL) { switch (order->type) { case OT_GOTO_STATION: break; case OT_GOTO_DEPOT: - DisableWindowWidget(w, ORDER_WIDGET_TRANSFER); + w->DisableWidget(ORDER_WIDGET_TRANSFER); /* Remove unload and replace it with refit */ - HideWindowWidget(w, ORDER_WIDGET_UNLOAD); - ShowWindowWidget(w, ORDER_WIDGET_REFIT); + w->HideWidget(ORDER_WIDGET_UNLOAD); + w->ShowWidget(ORDER_WIDGET_REFIT); SetDParam(2,STR_SERVICE); break; case OT_GOTO_WAYPOINT: - DisableWindowWidget(w, ORDER_WIDGET_FULL_LOAD); - DisableWindowWidget(w, ORDER_WIDGET_UNLOAD); - DisableWindowWidget(w, ORDER_WIDGET_TRANSFER); + w->DisableWidget(ORDER_WIDGET_FULL_LOAD); + w->DisableWidget(ORDER_WIDGET_UNLOAD); + w->DisableWidget(ORDER_WIDGET_TRANSFER); break; default: // every other orders - DisableWindowWidget(w, ORDER_WIDGET_NON_STOP); - DisableWindowWidget(w, ORDER_WIDGET_FULL_LOAD); - DisableWindowWidget(w, ORDER_WIDGET_UNLOAD); + w->DisableWidget(ORDER_WIDGET_NON_STOP); + w->DisableWidget(ORDER_WIDGET_FULL_LOAD); + w->DisableWidget(ORDER_WIDGET_UNLOAD); } } @@ -398,8 +398,8 @@ static void OrdersPlaceObj(const Vehicle *v, TileIndex tile, Window *w) static void OrderClick_Goto(Window *w, const Vehicle *v) { InvalidateWidget(w, ORDER_WIDGET_GOTO); - ToggleWidgetLoweredState(w, ORDER_WIDGET_GOTO); - if (IsWindowWidgetLowered(w, ORDER_WIDGET_GOTO)) { + w->ToggleWidgetLoweredState(ORDER_WIDGET_GOTO); + if (w->IsWidgetLowered(ORDER_WIDGET_GOTO)) { _place_clicked_vehicle = NULL; SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, VHM_RECT, w); } else { @@ -543,7 +543,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e) if (_patches.timetabling) { w->widget[ORDER_WIDGET_CAPTION].right -= 61; } else { - HideWindowWidget(w, ORDER_WIDGET_TIMETABLE_VIEW); + w->HideWidget(ORDER_WIDGET_TIMETABLE_VIEW); } break; @@ -675,7 +675,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e) if (e->we.keypress.keycode == _order_keycodes[i]) { e->we.keypress.cont = false; //see if the button is disabled - if (!IsWindowWidgetDisabled(w, i + ORDER_WIDGET_SKIP)) _order_button_proc[i](w, v); + if (!w->IsWidgetDisabled(i + ORDER_WIDGET_SKIP)) _order_button_proc[i](w, v); break; } } @@ -699,7 +699,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e) } break; case WE_ABORT_PLACE_OBJ: { - RaiseWindowWidget(w, ORDER_WIDGET_GOTO); + w->RaiseWidget(ORDER_WIDGET_GOTO); InvalidateWidget( w, ORDER_WIDGET_GOTO); } break; @@ -714,7 +714,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e) * the order is copied to the last open window instead of the * one where GOTO is enabled */ - if (v != NULL && IsWindowWidgetLowered(w, ORDER_WIDGET_GOTO)) { + if (v != NULL && w->IsWidgetLowered(ORDER_WIDGET_GOTO)) { _place_clicked_vehicle = NULL; HandleOrderVehClick(GetVehicle(w->window_number), v, w); } @@ -729,8 +729,8 @@ static void OrdersWndProc(Window *w, WindowEvent *e) // unclick all buttons except for the 'goto' button (ORDER_WIDGET_GOTO), which is 'persistent' uint i; for (i = 0; i < w->widget_count; i++) { - if (IsWindowWidgetLowered(w, i) && i != ORDER_WIDGET_GOTO) { - RaiseWindowWidget(w, i); + if (w->IsWidgetLowered(i) && i != ORDER_WIDGET_GOTO) { + w->RaiseWidget(i); InvalidateWidget(w, i); } } diff --git a/src/player_gui.cpp b/src/player_gui.cpp index d7eeadac4..dd7262bc3 100644 --- a/src/player_gui.cpp +++ b/src/player_gui.cpp @@ -146,15 +146,15 @@ static void PlayerFinancesWndProc(Window *w, WindowEvent *e) w->height = new_height; SetWindowDirty(w); - SetWindowWidgetHiddenState(w, 6, player != _local_player); - SetWindowWidgetHiddenState(w, 7, player != _local_player); + w->SetWidgetHiddenState(6, player != _local_player); + w->SetWidgetHiddenState(7, player != _local_player); } /* Borrow button only shows when there is any more money to loan */ - SetWindowWidgetDisabledState(w, 6, p->current_loan == _economy.max_loan); + w->SetWidgetDisabledState(6, p->current_loan == _economy.max_loan); /* Repay button only shows when there is any more money to repay */ - SetWindowWidgetDisabledState(w, 7, player != _local_player || p->current_loan == 0); + w->SetWidgetDisabledState(7, player != _local_player || p->current_loan == 0); SetDParam(0, p->index); SetDParam(1, p->index); @@ -293,10 +293,10 @@ static void SelectPlayerLiveryWndProc(Window *w, WindowEvent *e) { switch (e->event) { case WE_CREATE: - LowerWindowWidget(w, WP(w, livery_d).livery_class + 2); + w->LowerWidget(WP(w, livery_d).livery_class + 2); if (!_loaded_newgrf_features.has_2CC) { - HideWindowWidget(w, 11); - HideWindowWidget(w, 12); + w->HideWidget(11); + w->HideWidget(12); } break; @@ -306,10 +306,10 @@ static void SelectPlayerLiveryWndProc(Window *w, WindowEvent *e) int y = 51; /* Disable dropdown controls if no scheme is selected */ - SetWindowWidgetDisabledState(w, 9, (WP(w, livery_d).sel == 0)); - SetWindowWidgetDisabledState(w, 10, (WP(w, livery_d).sel == 0)); - SetWindowWidgetDisabledState(w, 11, (WP(w, livery_d).sel == 0)); - SetWindowWidgetDisabledState(w, 12, (WP(w, livery_d).sel == 0)); + w->SetWidgetDisabledState( 9, (WP(w, livery_d).sel == 0)); + w->SetWidgetDisabledState(10, (WP(w, livery_d).sel == 0)); + w->SetWidgetDisabledState(11, (WP(w, livery_d).sel == 0)); + w->SetWidgetDisabledState(12, (WP(w, livery_d).sel == 0)); if (!(WP(w, livery_d).sel == 0)) { for (scheme = LS_BEGIN; scheme < LS_END; scheme++) { @@ -357,10 +357,10 @@ static void SelectPlayerLiveryWndProc(Window *w, WindowEvent *e) case 6: { LiveryScheme scheme; - RaiseWindowWidget(w, WP(w, livery_d).livery_class + 2); + w->RaiseWidget(WP(w, livery_d).livery_class + 2); WP(w, livery_d).livery_class = (LiveryClass)(e->we.click.widget - 2); WP(w, livery_d).sel = 0; - LowerWindowWidget(w, WP(w, livery_d).livery_class + 2); + w->LowerWidget(WP(w, livery_d).livery_class + 2); /* Select the first item in the list */ for (scheme = LS_DEFAULT; scheme < LS_END; scheme++) { @@ -660,7 +660,7 @@ void DrawFaceStringLabel(const Window *w, byte widget_index, StringID str, uint8 /* Write the label in gold (0x2) to the left of the button. */ DrawStringRightAligned(w->widget[widget_index].left - (is_bool_widget ? 5 : 14), w->widget[widget_index].top + 1, str, TC_GOLD); - if (!IsWindowWidgetDisabled(w, widget_index)) { + if (!w->IsWidgetDisabled(widget_index)) { if (is_bool_widget) { /* if it a bool button write yes or no */ str = (val != 0) ? STR_FACE_YES : STR_FACE_NO; @@ -672,7 +672,7 @@ void DrawFaceStringLabel(const Window *w, byte widget_index, StringID str, uint8 /* Draw the value/bool in white (0xC). If the button clicked adds 1px to x and y text coordinates (IsWindowWidgetLowered()). */ DrawStringCentered(w->widget[widget_index].left + (w->widget[widget_index].right - w->widget[widget_index].left) / 2 + - IsWindowWidgetLowered(w, widget_index), w->widget[widget_index].top + 1 + IsWindowWidgetLowered(w, widget_index), str, TC_WHITE); + w->IsWidgetLowered(widget_index), w->widget[widget_index].top + 1 + w->IsWidgetLowered(widget_index), str, TC_WHITE); } } @@ -692,14 +692,14 @@ static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e) switch (e->event) { case WE_PAINT: /* lower the non-selected gender button */ - SetWindowWidgetLoweredState(w, PFW_WIDGET_MALE, !is_female); - SetWindowWidgetLoweredState(w, PFW_WIDGET_FEMALE, is_female); + w->SetWidgetLoweredState(PFW_WIDGET_MALE, !is_female); + w->SetWidgetLoweredState(PFW_WIDGET_FEMALE, is_female); /* advanced player face selection window */ if (WP(w, facesel_d).advanced) { /* lower the non-selected ethnicity button */ - SetWindowWidgetLoweredState(w, PFW_WIDGET_ETHNICITY_EUR, !HasBit(ge, ETHNICITY_BLACK)); - SetWindowWidgetLoweredState(w, PFW_WIDGET_ETHNICITY_AFR, HasBit(ge, ETHNICITY_BLACK)); + w->SetWidgetLoweredState(PFW_WIDGET_ETHNICITY_EUR, !HasBit(ge, ETHNICITY_BLACK)); + w->SetWidgetLoweredState(PFW_WIDGET_ETHNICITY_AFR, HasBit(ge, ETHNICITY_BLACK)); /* Disable dynamically the widgets which PlayerFaceVariable has less than 2 options @@ -707,44 +707,44 @@ static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e) * If the widgets depend on a HAS-variable and this is false the widgets will be disabled, too. */ /* Eye colour buttons */ - SetWindowWidgetsDisabledState(w, _pf_info[PFV_EYE_COLOUR].valid_values[ge] < 2, + w->SetWidgetsDisabledState(_pf_info[PFV_EYE_COLOUR].valid_values[ge] < 2, PFW_WIDGET_EYECOLOUR, PFW_WIDGET_EYECOLOUR_L, PFW_WIDGET_EYECOLOUR_R, WIDGET_LIST_END); /* Chin buttons */ - SetWindowWidgetsDisabledState(w, _pf_info[PFV_CHIN].valid_values[ge] < 2, + w->SetWidgetsDisabledState(_pf_info[PFV_CHIN].valid_values[ge] < 2, PFW_WIDGET_CHIN, PFW_WIDGET_CHIN_L, PFW_WIDGET_CHIN_R, WIDGET_LIST_END); /* Eyebrows buttons */ - SetWindowWidgetsDisabledState(w, _pf_info[PFV_EYEBROWS].valid_values[ge] < 2, + w->SetWidgetsDisabledState(_pf_info[PFV_EYEBROWS].valid_values[ge] < 2, PFW_WIDGET_EYEBROWS, PFW_WIDGET_EYEBROWS_L, PFW_WIDGET_EYEBROWS_R, WIDGET_LIST_END); /* Lips or (if it a male face with a moustache) moustache buttons */ - SetWindowWidgetsDisabledState(w, _pf_info[is_moust_male ? PFV_MOUSTACHE : PFV_LIPS].valid_values[ge] < 2, + w->SetWidgetsDisabledState(_pf_info[is_moust_male ? PFV_MOUSTACHE : PFV_LIPS].valid_values[ge] < 2, PFW_WIDGET_LIPS_MOUSTACHE, PFW_WIDGET_LIPS_MOUSTACHE_L, PFW_WIDGET_LIPS_MOUSTACHE_R, WIDGET_LIST_END); /* Nose buttons | male faces with moustache haven't any nose options */ - SetWindowWidgetsDisabledState(w, _pf_info[PFV_NOSE].valid_values[ge] < 2 || is_moust_male, + w->SetWidgetsDisabledState(_pf_info[PFV_NOSE].valid_values[ge] < 2 || is_moust_male, PFW_WIDGET_NOSE, PFW_WIDGET_NOSE_L, PFW_WIDGET_NOSE_R, WIDGET_LIST_END); /* Hair buttons */ - SetWindowWidgetsDisabledState(w, _pf_info[PFV_HAIR].valid_values[ge] < 2, + w->SetWidgetsDisabledState(_pf_info[PFV_HAIR].valid_values[ge] < 2, PFW_WIDGET_HAIR, PFW_WIDGET_HAIR_L, PFW_WIDGET_HAIR_R, WIDGET_LIST_END); /* Jacket buttons */ - SetWindowWidgetsDisabledState(w, _pf_info[PFV_JACKET].valid_values[ge] < 2, + w->SetWidgetsDisabledState(_pf_info[PFV_JACKET].valid_values[ge] < 2, PFW_WIDGET_JACKET, PFW_WIDGET_JACKET_L, PFW_WIDGET_JACKET_R, WIDGET_LIST_END); /* Collar buttons */ - SetWindowWidgetsDisabledState(w, _pf_info[PFV_COLLAR].valid_values[ge] < 2, + w->SetWidgetsDisabledState(_pf_info[PFV_COLLAR].valid_values[ge] < 2, PFW_WIDGET_COLLAR, PFW_WIDGET_COLLAR_L, PFW_WIDGET_COLLAR_R, WIDGET_LIST_END); /* Tie/earring buttons | female faces without earring haven't any earring options */ - SetWindowWidgetsDisabledState(w, _pf_info[PFV_TIE_EARRING].valid_values[ge] < 2 || + w->SetWidgetsDisabledState(_pf_info[PFV_TIE_EARRING].valid_values[ge] < 2 || (is_female && GetPlayerFaceBits(*pf, PFV_HAS_TIE_EARRING, ge) == 0), PFW_WIDGET_TIE_EARRING, PFW_WIDGET_TIE_EARRING_L, PFW_WIDGET_TIE_EARRING_R, WIDGET_LIST_END); /* Glasses buttons | faces without glasses haven't any glasses options */ - SetWindowWidgetsDisabledState(w, _pf_info[PFV_GLASSES].valid_values[ge] < 2 || GetPlayerFaceBits(*pf, PFV_HAS_GLASSES, ge) == 0, + w->SetWidgetsDisabledState(_pf_info[PFV_GLASSES].valid_values[ge] < 2 || GetPlayerFaceBits(*pf, PFV_HAS_GLASSES, ge) == 0, PFW_WIDGET_GLASSES, PFW_WIDGET_GLASSES_L, PFW_WIDGET_GLASSES_R, WIDGET_LIST_END); } @@ -1074,34 +1074,34 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e) const Player *p = GetPlayer((PlayerID)w->window_number); bool local = w->window_number == _local_player; - SetWindowWidgetHiddenState(w, PCW_WIDGET_NEW_FACE, !local); - SetWindowWidgetHiddenState(w, PCW_WIDGET_COLOR_SCHEME, !local); - SetWindowWidgetHiddenState(w, PCW_WIDGET_PRESIDENT_NAME, !local); - SetWindowWidgetHiddenState(w, PCW_WIDGET_COMPANY_NAME, !local); + w->SetWidgetHiddenState(PCW_WIDGET_NEW_FACE, !local); + w->SetWidgetHiddenState(PCW_WIDGET_COLOR_SCHEME, !local); + w->SetWidgetHiddenState(PCW_WIDGET_PRESIDENT_NAME, !local); + w->SetWidgetHiddenState(PCW_WIDGET_COMPANY_NAME, !local); w->widget[PCW_WIDGET_BUILD_VIEW_HQ].data = (local && p->location_of_house == 0) ? STR_706F_BUILD_HQ : STR_7072_VIEW_HQ; if (local && p->location_of_house != 0) w->widget[PCW_WIDGET_BUILD_VIEW_HQ].type = WWT_PUSHTXTBTN; //HQ is already built. - SetWindowWidgetDisabledState(w, PCW_WIDGET_BUILD_VIEW_HQ, !local && p->location_of_house == 0); - SetWindowWidgetHiddenState(w, PCW_WIDGET_RELOCATE_HQ, !local || p->location_of_house == 0); - SetWindowWidgetHiddenState(w, PCW_WIDGET_BUY_SHARE, local); - SetWindowWidgetHiddenState(w, PCW_WIDGET_SELL_SHARE, local); - SetWindowWidgetHiddenState(w, PCW_WIDGET_COMPANY_PASSWORD, !local || !_networking); + w->SetWidgetDisabledState(PCW_WIDGET_BUILD_VIEW_HQ, !local && p->location_of_house == 0); + w->SetWidgetHiddenState(PCW_WIDGET_RELOCATE_HQ, !local || p->location_of_house == 0); + w->SetWidgetHiddenState(PCW_WIDGET_BUY_SHARE, local); + w->SetWidgetHiddenState(PCW_WIDGET_SELL_SHARE, local); + w->SetWidgetHiddenState(PCW_WIDGET_COMPANY_PASSWORD, !local || !_networking); if (!local) { if (_patches.allow_shares) { // Shares are allowed /* If all shares are owned by someone (none by nobody), disable buy button */ - SetWindowWidgetDisabledState(w, PCW_WIDGET_BUY_SHARE, GetAmountOwnedBy(p, PLAYER_SPECTATOR) == 0 || + w->SetWidgetDisabledState(PCW_WIDGET_BUY_SHARE, GetAmountOwnedBy(p, PLAYER_SPECTATOR) == 0 || /* Only 25% left to buy. If the player is human, disable buying it up.. TODO issues! */ (GetAmountOwnedBy(p, PLAYER_SPECTATOR) == 1 && !p->is_ai) || /* Spectators cannot do anything of course */ _local_player == PLAYER_SPECTATOR); /* If the player doesn't own any shares, disable sell button */ - SetWindowWidgetDisabledState(w, PCW_WIDGET_SELL_SHARE, (GetAmountOwnedBy(p, _local_player) == 0) || + w->SetWidgetDisabledState(PCW_WIDGET_SELL_SHARE, (GetAmountOwnedBy(p, _local_player) == 0) || /* Spectators cannot do anything of course */ _local_player == PLAYER_SPECTATOR); } else { // Shares are not allowed, disable buy/sell buttons - DisableWindowWidget(w, PCW_WIDGET_BUY_SHARE); - DisableWindowWidget(w, PCW_WIDGET_SELL_SHARE); + w->DisableWidget(PCW_WIDGET_BUY_SHARE); + w->DisableWidget(PCW_WIDGET_SELL_SHARE); } } @@ -1149,7 +1149,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e) wf->caption_color = wf->window_number; WP(wf, livery_d).livery_class = LC_OTHER; WP(wf, livery_d).sel = 1; - LowerWindowWidget(wf, 2); + wf->LowerWidget(2); } break; } @@ -1177,7 +1177,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e) return; SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, VHM_RECT, w); SetTileSelectSize(2, 2); - LowerWindowWidget(w, PCW_WIDGET_BUILD_VIEW_HQ); + w->LowerWidget(PCW_WIDGET_BUILD_VIEW_HQ); InvalidateWidget(w, PCW_WIDGET_BUILD_VIEW_HQ); } else { ScrollMainWindowToTile(tile); @@ -1188,7 +1188,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e) case PCW_WIDGET_RELOCATE_HQ: SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, VHM_RECT, w); SetTileSelectSize(2, 2); - LowerWindowWidget(w, PCW_WIDGET_RELOCATE_HQ); + w->LowerWidget(PCW_WIDGET_RELOCATE_HQ); InvalidateWidget(w, PCW_WIDGET_RELOCATE_HQ); break; diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index d01d9ef5f..1df4f5807 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -343,12 +343,12 @@ static void BuildRailClick_Tunnel(Window *w) static void BuildRailClick_Remove(Window *w) { - if (IsWindowWidgetDisabled(w, RTW_REMOVE)) return; + if (w->IsWidgetDisabled(RTW_REMOVE)) return; SetWindowDirty(w); SndPlayFx(SND_15_BEEP); - ToggleWidgetLoweredState(w, RTW_REMOVE); - _remove_button_clicked = IsWindowWidgetLowered(w, RTW_REMOVE); + w->ToggleWidgetLoweredState(RTW_REMOVE); + _remove_button_clicked = w->IsWidgetLowered(RTW_REMOVE); SetSelectionRed(_remove_button_clicked); // handle station builder @@ -476,14 +476,14 @@ static void UpdateRemoveWidgetStatus(Window *w, int clicked_widget) case RTW_BUILD_SIGNALS: /* Removal button is enabled only if the rail/signal/waypoint/station * button is still lowered. Once raised, it has to be disabled */ - SetWindowWidgetDisabledState(w, RTW_REMOVE, !IsWindowWidgetLowered(w, clicked_widget)); + w->SetWidgetDisabledState(RTW_REMOVE, !w->IsWidgetLowered(clicked_widget)); break; default: /* When any other buttons than rail/signal/waypoint/station, raise and * disable the removal button */ - DisableWindowWidget(w, RTW_REMOVE); - RaiseWindowWidget(w, RTW_REMOVE); + w->DisableWidget(RTW_REMOVE); + w->RaiseWidget(RTW_REMOVE); break; } } @@ -497,7 +497,7 @@ static void UpdateRemoveWidgetStatus(Window *w, int clicked_widget) static void BuildRailToolbWndProc(Window *w, WindowEvent *e) { switch (e->event) { - case WE_CREATE: DisableWindowWidget(w, RTW_REMOVE); break; + case WE_CREATE: w->DisableWidget(RTW_REMOVE); break; case WE_PAINT: DrawWindowWidgets(w); break; @@ -528,7 +528,7 @@ static void BuildRailToolbWndProc(Window *w, WindowEvent *e) case WE_PLACE_DRAG: { /* no dragging if you have pressed the convert button */ - if (_convert_signal_button && IsWindowWidgetLowered(w, RTW_BUILD_SIGNALS)) return; + if (_convert_signal_button && w->IsWidgetLowered(RTW_BUILD_SIGNALS)) return; VpSelectTilesWithMethod(e->we.place.pt.x, e->we.place.pt.y, e->we.place.select_method); return; @@ -579,7 +579,7 @@ static void BuildRailToolbWndProc(Window *w, WindowEvent *e) case WE_ABORT_PLACE_OBJ: RaiseWindowButtons(w); - DisableWindowWidget(w, RTW_REMOVE); + w->DisableWidget(RTW_REMOVE); InvalidateWidget(w, RTW_REMOVE); w = FindWindowById(WC_BUILD_SIGNAL, 0); @@ -750,21 +750,21 @@ static void CheckSelectedSize(Window *w, const StationSpec *statspec) if (statspec == NULL || _railstation.dragdrop) return; if (HasBit(statspec->disallowed_platforms, _railstation.numtracks - 1)) { - RaiseWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); + w->RaiseWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); _railstation.numtracks = 1; while (HasBit(statspec->disallowed_platforms, _railstation.numtracks - 1)) { _railstation.numtracks++; } - LowerWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); + w->LowerWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); } if (HasBit(statspec->disallowed_lengths, _railstation.platlength - 1)) { - RaiseWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); + w->RaiseWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); _railstation.platlength = 1; while (HasBit(statspec->disallowed_lengths, _railstation.platlength - 1)) { _railstation.platlength++; } - LowerWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); + w->LowerWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); } } @@ -772,15 +772,15 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) { switch (e->event) { case WE_CREATE: - LowerWindowWidget(w, _railstation.orientation + BRSW_PLATFORM_DIR_X); + w->LowerWidget(_railstation.orientation + BRSW_PLATFORM_DIR_X); if (_railstation.dragdrop) { - LowerWindowWidget(w, BRSW_PLATFORM_DRAG_N_DROP); + w->LowerWidget(BRSW_PLATFORM_DRAG_N_DROP); } else { - LowerWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); - LowerWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); + w->LowerWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); + w->LowerWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); } - SetWindowWidgetLoweredState(w, BRSW_HIGHLIGHT_OFF, !_station_show_coverage); - SetWindowWidgetLoweredState(w, BRSW_HIGHLIGHT_ON, _station_show_coverage); + w->SetWidgetLoweredState(BRSW_HIGHLIGHT_OFF, !_station_show_coverage); + w->SetWidgetLoweredState(BRSW_HIGHLIGHT_ON, _station_show_coverage); break; case WE_PAINT: { @@ -808,11 +808,11 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) for (uint bits = 0; bits < 7; bits++) { bool disable = bits >= _patches.station_spread; if (statspec == NULL) { - SetWindowWidgetDisabledState(w, bits + BRSW_PLATFORM_NUM_1, disable); - SetWindowWidgetDisabledState(w, bits + BRSW_PLATFORM_LEN_1, disable); + w->SetWidgetDisabledState(bits + BRSW_PLATFORM_NUM_1, disable); + w->SetWidgetDisabledState(bits + BRSW_PLATFORM_LEN_1, disable); } else { - SetWindowWidgetDisabledState(w, bits + BRSW_PLATFORM_NUM_1, HasBit(statspec->disallowed_platforms, bits) || disable); - SetWindowWidgetDisabledState(w, bits + BRSW_PLATFORM_LEN_1, HasBit(statspec->disallowed_lengths, bits) || disable); + w->SetWidgetDisabledState(bits + BRSW_PLATFORM_NUM_1, HasBit(statspec->disallowed_platforms, bits) || disable); + w->SetWidgetDisabledState(bits + BRSW_PLATFORM_LEN_1, HasBit(statspec->disallowed_lengths, bits) || disable); } } @@ -873,9 +873,9 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) switch (e->we.click.widget) { case BRSW_PLATFORM_DIR_X: case BRSW_PLATFORM_DIR_Y: - RaiseWindowWidget(w, _railstation.orientation + BRSW_PLATFORM_DIR_X); + w->RaiseWidget(_railstation.orientation + BRSW_PLATFORM_DIR_X); _railstation.orientation = e->we.click.widget - BRSW_PLATFORM_DIR_X; - LowerWindowWidget(w, _railstation.orientation + BRSW_PLATFORM_DIR_X); + w->LowerWidget(_railstation.orientation + BRSW_PLATFORM_DIR_X); SndPlayFx(SND_15_BEEP); SetWindowDirty(w); break; @@ -887,8 +887,8 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) case BRSW_PLATFORM_NUM_5: case BRSW_PLATFORM_NUM_6: case BRSW_PLATFORM_NUM_7: { - RaiseWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); - RaiseWindowWidget(w, BRSW_PLATFORM_DRAG_N_DROP); + w->RaiseWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); + w->RaiseWidget(BRSW_PLATFORM_DRAG_N_DROP); _railstation.numtracks = e->we.click.widget - BRSW_PLATFORM_NUM_BEGIN; _railstation.dragdrop = false; @@ -898,15 +898,15 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) /* The previously selected number of platforms in invalid */ for (uint i = 0; i < 7; i++) { if (!HasBit(statspec->disallowed_lengths, i)) { - RaiseWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); + w->RaiseWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); _railstation.platlength = i + 1; break; } } } - LowerWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); - LowerWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); + w->LowerWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); + w->LowerWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); SndPlayFx(SND_15_BEEP); SetWindowDirty(w); break; @@ -919,8 +919,8 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) case BRSW_PLATFORM_LEN_5: case BRSW_PLATFORM_LEN_6: case BRSW_PLATFORM_LEN_7: { - RaiseWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); - RaiseWindowWidget(w, BRSW_PLATFORM_DRAG_N_DROP); + w->RaiseWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); + w->RaiseWidget(BRSW_PLATFORM_DRAG_N_DROP); _railstation.platlength = e->we.click.widget - BRSW_PLATFORM_LEN_BEGIN; _railstation.dragdrop = false; @@ -930,15 +930,15 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) /* The previously selected number of tracks in invalid */ for (uint i = 0; i < 7; i++) { if (!HasBit(statspec->disallowed_platforms, i)) { - RaiseWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); + w->RaiseWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); _railstation.numtracks = i + 1; break; } } } - LowerWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); - LowerWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); + w->LowerWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); + w->LowerWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); SndPlayFx(SND_15_BEEP); SetWindowDirty(w); break; @@ -946,14 +946,14 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) case BRSW_PLATFORM_DRAG_N_DROP: { _railstation.dragdrop ^= true; - ToggleWidgetLoweredState(w, BRSW_PLATFORM_DRAG_N_DROP); + w->ToggleWidgetLoweredState(BRSW_PLATFORM_DRAG_N_DROP); /* get the first allowed length/number of platforms */ const StationSpec *statspec = _railstation.newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL; if (statspec != NULL && HasBit(statspec->disallowed_lengths, _railstation.platlength - 1)) { for (uint i = 0; i < 7; i++) { if (!HasBit(statspec->disallowed_lengths, i)) { - RaiseWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); + w->RaiseWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); _railstation.platlength = i + 1; break; } @@ -962,15 +962,15 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) if (statspec != NULL && HasBit(statspec->disallowed_platforms, _railstation.numtracks - 1)) { for (uint i = 0; i < 7; i++) { if (!HasBit(statspec->disallowed_platforms, i)) { - RaiseWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); + w->RaiseWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); _railstation.numtracks = i + 1; break; } } } - SetWindowWidgetLoweredState(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN, !_railstation.dragdrop); - SetWindowWidgetLoweredState(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN, !_railstation.dragdrop); + w->SetWidgetLoweredState(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN, !_railstation.dragdrop); + w->SetWidgetLoweredState(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN, !_railstation.dragdrop); SndPlayFx(SND_15_BEEP); SetWindowDirty(w); } break; @@ -978,8 +978,8 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) case BRSW_HIGHLIGHT_OFF: case BRSW_HIGHLIGHT_ON: _station_show_coverage = (e->we.click.widget != BRSW_HIGHLIGHT_OFF); - SetWindowWidgetLoweredState(w, BRSW_HIGHLIGHT_OFF, !_station_show_coverage); - SetWindowWidgetLoweredState(w, BRSW_HIGHLIGHT_ON, _station_show_coverage); + w->SetWidgetLoweredState(BRSW_HIGHLIGHT_OFF, !_station_show_coverage); + w->SetWidgetLoweredState(BRSW_HIGHLIGHT_ON, _station_show_coverage); SndPlayFx(SND_15_BEEP); SetWindowDirty(w); break; @@ -1173,9 +1173,9 @@ enum BuildSignalWidgets { */ static const void DrawSignalSprite(const Window *w, byte widget_index, SpriteID image, int8 xrel, uint8 xsize) { - DrawSprite(image + IsWindowWidgetLowered(w, widget_index), PAL_NONE, + DrawSprite(image + w->IsWidgetLowered(widget_index), PAL_NONE, w->widget[widget_index].left + (w->widget[widget_index].right - w->widget[widget_index].left) / 2 - xrel - xsize / 2 + - IsWindowWidgetLowered(w, widget_index), w->widget[widget_index].bottom - 3 + IsWindowWidgetLowered(w, widget_index)); + w->IsWidgetLowered(widget_index), w->widget[widget_index].bottom - 3 + w->IsWidgetLowered(widget_index)); } /** @@ -1188,12 +1188,12 @@ static void SignalBuildWndProc(Window *w, WindowEvent *e) { switch (e->event) { case WE_PAINT: - LowerWindowWidget(w, (_cur_signal_variant == SIG_ELECTRIC ? BSW_ELECTRIC_NORM : BSW_SEMAPHORE_NORM) + _cur_signal_type); + w->LowerWidget((_cur_signal_variant == SIG_ELECTRIC ? BSW_ELECTRIC_NORM : BSW_SEMAPHORE_NORM) + _cur_signal_type); - SetWindowWidgetLoweredState(w, BSW_CONVERT, _convert_signal_button); + w->SetWidgetLoweredState(BSW_CONVERT, _convert_signal_button); - SetWindowWidgetDisabledState(w, BSW_DRAG_SIGNALS_DENSITY_DECREASE, _patches.drag_signals_density == 1); - SetWindowWidgetDisabledState(w, BSW_DRAG_SIGNALS_DENSITY_INCREASE, _patches.drag_signals_density == 20); + w->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_DECREASE, _patches.drag_signals_density == 1); + w->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_INCREASE, _patches.drag_signals_density == 20); DrawWindowWidgets(w); @@ -1224,7 +1224,7 @@ static void SignalBuildWndProc(Window *w, WindowEvent *e) case BSW_ELECTRIC_ENTRY: case BSW_ELECTRIC_EXIT: case BSW_ELECTRIC_COMBO: - RaiseWindowWidget(w, (_cur_signal_variant == SIG_ELECTRIC ? BSW_ELECTRIC_NORM : BSW_SEMAPHORE_NORM) + _cur_signal_type); + w->RaiseWidget((_cur_signal_variant == SIG_ELECTRIC ? BSW_ELECTRIC_NORM : BSW_SEMAPHORE_NORM) + _cur_signal_type); _cur_signal_type = (SignalType)((uint)((e->we.click.widget - BSW_SEMAPHORE_NORM) % (SIGTYPE_COMBO + 1))); _cur_signal_variant = e->we.click.widget >= BSW_ELECTRIC_NORM ? SIG_ELECTRIC : SIG_SEMAPHORE; @@ -1317,7 +1317,7 @@ enum BuildRailDepotWidgets { static void BuildTrainDepotWndProc(Window *w, WindowEvent *e) { switch (e->event) { - case WE_CREATE: LowerWindowWidget(w, _build_depot_direction + BRDW_DEPOT_NE); break; + case WE_CREATE: w->LowerWidget(_build_depot_direction + BRDW_DEPOT_NE); break; case WE_PAINT: { DrawWindowWidgets(w); @@ -1335,9 +1335,9 @@ static void BuildTrainDepotWndProc(Window *w, WindowEvent *e) case BRDW_DEPOT_SE: case BRDW_DEPOT_SW: case BRDW_DEPOT_NW: - RaiseWindowWidget(w, _build_depot_direction + BRDW_DEPOT_NE); + w->RaiseWidget(_build_depot_direction + BRDW_DEPOT_NE); _build_depot_direction = (DiagDirection)(e->we.click.widget - BRDW_DEPOT_NE); - LowerWindowWidget(w, _build_depot_direction + BRDW_DEPOT_NE); + w->LowerWidget(_build_depot_direction + BRDW_DEPOT_NE); SndPlayFx(SND_15_BEEP); SetWindowDirty(w); break; @@ -1399,7 +1399,7 @@ static void BuildWaypointWndProc(Window *w, WindowEvent *e) uint i; for (i = 0; i < w->hscroll.cap; i++) { - SetWindowWidgetLoweredState(w, i + BRWW_WAYPOINT_1, (w->hscroll.pos + i) == _cur_waypoint_type); + w->SetWidgetLoweredState(i + BRWW_WAYPOINT_1, (w->hscroll.pos + i) == _cur_waypoint_type); } DrawWindowWidgets(w); diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 3c3b821d6..5e9abf4de 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -317,9 +317,9 @@ static void BuildRoadClick_TruckStation(Window *w) */ static void BuildRoadClick_OneWay(Window *w) { - if (IsWindowWidgetDisabled(w, RTW_ONE_WAY)) return; + if (w->IsWidgetDisabled(RTW_ONE_WAY)) return; SetWindowDirty(w); - ToggleWidgetLoweredState(w, RTW_ONE_WAY); + w->ToggleWidgetLoweredState(RTW_ONE_WAY); SetSelectionRed(false); } @@ -335,11 +335,11 @@ static void BuildRoadClick_Tunnel(Window *w) static void BuildRoadClick_Remove(Window *w) { - if (IsWindowWidgetDisabled(w, RTW_REMOVE)) return; + if (w->IsWidgetDisabled(RTW_REMOVE)) return; SetWindowDirty(w); SndPlayFx(SND_15_BEEP); - ToggleWidgetLoweredState(w, RTW_REMOVE); - SetSelectionRed(IsWindowWidgetLowered(w, RTW_REMOVE)); + w->ToggleWidgetLoweredState(RTW_REMOVE); + SetSelectionRed(w->IsWidgetLowered(RTW_REMOVE)); } /** Array with the handlers of the button-clicks for the road-toolbar */ @@ -385,20 +385,20 @@ static void UpdateOptionWidgetStatus(Window *w, int clicked_widget) * Both are only valid if they are able to apply as options. */ switch (clicked_widget) { case RTW_REMOVE: - RaiseWindowWidget(w, RTW_ONE_WAY); + w->RaiseWidget(RTW_ONE_WAY); break; case RTW_ONE_WAY: - RaiseWindowWidget(w, RTW_REMOVE); + w->RaiseWidget(RTW_REMOVE); break; case RTW_BUS_STATION: case RTW_TRUCK_STATION: - DisableWindowWidget(w, RTW_ONE_WAY); - SetWindowWidgetDisabledState(w, RTW_REMOVE, !IsWindowWidgetLowered(w, clicked_widget)); + w->DisableWidget(RTW_ONE_WAY); + w->SetWidgetDisabledState(RTW_REMOVE, !w->IsWidgetLowered(clicked_widget)); break; case RTW_ROAD_X: case RTW_ROAD_Y: case RTW_AUTOROAD: - SetWindowWidgetsDisabledState(w, !IsWindowWidgetLowered(w, clicked_widget), + w->SetWidgetsDisabledState(!w->IsWidgetLowered(clicked_widget), RTW_REMOVE, RTW_ONE_WAY, WIDGET_LIST_END); @@ -406,11 +406,11 @@ static void UpdateOptionWidgetStatus(Window *w, int clicked_widget) default: /* When any other buttons than road/station, raise and * disable the removal button */ - SetWindowWidgetsDisabledState(w, true, + w->SetWidgetsDisabledState(true, RTW_REMOVE, RTW_ONE_WAY, WIDGET_LIST_END); - SetWindowWidgetsLoweredState (w, false, + w->SetWidgetsLoweredState (false, RTW_REMOVE, RTW_ONE_WAY, WIDGET_LIST_END); @@ -422,14 +422,14 @@ static void BuildRoadToolbWndProc(Window *w, WindowEvent *e) { switch (e->event) { case WE_CREATE: - SetWindowWidgetsDisabledState(w, true, + w->SetWidgetsDisabledState(true, RTW_REMOVE, RTW_ONE_WAY, WIDGET_LIST_END); break; case WE_PAINT: - SetWindowWidgetsDisabledState(w, !CanBuildVehicleInfrastructure(VEH_ROAD), + w->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_ROAD), RTW_DEPOT, RTW_BUS_STATION, RTW_TRUCK_STATION, @@ -461,14 +461,14 @@ static void BuildRoadToolbWndProc(Window *w, WindowEvent *e) break; case WE_PLACE_OBJ: - _remove_button_clicked = IsWindowWidgetLowered(w, RTW_REMOVE); - _one_way_button_clicked = IsWindowWidgetLowered(w, RTW_ONE_WAY); + _remove_button_clicked = w->IsWidgetLowered(RTW_REMOVE); + _one_way_button_clicked = w->IsWidgetLowered(RTW_ONE_WAY); _place_proc(e->we.place.tile); break; case WE_ABORT_PLACE_OBJ: RaiseWindowButtons(w); - DisableWindowWidget(w, RTW_REMOVE); + w->DisableWidget(RTW_REMOVE); InvalidateWidget(w, RTW_REMOVE); w = FindWindowById(WC_BUS_STATION, 0); @@ -681,7 +681,7 @@ enum BuildRoadDepotWidgets { static void BuildRoadDepotWndProc(Window *w, WindowEvent *e) { switch (e->event) { - case WE_CREATE: LowerWindowWidget(w, _road_depot_orientation + BRDW_DEPOT_NE); break; + case WE_CREATE: w->LowerWidget(_road_depot_orientation + BRDW_DEPOT_NE); break; case WE_PAINT: DrawWindowWidgets(w); @@ -698,9 +698,9 @@ static void BuildRoadDepotWndProc(Window *w, WindowEvent *e) case BRDW_DEPOT_NE: case BRDW_DEPOT_SW: case BRDW_DEPOT_SE: - RaiseWindowWidget(w, _road_depot_orientation + BRDW_DEPOT_NE); + w->RaiseWidget(_road_depot_orientation + BRDW_DEPOT_NE); _road_depot_orientation = (DiagDirection)(e->we.click.widget - BRDW_DEPOT_NE); - LowerWindowWidget(w, _road_depot_orientation + BRDW_DEPOT_NE); + w->LowerWidget(_road_depot_orientation + BRDW_DEPOT_NE); SndPlayFx(SND_15_BEEP); SetWindowDirty(w); break; @@ -786,15 +786,15 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e) if (_cur_roadtype == ROADTYPE_TRAM && _road_station_picker_orientation < DIAGDIR_END) { _road_station_picker_orientation = DIAGDIR_END; } - SetWindowWidgetsDisabledState(w, _cur_roadtype == ROADTYPE_TRAM, + w->SetWidgetsDisabledState(_cur_roadtype == ROADTYPE_TRAM, BRSW_STATION_NE, BRSW_STATION_SE, BRSW_STATION_SW, BRSW_STATION_NW, WIDGET_LIST_END); - LowerWindowWidget(w, _road_station_picker_orientation + BRSW_STATION_NE); - LowerWindowWidget(w, _station_show_coverage + BRSW_LT_OFF); + w->LowerWidget(_road_station_picker_orientation + BRSW_STATION_NE); + w->LowerWidget(_station_show_coverage + BRSW_LT_OFF); break; case WE_PAINT: { @@ -833,18 +833,18 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e) case BRSW_STATION_NW: case BRSW_STATION_X: case BRSW_STATION_Y: - RaiseWindowWidget(w, _road_station_picker_orientation + BRSW_STATION_NE); + w->RaiseWidget(_road_station_picker_orientation + BRSW_STATION_NE); _road_station_picker_orientation = (DiagDirection)(e->we.click.widget - BRSW_STATION_NE); - LowerWindowWidget(w, _road_station_picker_orientation + BRSW_STATION_NE); + w->LowerWidget(_road_station_picker_orientation + BRSW_STATION_NE); SndPlayFx(SND_15_BEEP); SetWindowDirty(w); break; case BRSW_LT_OFF: case BRSW_LT_ON: - RaiseWindowWidget(w, _station_show_coverage + BRSW_LT_OFF); + w->RaiseWidget(_station_show_coverage + BRSW_LT_OFF); _station_show_coverage = (e->we.click.widget != BRSW_LT_OFF); - LowerWindowWidget(w, _station_show_coverage + BRSW_LT_OFF); + w->LowerWidget(_station_show_coverage + BRSW_LT_OFF); SndPlayFx(SND_15_BEEP); SetWindowDirty(w); break; diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index c5097cdd7..4417019ed 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -140,8 +140,8 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e) int i; StringID str = STR_02BE_DEFAULT; - SetWindowWidgetDisabledState(w, 21, !(_vehicle_design_names & 1)); - if (!IsWindowWidgetDisabled(w, 21)) str = STR_02BF_CUSTOM; + w->SetWidgetDisabledState(21, !(_vehicle_design_names & 1)); + if (!w->IsWidgetDisabled(21)) str = STR_02BF_CUSTOM; SetDParam(0, str); SetDParam(1, _currency_specs[_opt_ptr->currency].name); SetDParam(2, STR_UNITS_IMPERIAL + _opt_ptr->units); @@ -152,7 +152,7 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e) i = GetCurRes(); SetDParam(7, i == _num_resolutions ? STR_RES_OTHER : SPECSTR_RESOLUTION_START + i); SetDParam(8, SPECSTR_SCREENSHOT_START + _cur_screenshot_format); - SetWindowWidgetLoweredState(w, 28, _fullscreen); + w->SetWidgetLoweredState(28, _fullscreen); DrawWindowWidgets(w); DrawString(20, 175, STR_OPTIONS_FULLSCREEN, TC_FROMSTRING); // fullscreen @@ -202,7 +202,7 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e) ShowDropDownMenu(w, BuildDynamicDropdown(SPECSTR_RESOLUTION_START, _num_resolutions), GetCurRes(), 27, 0, 0); return; case 28: /* Click fullscreen on/off */ - SetWindowWidgetLoweredState(w, 28, !_fullscreen); + w->SetWidgetLoweredState(28, !_fullscreen); ToggleFullScreen(!_fullscreen); // toggle full-screen on/off SetWindowDirty(w); return; @@ -452,13 +452,13 @@ static void GameDifficultyWndProc(Window *w, WindowEvent *e) switch (e->event) { case WE_CREATE: // Setup disabled buttons when creating window /* disable all other difficulty buttons during gameplay except for 'custom' */ - SetWindowWidgetDisabledState(w, 3, _game_mode == GM_NORMAL); - SetWindowWidgetDisabledState(w, 4, _game_mode == GM_NORMAL); - SetWindowWidgetDisabledState(w, 5, _game_mode == GM_NORMAL); - SetWindowWidgetDisabledState(w, 6, _game_mode == GM_NORMAL); - SetWindowWidgetDisabledState(w, 7, _game_mode == GM_EDITOR || _networking); // highscore chart in multiplayer - SetWindowWidgetDisabledState(w, 10, _networking && !_network_server); // Save-button in multiplayer (and if client) - LowerWindowWidget(w, _opt_mod_temp.diff_level + 3); + w->SetWidgetDisabledState( 3, _game_mode == GM_NORMAL); + w->SetWidgetDisabledState( 4, _game_mode == GM_NORMAL); + w->SetWidgetDisabledState( 5, _game_mode == GM_NORMAL); + w->SetWidgetDisabledState( 6, _game_mode == GM_NORMAL); + w->SetWidgetDisabledState( 7, _game_mode == GM_EDITOR || _networking); // highscore chart in multiplayer + w->SetWidgetDisabledState(10, _networking && !_network_server); // Save-button in multiplayer (and if client) + w->LowerWidget(_opt_mod_temp.diff_level + 3); break; case WE_PAINT: { @@ -547,16 +547,16 @@ static void GameDifficultyWndProc(Window *w, WindowEvent *e) // save value in temporary variable ((GDType*)&_opt_mod_temp.diff)[btn] = val; - RaiseWindowWidget(w, _opt_mod_temp.diff_level + 3); + w->RaiseWidget(_opt_mod_temp.diff_level + 3); SetDifficultyLevel(3, &_opt_mod_temp); // set difficulty level to custom - LowerWindowWidget(w, _opt_mod_temp.diff_level + 3); + w->LowerWidget(_opt_mod_temp.diff_level + 3); SetWindowDirty(w); } break; case 3: case 4: case 5: case 6: /* Easy / Medium / Hard / Custom */ // temporarily change difficulty level - RaiseWindowWidget(w, _opt_mod_temp.diff_level + 3); + w->RaiseWidget(_opt_mod_temp.diff_level + 3); SetDifficultyLevel(e->we.click.widget - 3, &_opt_mod_temp); - LowerWindowWidget(w, _opt_mod_temp.diff_level + 3); + w->LowerWidget(_opt_mod_temp.diff_level + 3); SetWindowDirty(w); break; case 7: /* Highscore Table */ @@ -805,7 +805,7 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e) } first_time = false; } - LowerWindowWidget(w, 4); + w->LowerWidget(4); } break; case WE_PAINT: { @@ -954,9 +954,9 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e) break; } case 4: case 5: case 6: case 7: case 8: case 9: - RaiseWindowWidget(w, WP(w, def_d).data_1 + 4); + w->RaiseWidget(WP(w, def_d).data_1 + 4); WP(w, def_d).data_1 = e->we.click.widget - 4; - LowerWindowWidget(w, WP(w, def_d).data_1 + 4); + w->LowerWidget(WP(w, def_d).data_1 + 4); DeleteWindowById(WC_QUERY_STRING, 0); SetWindowDirty(w); break; diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index b792ad488..81b7abd93 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -315,7 +315,7 @@ void ShowRenameSignWindow(const Sign *si) WP(w, editsign_d).caption = STR_280B_EDIT_SIGN_TEXT; WP(w, editsign_d).afilter = CS_ALPHANUMERAL; - LowerWindowWidget(w, QUERY_EDIT_SIGN_WIDGET_TEXT); + w->LowerWidget(QUERY_EDIT_SIGN_WIDGET_TEXT); UpdateSignEditWindow(w, si); } diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index e4214ab92..02fe6d1c3 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -805,8 +805,8 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e) DrawPixelInfo new_dpi; /* Hide Enable all/Disable all buttons if is not industry type small map*/ - SetWindowWidgetHiddenState(w, SM_WIDGET_ENABLEINDUSTRIES, _smallmap_type != SMT_INDUSTRY); - SetWindowWidgetHiddenState(w, SM_WIDGET_DISABLEINDUSTRIES, _smallmap_type != SMT_INDUSTRY); + w->SetWidgetHiddenState(SM_WIDGET_ENABLEINDUSTRIES, _smallmap_type != SMT_INDUSTRY); + w->SetWidgetHiddenState(SM_WIDGET_DISABLEINDUSTRIES, _smallmap_type != SMT_INDUSTRY); /* draw the window */ SetDParam(0, STR_00E5_CONTOURS + _smallmap_type); @@ -891,9 +891,9 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e) case SM_WIDGET_ROUTES: // Show transport routes case SM_WIDGET_VEGETATION: // Show vegetation case SM_WIDGET_OWNERS: // Show land owners - RaiseWindowWidget(w, _smallmap_type + SM_WIDGET_CONTOUR); + w->RaiseWidget(_smallmap_type + SM_WIDGET_CONTOUR); _smallmap_type = e->we.click.widget - SM_WIDGET_CONTOUR; - LowerWindowWidget(w, _smallmap_type + SM_WIDGET_CONTOUR); + w->LowerWidget(_smallmap_type + SM_WIDGET_CONTOUR); SetWindowDirty(w); SndPlayFx(SND_15_BEEP); @@ -907,8 +907,8 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e) break; case SM_WIDGET_TOGGLETOWNNAME: // Toggle town names - ToggleWidgetLoweredState(w, SM_WIDGET_TOGGLETOWNNAME); - _smallmap_show_towns = IsWindowWidgetLowered(w, SM_WIDGET_TOGGLETOWNNAME); + w->ToggleWidgetLoweredState(SM_WIDGET_TOGGLETOWNNAME); + _smallmap_show_towns = w->IsWidgetLowered(SM_WIDGET_TOGGLETOWNNAME); SetWindowDirty(w); SndPlayFx(SND_15_BEEP); @@ -940,8 +940,8 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e) } } /* Raise the two buttons "all", as we have done a specific choice */ - RaiseWindowWidget(w, SM_WIDGET_ENABLEINDUSTRIES); - RaiseWindowWidget(w, SM_WIDGET_DISABLEINDUSTRIES); + w->RaiseWidget(SM_WIDGET_ENABLEINDUSTRIES); + w->RaiseWidget(SM_WIDGET_DISABLEINDUSTRIES); SetWindowDirty(w); } break; @@ -951,8 +951,8 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e) _legend_from_industries[i].show_on_map = true; } /* toggle appeareance indicating the choice */ - LowerWindowWidget(w, SM_WIDGET_ENABLEINDUSTRIES); - RaiseWindowWidget(w, SM_WIDGET_DISABLEINDUSTRIES); + w->LowerWidget(SM_WIDGET_ENABLEINDUSTRIES); + w->RaiseWidget(SM_WIDGET_DISABLEINDUSTRIES); SetWindowDirty(w); break; @@ -961,8 +961,8 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e) _legend_from_industries[i].show_on_map = false; } /* toggle appeareance indicating the choice */ - RaiseWindowWidget(w, SM_WIDGET_ENABLEINDUSTRIES); - LowerWindowWidget(w, SM_WIDGET_DISABLEINDUSTRIES); + w->RaiseWidget(SM_WIDGET_ENABLEINDUSTRIES); + w->LowerWidget(SM_WIDGET_DISABLEINDUSTRIES); SetWindowDirty(w); break; } @@ -1085,8 +1085,8 @@ void ShowSmallMap() } } - LowerWindowWidget(w, _smallmap_type + SMT_OWNER); - SetWindowWidgetLoweredState(w, SM_WIDGET_TOGGLETOWNNAME, _smallmap_show_towns); + w->LowerWidget(_smallmap_type + SMT_OWNER); + w->SetWidgetLoweredState(SM_WIDGET_TOGGLETOWNNAME, _smallmap_show_towns); SmallMapCenterOnCurrentPos(w); } @@ -1115,7 +1115,7 @@ static void ExtraViewPortWndProc(Window *w, WindowEvent *e) /* New viewport start at (zero,zero) */ AssignWindowViewport(w, 3, 17, w->widget[4].right - w->widget[4].left - 1, w->widget[4].bottom - w->widget[4].top - 1, 0, ZOOM_LVL_VIEWPORT); - DisableWindowWidget(w, 5); + w->DisableWidget(5); break; case WE_PAINT: diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 3c8d9119c..04438acd5 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -290,11 +290,11 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e) if (_cargo_filter == _cargo_filter_max) _cargo_filter = _cargo_mask; for (uint i = 0; i < 5; i++) { - if (HasBit(facilities, i)) LowerWindowWidget(w, i + STATIONLIST_WIDGET_TRAIN); + if (HasBit(facilities, i)) w->LowerWidget(i + STATIONLIST_WIDGET_TRAIN); } - SetWindowWidgetLoweredState(w, STATIONLIST_WIDGET_FACILALL, facilities == (FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK)); - SetWindowWidgetLoweredState(w, STATIONLIST_WIDGET_CARGOALL, _cargo_filter == _cargo_mask && include_empty); - SetWindowWidgetLoweredState(w, STATIONLIST_WIDGET_NOCARGOWAITING, include_empty); + w->SetWidgetLoweredState(STATIONLIST_WIDGET_FACILALL, facilities == (FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK)); + w->SetWidgetLoweredState(STATIONLIST_WIDGET_CARGOALL, _cargo_filter == _cargo_mask && include_empty); + w->SetWidgetLoweredState(STATIONLIST_WIDGET_NOCARGOWAITING, include_empty); sl->sort_list = NULL; sl->flags = SL_REBUILD; @@ -337,13 +337,13 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e) } x += 6; - cg_ofst = IsWindowWidgetLowered(w, STATIONLIST_WIDGET_NOCARGOWAITING) ? 2 : 1; + cg_ofst = w->IsWidgetLowered(STATIONLIST_WIDGET_NOCARGOWAITING) ? 2 : 1; DrawStringCentered(x + cg_ofst, y + cg_ofst, STR_ABBREV_NONE, TC_BLACK); x += 14; - cg_ofst = IsWindowWidgetLowered(w, STATIONLIST_WIDGET_CARGOALL) ? 2 : 1; + cg_ofst = w->IsWidgetLowered(STATIONLIST_WIDGET_CARGOALL) ? 2 : 1; DrawStringCentered(x + cg_ofst, y + cg_ofst, STR_ABBREV_ALL, TC_BLACK); - cg_ofst = IsWindowWidgetLowered(w, STATIONLIST_WIDGET_FACILALL) ? 2 : 1; + cg_ofst = w->IsWidgetLowered(STATIONLIST_WIDGET_FACILALL) ? 2 : 1; DrawString(71 + cg_ofst, y + cg_ofst, STR_ABBREV_ALL, TC_BLACK); if (w->vscroll.count == 0) { // player has no stations @@ -401,24 +401,24 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e) case STATIONLIST_WIDGET_SHIP: if (_ctrl_pressed) { ToggleBit(facilities, e->we.click.widget - STATIONLIST_WIDGET_TRAIN); - ToggleWidgetLoweredState(w, e->we.click.widget); + w->ToggleWidgetLoweredState(e->we.click.widget); } else { for (uint i = 0; facilities != 0; i++, facilities >>= 1) { - if (HasBit(facilities, 0)) RaiseWindowWidget(w, i + STATIONLIST_WIDGET_TRAIN); + if (HasBit(facilities, 0)) w->RaiseWidget(i + STATIONLIST_WIDGET_TRAIN); } SetBit(facilities, e->we.click.widget - STATIONLIST_WIDGET_TRAIN); - LowerWindowWidget(w, e->we.click.widget); + w->LowerWidget(e->we.click.widget); } - SetWindowWidgetLoweredState(w, STATIONLIST_WIDGET_FACILALL, facilities == (FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK)); + w->SetWidgetLoweredState(STATIONLIST_WIDGET_FACILALL, facilities == (FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK)); sl->flags |= SL_REBUILD; SetWindowDirty(w); break; case STATIONLIST_WIDGET_FACILALL: for (uint i = 0; i < 5; i++) { - LowerWindowWidget(w, i + STATIONLIST_WIDGET_TRAIN); + w->LowerWidget(i + STATIONLIST_WIDGET_TRAIN); } - LowerWindowWidget(w, STATIONLIST_WIDGET_FACILALL); + w->LowerWidget(STATIONLIST_WIDGET_FACILALL); facilities = FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK; sl->flags |= SL_REBUILD; @@ -429,11 +429,11 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e) uint i = 0; for (CargoID c = 0; c < NUM_CARGO; c++) { if (!GetCargo(c)->IsValid()) continue; - LowerWindowWidget(w, i + STATIONLIST_WIDGET_CARGOSTART); + w->LowerWidget(i + STATIONLIST_WIDGET_CARGOSTART); i++; } - LowerWindowWidget(w, STATIONLIST_WIDGET_NOCARGOWAITING); - LowerWindowWidget(w, STATIONLIST_WIDGET_CARGOALL); + w->LowerWidget(STATIONLIST_WIDGET_NOCARGOWAITING); + w->LowerWidget(STATIONLIST_WIDGET_CARGOALL); _cargo_filter = _cargo_mask; include_empty = true; @@ -447,7 +447,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e) station_sort.order = HasBit(sl->flags, 0); sl->flags |= SL_RESORT; w->flags4 |= 5 << WF_TIMEOUT_SHL; - LowerWindowWidget(w, STATIONLIST_WIDGET_SORTBY); + w->LowerWidget(STATIONLIST_WIDGET_SORTBY); SetWindowDirty(w); break; @@ -459,19 +459,19 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e) case STATIONLIST_WIDGET_NOCARGOWAITING: if (_ctrl_pressed) { include_empty = !include_empty; - ToggleWidgetLoweredState(w, STATIONLIST_WIDGET_NOCARGOWAITING); + w->ToggleWidgetLoweredState(STATIONLIST_WIDGET_NOCARGOWAITING); } else { for (uint i = STATIONLIST_WIDGET_CARGOSTART; i < w->widget_count; i++) { - RaiseWindowWidget(w, i); + w->RaiseWidget(i); } _cargo_filter = 0; include_empty = true; - LowerWindowWidget(w, STATIONLIST_WIDGET_NOCARGOWAITING); + w->LowerWidget(STATIONLIST_WIDGET_NOCARGOWAITING); } sl->flags |= SL_REBUILD; - SetWindowWidgetLoweredState(w, STATIONLIST_WIDGET_CARGOALL, _cargo_filter == _cargo_mask && include_empty); + w->SetWidgetLoweredState(STATIONLIST_WIDGET_CARGOALL, _cargo_filter == _cargo_mask && include_empty); SetWindowDirty(w); break; @@ -488,21 +488,21 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e) if (_ctrl_pressed) { ToggleBit(_cargo_filter, c); - ToggleWidgetLoweredState(w, e->we.click.widget); + w->ToggleWidgetLoweredState(e->we.click.widget); } else { for (uint i = STATIONLIST_WIDGET_CARGOSTART; i < w->widget_count; i++) { - RaiseWindowWidget(w, i); + w->RaiseWidget(i); } - RaiseWindowWidget(w, STATIONLIST_WIDGET_NOCARGOWAITING); + w->RaiseWidget(STATIONLIST_WIDGET_NOCARGOWAITING); _cargo_filter = 0; include_empty = false; SetBit(_cargo_filter, c); - LowerWindowWidget(w, e->we.click.widget); + w->LowerWidget(e->we.click.widget); } sl->flags |= SL_REBUILD; - SetWindowWidgetLoweredState(w, STATIONLIST_WIDGET_CARGOALL, _cargo_filter == _cargo_mask && include_empty); + w->SetWidgetLoweredState(STATIONLIST_WIDGET_CARGOALL, _cargo_filter == _cargo_mask && include_empty); SetWindowDirty(w); } break; @@ -529,7 +529,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e) break; case WE_TIMEOUT: - RaiseWindowWidget(w, STATIONLIST_WIDGET_SORTBY); + w->RaiseWidget(STATIONLIST_WIDGET_SORTBY); SetWindowDirty(w); break; @@ -615,7 +615,7 @@ void ShowPlayerStations(PlayerID player) wi->data = 0; wi->tooltips = STR_USE_CTRL_TO_SELECT_MORE; - if (HasBit(_cargo_filter, c)) LowerWindowWidget(w, STATIONLIST_WIDGET_CARGOSTART + i); + if (HasBit(_cargo_filter, c)) w->LowerWidget(STATIONLIST_WIDGET_CARGOSTART + i); i++; } @@ -710,11 +710,11 @@ static void DrawStationViewWindow(Window *w) } SetVScrollCount(w, num); - SetWindowWidgetDisabledState(w, 9, st->owner != _local_player); - SetWindowWidgetDisabledState(w, 10, !(st->facilities & FACIL_TRAIN)); - SetWindowWidgetDisabledState(w, 11, !(st->facilities & FACIL_TRUCK_STOP) && !(st->facilities & FACIL_BUS_STOP)); - SetWindowWidgetDisabledState(w, 12, !(st->facilities & FACIL_AIRPORT)); - SetWindowWidgetDisabledState(w, 13, !(st->facilities & FACIL_DOCK)); + w->SetWidgetDisabledState( 9, st->owner != _local_player); + w->SetWidgetDisabledState(10, !(st->facilities & FACIL_TRAIN)); + w->SetWidgetDisabledState(11, !(st->facilities & FACIL_TRUCK_STOP) && !(st->facilities & FACIL_BUS_STOP)); + w->SetWidgetDisabledState(12, !(st->facilities & FACIL_AIRPORT)); + w->SetWidgetDisabledState(13, !(st->facilities & FACIL_DOCK)); SetDParam(0, st->index); SetDParam(1, st->facilities); diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index 9e01d48b1..930cedb60 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -54,29 +54,29 @@ static void DrawTimetableWindow(Window *w) if (v->owner == _local_player) { if (selected == -1) { - DisableWindowWidget(w, 6); - DisableWindowWidget(w, 7); + w->DisableWidget(6); + w->DisableWidget(7); } else if (selected % 2 == 1) { - EnableWindowWidget(w, 6); - EnableWindowWidget(w, 7); + w->EnableWidget(6); + w->EnableWidget(7); } else { const Order *order = GetVehicleOrder(v, (selected + 1) / 2); bool disable = order == NULL || order->type != OT_GOTO_STATION || (_patches.new_nonstop && (order->flags & OF_NON_STOP)); - SetWindowWidgetDisabledState(w, 6, disable); - SetWindowWidgetDisabledState(w, 7, disable); + w->SetWidgetDisabledState(6, disable); + w->SetWidgetDisabledState(7, disable); } - EnableWindowWidget(w, 8); - EnableWindowWidget(w, 9); + w->EnableWidget(8); + w->EnableWidget(9); } else { - DisableWindowWidget(w, 6); - DisableWindowWidget(w, 7); - DisableWindowWidget(w, 8); - DisableWindowWidget(w, 9); + w->DisableWidget(6); + w->DisableWidget(7); + w->DisableWidget(8); + w->DisableWidget(9); } - SetWindowWidgetLoweredState(w, 9, HasBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE)); + w->SetWidgetLoweredState(9, HasBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE)); SetDParam(0, v->index); DrawWindowWidgets(w); diff --git a/src/town_gui.cpp b/src/town_gui.cpp index d846f4ee9..452210e55 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -142,7 +142,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e) if (WP(w,def_d).data_1 != -1 && !HasBit(buttons, WP(w,def_d).data_1)) WP(w,def_d).data_1 = -1; - SetWindowWidgetDisabledState(w, 6, WP(w, def_d).data_1 == -1); + w->SetWidgetDisabledState(6, WP(w, def_d).data_1 == -1); { int y; @@ -272,7 +272,7 @@ static void TownViewWndProc(Window *w, WindowEvent *e) switch (e->event) { case WE_PAINT: /* disable renaming town in network games if you are not the server */ - SetWindowWidgetDisabledState(w, 8, _networking && !_network_server); + w->SetWidgetDisabledState(8, _networking && !_network_server); SetDParam(0, t->index); DrawWindowWidgets(w); diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp index d66f494b9..1dd64a32e 100644 --- a/src/transparency_gui.cpp +++ b/src/transparency_gui.cpp @@ -37,7 +37,7 @@ static void TransparencyToolbWndProc(Window *w, WindowEvent *e) /* must be sure that the widgets show the transparency variable changes * also when we use shortcuts */ for (uint i = TTW_WIDGET_SIGNS; i < TTW_WIDGET_END; i++) { - SetWindowWidgetLoweredState(w, i, IsTransparencySet((TransparencyOption)(i - TTW_WIDGET_SIGNS))); + w->SetWidgetLoweredState(i, IsTransparencySet((TransparencyOption)(i - TTW_WIDGET_SIGNS))); } DrawWindowWidgets(w); break; diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 87875c986..0cb5307d9 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -789,10 +789,10 @@ static void CreateVehicleListWindow(Window *w) /* Hide the widgets that we will not use in this window * Some windows contains actions only fit for the owner */ if (player == _local_player) { - HideWindowWidget(w, VLW_WIDGET_OTHER_PLAYER_FILLER); - SetWindowWidgetDisabledState(w, VLW_WIDGET_AVAILABLE_VEHICLES, window_type != VLW_STANDARD); + w->HideWidget(VLW_WIDGET_OTHER_PLAYER_FILLER); + w->SetWidgetDisabledState(VLW_WIDGET_AVAILABLE_VEHICLES, window_type != VLW_STANDARD); } else { - SetWindowWidgetsHiddenState(w, true, + w->SetWidgetsHiddenState(true, VLW_WIDGET_AVAILABLE_VEHICLES, VLW_WIDGET_MANAGE_VEHICLES, VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN, @@ -976,7 +976,7 @@ static void DrawVehicleListWindow(Window *w) default: NOT_REACHED(); break; } - SetWindowWidgetsDisabledState(w, vl->l.list_length == 0, + w->SetWidgetsDisabledState(vl->l.list_length == 0, VLW_WIDGET_MANAGE_VEHICLES, VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN, VLW_WIDGET_STOP_ALL, @@ -1460,14 +1460,14 @@ static void DrawVehicleDetailsWindow(Window *w) const Vehicle *v = GetVehicle(w->window_number); byte det_tab = WP(w, vehicledetails_d).tab; - SetWindowWidgetDisabledState(w, VLD_WIDGET_RENAME_VEHICLE, v->owner != _local_player); + w->SetWidgetDisabledState(VLD_WIDGET_RENAME_VEHICLE, v->owner != _local_player); if (v->type == VEH_TRAIN) { - DisableWindowWidget(w, det_tab + VLD_WIDGET_DETAILS_CARGO_CARRIED); + w->DisableWidget(det_tab + VLD_WIDGET_DETAILS_CARGO_CARRIED); SetVScrollCount(w, GetTrainDetailsWndVScroll(v->index, det_tab)); } - SetWindowWidgetsHiddenState(w, v->type != VEH_TRAIN, + w->SetWidgetsHiddenState(v->type != VEH_TRAIN, VLD_WIDGET_SCROLLBAR, VLD_WIDGET_DETAILS_CARGO_CARRIED, VLD_WIDGET_DETAILS_TRAIN_VEHICLES, @@ -1477,7 +1477,7 @@ static void DrawVehicleDetailsWindow(Window *w) WIDGET_LIST_END); /* Disable service-scroller when interval is set to disabled */ - SetWindowWidgetsDisabledState(w, !IsVehicleServiceIntervalEnabled(v->type), + w->SetWidgetsDisabledState(!IsVehicleServiceIntervalEnabled(v->type), VLD_WIDGET_INCREASE_SERVICING_INTERVAL, VLD_WIDGET_DECREASE_SERVICING_INTERVAL, WIDGET_LIST_END); @@ -1598,7 +1598,7 @@ static void VehicleDetailsWndProc(Window *w, WindowEvent *e) case VLD_WIDGET_DETAILS_TRAIN_VEHICLES: case VLD_WIDGET_DETAILS_CAPACITY_OF_EACH: case VLD_WIDGET_DETAILS_TOTAL_CARGO: - SetWindowWidgetsDisabledState(w, false, + w->SetWidgetsDisabledState(false, VLD_WIDGET_DETAILS_CARGO_CARRIED, VLD_WIDGET_DETAILS_TRAIN_VEHICLES, VLD_WIDGET_DETAILS_CAPACITY_OF_EACH, @@ -1826,7 +1826,7 @@ static void CreateVehicleViewWindow(Window *w) w->widget[VVW_WIDGET_CLONE_VEH].data = SPR_CLONE_ROADVEH; w->widget[VVW_WIDGET_CLONE_VEH].tooltips = STR_CLONE_ROAD_VEHICLE_INFO; - SetWindowWidgetHiddenState(w, VVW_WIDGET_FORCE_PROCEED, true); + w->SetWidgetHiddenState(VVW_WIDGET_FORCE_PROCEED, true); break; case VEH_SHIP: @@ -1848,7 +1848,7 @@ static void CreateVehicleViewWindow(Window *w) w->widget[VVW_WIDGET_CLONE_VEH].data = SPR_CLONE_SHIP; w->widget[VVW_WIDGET_CLONE_VEH].tooltips = STR_CLONE_SHIP_INFO; - SetWindowWidgetsHiddenState(w, true, + w->SetWidgetsHiddenState(true, VVW_WIDGET_TURN_AROUND, VVW_WIDGET_FORCE_PROCEED, WIDGET_LIST_END); @@ -1873,7 +1873,7 @@ static void CreateVehicleViewWindow(Window *w) w->widget[VVW_WIDGET_CLONE_VEH].data = SPR_CLONE_AIRCRAFT; w->widget[VVW_WIDGET_CLONE_VEH].tooltips = STR_CLONE_AIRCRAFT_INFO; - SetWindowWidgetsHiddenState(w, true, + w->SetWidgetsHiddenState(true, VVW_WIDGET_TURN_AROUND, VVW_WIDGET_FORCE_PROCEED, WIDGET_LIST_END); @@ -1922,14 +1922,14 @@ static void DrawVehicleViewWindow(Window *w) bool is_localplayer = v->owner == _local_player; bool refitable_and_stopped_in_depot = IsVehicleRefitable(v); - SetWindowWidgetDisabledState(w, VVW_WIDGET_GOTO_DEPOT, !is_localplayer); - SetWindowWidgetDisabledState(w, VVW_WIDGET_REFIT_VEH, + w->SetWidgetDisabledState(VVW_WIDGET_GOTO_DEPOT, !is_localplayer); + w->SetWidgetDisabledState(VVW_WIDGET_REFIT_VEH, !refitable_and_stopped_in_depot || !is_localplayer); - SetWindowWidgetDisabledState(w, VVW_WIDGET_CLONE_VEH, !is_localplayer); + w->SetWidgetDisabledState(VVW_WIDGET_CLONE_VEH, !is_localplayer); if (v->type == VEH_TRAIN) { - SetWindowWidgetDisabledState(w, VVW_WIDGET_FORCE_PROCEED, !is_localplayer); - SetWindowWidgetDisabledState(w, VVW_WIDGET_TURN_AROUND, !is_localplayer); + w->SetWidgetDisabledState(VVW_WIDGET_FORCE_PROCEED, !is_localplayer); + w->SetWidgetDisabledState(VVW_WIDGET_TURN_AROUND, !is_localplayer); /* Cargo refit button is disabled, until we know we can enable it below. */ @@ -1938,7 +1938,7 @@ static void DrawVehicleViewWindow(Window *w) for (const Vehicle *u = v; u != NULL; u = u->Next()) { if (EngInfo(u->engine_type)->refit_mask != 0 || (RailVehInfo(v->engine_type)->railveh_type != RAILVEH_WAGON && v->cargo_cap != 0)) { - EnableWindowWidget(w, VVW_WIDGET_REFIT_VEH); + w->EnableWidget(VVW_WIDGET_REFIT_VEH); /* We have a refittable carriage, bail out */ break; } @@ -2150,12 +2150,12 @@ static void VehicleViewWndProc(Window *w, WindowEvent *e) * allowed only while in depot and stopped. * This sytem allows to have two buttons, on top of each other. * The same system applies to widget VVW_WIDGET_REFIT_VEH and VVW_WIDGET_TURN_AROUND.*/ - if (veh_stopped != IsWindowWidgetHidden(w, VVW_WIDGET_GOTO_DEPOT) || veh_stopped == IsWindowWidgetHidden(w, VVW_WIDGET_CLONE_VEH)) { - SetWindowWidgetHiddenState(w, VVW_WIDGET_GOTO_DEPOT, veh_stopped); // send to depot - SetWindowWidgetHiddenState(w, VVW_WIDGET_CLONE_VEH, !veh_stopped); // clone + if (veh_stopped != w->IsWidgetHidden(VVW_WIDGET_GOTO_DEPOT) || veh_stopped == w->IsWidgetHidden(VVW_WIDGET_CLONE_VEH)) { + w->SetWidgetHiddenState( VVW_WIDGET_GOTO_DEPOT, veh_stopped); // send to depot + w->SetWidgetHiddenState(VVW_WIDGET_CLONE_VEH, !veh_stopped); // clone if (v->type == VEH_ROAD || v->type == VEH_TRAIN) { - SetWindowWidgetHiddenState(w, VVW_WIDGET_REFIT_VEH, !veh_stopped); // refit - SetWindowWidgetHiddenState(w, VVW_WIDGET_TURN_AROUND, veh_stopped); // force turn around + w->SetWidgetHiddenState( VVW_WIDGET_REFIT_VEH, !veh_stopped); // refit + w->SetWidgetHiddenState(VVW_WIDGET_TURN_AROUND, veh_stopped); // force turn around } SetWindowDirty(w); } diff --git a/src/viewport.cpp b/src/viewport.cpp index 136f1b8cc..806f7e2c9 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -442,10 +442,10 @@ Point GetTileZoomCenterWindow(bool in, Window * w) * @param widget_zoom_out widget index for window with zoom-out button */ void HandleZoomMessage(Window *w, const ViewPort *vp, byte widget_zoom_in, byte widget_zoom_out) { - SetWindowWidgetDisabledState(w, widget_zoom_in, vp->zoom == ZOOM_LVL_MIN); + w->SetWidgetDisabledState(widget_zoom_in, vp->zoom == ZOOM_LVL_MIN); InvalidateWidget(w, widget_zoom_in); - SetWindowWidgetDisabledState(w, widget_zoom_out, vp->zoom == ZOOM_LVL_MAX); + w->SetWidgetDisabledState(widget_zoom_out, vp->zoom == ZOOM_LVL_MAX); InvalidateWidget(w, widget_zoom_out); } diff --git a/src/widget.cpp b/src/widget.cpp index c5266c1ea..4453350fc 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -140,7 +140,7 @@ int GetWidgetFromPos(const Window *w, int x, int y) if (wi->type == WWT_EMPTY || wi->type == WWT_FRAME) continue; if (x >= wi->left && x <= wi->right && y >= wi->top && y <= wi->bottom && - !IsWindowWidgetHidden(w, index)) { + !w->IsWidgetHidden(index)) { found_index = index; } } @@ -187,14 +187,14 @@ void DrawWindowWidgets(const Window *w) for (uint i = 0; i < w->widget_count; i++) { const Widget *wi = &w->widget[i]; - bool clicked = IsWindowWidgetLowered(w, i); + bool clicked = w->IsWidgetLowered(i); Rect r; if (dpi->left > (r.right = wi->right) || dpi->left + dpi->width <= (r.left = wi->left) || dpi->top > (r.bottom = wi->bottom) || dpi->top + dpi->height <= (r.top = wi->top) || - IsWindowWidgetHidden(w, i)) { + w->IsWidgetHidden(i)) { continue; } @@ -469,7 +469,7 @@ void DrawWindowWidgets(const Window *w) DrawStringCenteredTruncated(r.left + 2, r.right - 2, r.top + 2, wi->data, 0x84); draw_default:; - if (IsWindowWidgetDisabled(w, i)) { + if (w->IsWidgetDisabled(i)) { GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, _colour_gradient[wi->color & 0xF][2] | (1 << PALETTE_MODIFIER_GREYOUT)); } } @@ -602,7 +602,7 @@ static void DropdownMenuWndProc(Window *w, WindowEvent *e) case WE_DESTROY: { Window *w2 = FindWindowById(WP(w,dropdown_d).parent_wnd_class, WP(w,dropdown_d).parent_wnd_num); if (w2 != NULL) { - RaiseWindowWidget(w2, WP(w,dropdown_d).parent_button); + w2->RaiseWidget(WP(w,dropdown_d).parent_button); InvalidateWidget(w2, WP(w,dropdown_d).parent_button); } } break; @@ -615,7 +615,7 @@ void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int butt const Widget *wi; Window *w2; const Window *w3; - bool is_dropdown_menu_shown = IsWindowWidgetLowered(w, button); + bool is_dropdown_menu_shown = w->IsWidgetLowered(button); int top, height; int screen_top, screen_bottom; bool scroll = false; @@ -624,7 +624,7 @@ void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int butt if (is_dropdown_menu_shown) return; - LowerWindowWidget(w, button); + w->LowerWidget(button); InvalidateWidget(w, button); @@ -678,7 +678,7 @@ void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int butt w2->widget[0].right = wi->right - wi[-1].left; w2->widget[0].bottom = height - 1; - SetWindowWidgetHiddenState(w2, 1, !scroll); + w2->SetWidgetHiddenState(1, !scroll); if (scroll) { /* We're scrolling, so enable the scroll bar and shrink the list by diff --git a/src/window.cpp b/src/window.cpp index b12e69b21..6f03da0fd 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -33,7 +33,7 @@ void CDECL SetWindowWidgetsDisabledState(Window *w, bool disab_stat, int widgets va_start(wdg_list, widgets); while (widgets != WIDGET_LIST_END) { - SetWindowWidgetDisabledState(w, widgets, disab_stat); + w->SetWidgetDisabledState(widgets, disab_stat); widgets = va_arg(wdg_list, int); } @@ -47,7 +47,7 @@ void CDECL SetWindowWidgetsHiddenState(Window *w, bool hidden_stat, int widgets, va_start(wdg_list, widgets); while (widgets != WIDGET_LIST_END) { - SetWindowWidgetHiddenState(w, widgets, hidden_stat); + w->SetWidgetHiddenState(widgets, hidden_stat); widgets = va_arg(wdg_list, int); } @@ -61,7 +61,7 @@ void CDECL SetWindowWidgetsLoweredState(Window *w, bool lowered_stat, int widget va_start(wdg_list, widgets); while (widgets != WIDGET_LIST_END) { - SetWindowWidgetLoweredState(w, widgets, lowered_stat); + w->SetWidgetLoweredState(widgets, lowered_stat); widgets = va_arg(wdg_list, int); } @@ -73,8 +73,8 @@ void RaiseWindowButtons(Window *w) uint i; for (i = 0; i < w->widget_count; i++) { - if (IsWindowWidgetLowered(w, i)) { - RaiseWindowWidget(w, i); + if (w->IsWidgetLowered(i)) { + w->RaiseWidget(i); InvalidateWidget(w, i); } } @@ -146,7 +146,7 @@ void Window::InvalidateWidget(byte widget_index) void HandleButtonClick(Window *w, byte widget) { - LowerWindowWidget(w, widget); + w->LowerWidget(widget); w->flags4 |= 5 << WF_TIMEOUT_SHL; InvalidateWidget(w, widget); } @@ -169,7 +169,7 @@ static void DispatchLeftClickEvent(Window *w, int x, int y, bool double_click) if (e.we.click.widget < 0) return; // exit if clicked outside of widgets /* don't allow any interaction if the button has been disabled */ - if (IsWindowWidgetDisabled(w, e.we.click.widget)) return; + if (w->IsWidgetDisabled(e.we.click.widget)) return; wi = &w->widget[e.we.click.widget]; @@ -1994,7 +1994,7 @@ void InvalidateWidget(const Window *w, byte widget_index) const Widget *wi = &w->widget[widget_index]; /* Don't redraw the window if the widget is invisible or of no-type */ - if (wi->type == WWT_EMPTY || IsWindowWidgetHidden(w, widget_index)) return; + if (wi->type == WWT_EMPTY || w->IsWidgetHidden(widget_index)) return; SetDirtyBlocks(w->left + wi->left, w->top + wi->top, w->left + wi->right + 1, w->top + wi->bottom + 1); } |