summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/airport_gui.cpp4
-rw-r--r--src/autoreplace_gui.cpp2
-rw-r--r--src/bridge_gui.cpp2
-rw-r--r--src/build_vehicle_gui.cpp4
-rw-r--r--src/cheat_gui.cpp2
-rw-r--r--src/depot_gui.cpp2
-rw-r--r--src/dock_gui.cpp6
-rw-r--r--src/engine_gui.cpp2
-rw-r--r--src/genworld_gui.cpp6
-rw-r--r--src/graph_gui.cpp18
-rw-r--r--src/group_gui.cpp4
-rw-r--r--src/industry_gui.cpp10
-rw-r--r--src/intro_gui.cpp2
-rw-r--r--src/main_gui.cpp2
-rw-r--r--src/misc_gui.cpp14
-rw-r--r--src/music_gui.cpp4
-rw-r--r--src/network/network_gui.cpp22
-rw-r--r--src/newgrf_gui.cpp4
-rw-r--r--src/news_gui.cpp10
-rw-r--r--src/order_gui.cpp2
-rw-r--r--src/osk_gui.cpp2
-rw-r--r--src/player_gui.cpp12
-rw-r--r--src/rail_gui.cpp10
-rw-r--r--src/road_gui.cpp6
-rw-r--r--src/settings_gui.cpp8
-rw-r--r--src/signs_gui.cpp4
-rw-r--r--src/smallmap_gui.cpp6
-rw-r--r--src/station_gui.cpp6
-rw-r--r--src/statusbar_gui.cpp2
-rw-r--r--src/subsidy_gui.cpp2
-rw-r--r--src/terraform_gui.cpp4
-rw-r--r--src/timetable_gui.cpp2
-rw-r--r--src/toolbar_gui.cpp8
-rw-r--r--src/town_gui.cpp12
-rw-r--r--src/transparency_gui.cpp2
-rw-r--r--src/tree_gui.cpp2
-rw-r--r--src/vehicle_gui.cpp12
-rw-r--r--src/viewport.cpp12
-rw-r--r--src/widget.cpp56
-rw-r--r--src/widgets/dropdown.cpp2
-rw-r--r--src/window_gui.h23
41 files changed, 156 insertions, 159 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index 2d7f0f0b6..7333f8051 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -69,7 +69,7 @@ static void BuildAirToolbWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
case WE_PAINT:
- DrawWindowWidgets(w);
+ w->DrawWidgets();
break;
case WE_CLICK:
@@ -197,7 +197,7 @@ public:
if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* strings such as 'Size' and 'Coverage Area' */
int text_end = DrawStationCoverageAreaText(2, 206, SCT_ALL, rad, false);
text_end = DrawStationCoverageAreaText(2, text_end + 4, SCT_ALL, rad, true) + 4;
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index f9d827d27..e5a612201 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -360,7 +360,7 @@ public:
this->widget[RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN].data = _rail_types_list[sel_railtype];
}
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* sets up the string for the vehicle that is being replaced to */
if (selected_id[0] != INVALID_ENGINE) {
diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp
index a5eb1efbc..095f36198 100644
--- a/src/bridge_gui.cpp
+++ b/src/bridge_gui.cpp
@@ -75,7 +75,7 @@ static void BuildBridgeWndProc(Window *w, WindowEvent *e)
break;
case WE_PAINT: {
- DrawWindowWidgets(w);
+ w->DrawWidgets();
uint y = 15;
for (uint i = 0; (i < w->vscroll.cap) && ((i + w->vscroll.pos) < _bridgedata.count); i++) {
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 1908039a3..a5af78f6a 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -1114,7 +1114,7 @@ struct BuildVehicleWindow : Window {
/* Set text of sort by dropdown */
this->widget[BUILD_VEHICLE_WIDGET_SORT_DROPDOWN].data = _sort_listing[this->vehicle_type][this->sort_criteria];
- DrawWindowWidgets(this);
+ this->DrawWidgets();
DrawEngineList(this->vehicle_type, this->widget[BUILD_VEHICLE_WIDGET_LIST].left + 2, this->widget[BUILD_VEHICLE_WIDGET_LIST].top + 1, this->eng_list, this->vscroll.pos, max, this->sel_engine, 0, DEFAULT_GROUP);
@@ -1129,7 +1129,7 @@ struct BuildVehicleWindow : Window {
}
}
- DrawSortButtonState(this, BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING, this->descending_sort_order ? SBS_DOWN : SBS_UP);
+ this->DrawSortButtonState(BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING, this->descending_sort_order ? SBS_DOWN : SBS_UP);
}
virtual void OnDoubleClick(Point pt, int widget)
diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp
index 0ee653185..1bb1c5eba 100644
--- a/src/cheat_gui.cpp
+++ b/src/cheat_gui.cpp
@@ -129,7 +129,7 @@ struct CheatWindow : Window {
virtual void OnPaint()
{
- DrawWindowWidgets(this);
+ this->DrawWidgets();
DrawStringMultiCenter(200, 25, STR_CHEATS_WARNING, width - 50);
for (int i = 0, x = 0, y = 45; i != lengthof(_cheats_ui); i++) {
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index 9ec0f0c9f..842d18203 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -365,7 +365,7 @@ struct DepotWindow : Window {
SetDParam(0, depot->town_index);
}
- DrawWindowWidgets(w);
+ w->DrawWidgets();
num = this->vscroll.pos * boxes_in_each_row;
maxval = min(this->engine_count, num + (rows_in_display * boxes_in_each_row));
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index c4bf10b42..d73f9a3b7 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -129,7 +129,7 @@ static void BuildDocksToolbWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
case WE_PAINT:
- DrawWindowWidgets(w);
+ w->DrawWidgets();
w->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_SHIP), 7, 8, 9, WIDGET_LIST_END);
break;
@@ -238,7 +238,7 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e)
case WE_PAINT: {
int rad = (_patches.modified_catchment) ? CA_DOCK : CA_UNMODIFIED;
- DrawWindowWidgets(w);
+ w->DrawWidgets();
if (_station_show_coverage) {
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
@@ -318,7 +318,7 @@ static void BuildDocksDepotWndProc(Window *w, WindowEvent *e)
case WE_CREATE: w->LowerWidget(_ship_depot_direction + 3); break;
case WE_PAINT:
- DrawWindowWidgets(w);
+ w->DrawWidgets();
DrawShipDepotSprite(67, 35, 0);
DrawShipDepotSprite(35, 51, 1);
diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp
index 72242590b..05dba463f 100644
--- a/src/engine_gui.cpp
+++ b/src/engine_gui.cpp
@@ -74,7 +74,7 @@ static void EnginePreviewWndProc(Window *w, WindowEvent *e)
const DrawEngineInfo* dei;
int width;
- DrawWindowWidgets(w);
+ w->DrawWidgets();
SetDParam(0, GetEngineCategoryName(engine));
DrawStringMultiCenter(150, 44, STR_8101_WE_HAVE_JUST_DESIGNED_A, 296);
diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp
index 59595325f..ba6f1f3d2 100644
--- a/src/genworld_gui.cpp
+++ b/src/genworld_gui.cpp
@@ -315,7 +315,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
SetDParam(2, 1 << _patches_newgame.map_y); // GLAND_MAPSIZE_Y_PULLDOWN
SetDParam(3, _patches_newgame.snow_line_height); // GLAND_SNOW_LEVEL_TEXT
- DrawWindowWidgets(this);
+ this->DrawWidgets();
this->DrawEditBox(GLAND_RANDOM_EDITBOX);
@@ -667,7 +667,7 @@ struct CreateScenarioWindow : public Window
SetDParam(2, 1 << _patches_newgame.map_y); // CSCEN_MAPSIZE_Y_PULLDOWN
SetDParam(3, _patches_newgame.se_flat_world_height); // CSCEN_FLAT_LAND_HEIGHT_TEXT
- DrawWindowWidgets(this);
+ this->DrawWidgets();
}
virtual void OnClick(Point pt, int widget)
@@ -873,7 +873,7 @@ public:
virtual void OnPaint()
{
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* Draw the % complete with a bar and a text */
DrawFrameRect(19, 20, (this->width - 18), 37, 14, FR_BORDERONLY);
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp
index d666de9c4..a6102f8a3 100644
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -285,7 +285,7 @@ static void GraphLegendWndProc(Window *w, WindowEvent *e)
w->RaiseWidget(p->index + 3);
}
- DrawWindowWidgets(w);
+ w->DrawWidgets();
FOR_ALL_PLAYERS(p) {
if (!p->is_active) continue;
@@ -384,7 +384,7 @@ static void OperatingProfitWndProc(Window *w, WindowEvent *e)
GraphDrawer gd;
const Player* p;
- DrawWindowWidgets(w);
+ w->DrawWidgets();
gd.left = 2;
gd.top = 18;
@@ -455,7 +455,7 @@ static void IncomeGraphWndProc(Window *w, WindowEvent *e)
GraphDrawer gd;
const Player* p;
- DrawWindowWidgets(w);
+ w->DrawWidgets();
gd.left = 2;
gd.top = 18;
@@ -522,7 +522,7 @@ static void DeliveredCargoGraphWndProc(Window *w, WindowEvent *e)
GraphDrawer gd;
const Player* p;
- DrawWindowWidgets(w);
+ w->DrawWidgets();
gd.left = 2;
gd.top = 18;
@@ -589,7 +589,7 @@ static void PerformanceHistoryWndProc(Window *w, WindowEvent *e)
GraphDrawer gd;
const Player* p;
- DrawWindowWidgets(w);
+ w->DrawWidgets();
gd.left = 2;
gd.top = 18;
@@ -658,7 +658,7 @@ static void CompanyValueGraphWndProc(Window *w, WindowEvent *e)
GraphDrawer gd;
const Player* p;
- DrawWindowWidgets(w);
+ w->DrawWidgets();
gd.left = 2;
gd.top = 18;
@@ -724,7 +724,7 @@ static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e)
case WE_PAINT: {
GraphDrawer gd;
- DrawWindowWidgets(w);
+ w->DrawWidgets();
int x = 495;
int y = 24;
@@ -886,7 +886,7 @@ static void CompanyLeagueWndProc(Window *w, WindowEvent *e)
const Player* plist[MAX_PLAYERS];
const Player* p;
- DrawWindowWidgets(w);
+ w->DrawWidgets();
uint pl_num = 0;
FOR_ALL_PLAYERS(p) if (p->is_active) plist[pl_num++] = p;
@@ -973,7 +973,7 @@ struct PerformanceRatingDetailWindow : Window {
int color_done, color_notdone;
/* Draw standard stuff */
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* Check if the currently selected player is still active. */
if (player == INVALID_PLAYER || !GetPlayer(player)->is_active) {
diff --git a/src/group_gui.cpp b/src/group_gui.cpp
index ecdc535e2..601cc2b0a 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -403,7 +403,7 @@ struct VehicleGroupWindow : public Window, public VehicleListBase {
/* Set text of sort by dropdown */
this->widget[GRP_WIDGET_SORT_BY_DROPDOWN].data = _vehicle_sort_listing[this->vehicles.sort_type];
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* Draw Matrix Group
* The selected group is drawn in white */
@@ -451,7 +451,7 @@ struct VehicleGroupWindow : public Window, public VehicleListBase {
DrawStringRightAligned(187, y1 + 1, STR_GROUP_TINY_NUM, (this->group_sel == g->index) ? TC_WHITE : TC_BLACK);
}
- DrawSortButtonState(this, GRP_WIDGET_SORT_BY_ORDER, this->vehicles.flags & VL_DESC ? SBS_DOWN : SBS_UP);
+ this->DrawSortButtonState(GRP_WIDGET_SORT_BY_ORDER, this->vehicles.flags & VL_DESC ? SBS_DOWN : SBS_UP);
/* Draw Matrix Vehicle according to the vehicle list built before */
max = min(this->vscroll2.pos + this->vscroll2.cap, this->vehicles.list_length);
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 2fb18da3e..94818c72b 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -204,7 +204,7 @@ public:
SetVScrollCount(this, this->count);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* and now with the matrix painting */
for (byte i = 0; i < this->vscroll.cap && ((i + this->vscroll.pos) < this->count); i++) {
@@ -481,7 +481,7 @@ public:
bool has_accept = false;
SetDParam(0, this->window_number);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
if (HasBit(ind->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HasBit(ind->callback_flags, CBM_IND_PRODUCTION_256_TICKS)) {
for (byte j = 0; j < lengthof(i->accepts_cargo); j++) {
@@ -564,7 +564,7 @@ public:
return;
}
- DrawWindowViewport(this);
+ this->DrawViewport();
}
virtual void OnClick(Point pt, int widget)
@@ -840,8 +840,8 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
SetVScrollCount(w, _num_industry_sort);
- DrawWindowWidgets(w);
- DrawSortButtonState(w, IDW_SORTBYNAME + (_industry_sort_order >> 1), _industry_sort_order & 1 ? SBS_DOWN : SBS_UP);
+ w->DrawWidgets();
+ w->DrawSortButtonState(IDW_SORTBYNAME + (_industry_sort_order >> 1), _industry_sort_order & 1 ? SBS_DOWN : SBS_UP);
uint pos = w->vscroll.pos;
int n = 0;
diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp
index da3887325..b83331c2a 100644
--- a/src/intro_gui.cpp
+++ b/src/intro_gui.cpp
@@ -82,7 +82,7 @@ static void SelectGameWndProc(Window *w, WindowEvent *e)
w->SetWidgetLoweredState(SGI_TROPIC_LANDSCAPE, _opt_newgame.landscape == LT_TROPIC);
w->SetWidgetLoweredState(SGI_TOYLAND_LANDSCAPE, _opt_newgame.landscape == LT_TOYLAND);
SetDParam(0, STR_6801_EASY + _opt_newgame.diff_level);
- DrawWindowWidgets(w);
+ w->DrawWidgets();
break;
case WE_CLICK:
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 56bac55db..7fd97015d 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -224,7 +224,7 @@ struct MainWindow : Window
virtual void OnPaint()
{
- DrawWindowViewport(this);
+ this->DrawViewport();
if (_game_mode == GM_MENU) {
int off_x = _screen.width / 2;
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 57d426e75..dadbff049 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -83,7 +83,7 @@ public:
virtual void OnPaint()
{
- DrawWindowWidgets(this);
+ this->DrawWidgets();
DoDrawStringCentered(140, 16, this->landinfo_data[0], TC_LIGHT_BLUE);
DoDrawStringCentered(140, 27, this->landinfo_data[1], TC_FROMSTRING);
@@ -289,7 +289,7 @@ struct AboutWindow : public Window {
" Chris Sawyer - For an amazing game!"
};
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* Show original copyright and revision version */
DrawStringCentered(210, 17, STR_00B6_ORIGINAL_COPYRIGHT, TC_FROMSTRING);
@@ -371,7 +371,7 @@ public:
};
CopyInDParam(0, this->decode_params, lengthof(this->decode_params));
- DrawWindowWidgets(this);
+ this->DrawWidgets();
CopyInDParam(0, this->decode_params, lengthof(this->decode_params));
/* If the error message comes from a NewGRF, we must use the text ref. stack reserved for error messages.
@@ -998,7 +998,7 @@ struct QueryStringWindow : public QueryStringBaseWindow
virtual void OnPaint()
{
SetDParam(0, this->caption);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
this->DrawEditBox(QUERY_STR_WIDGET_TEXT);
}
@@ -1153,7 +1153,7 @@ struct QueryWindow : public Window {
virtual void OnPaint()
{
CopyInDParam(0, this->params, lengthof(this->params));
- DrawWindowWidgets(this);
+ this->DrawWidgets();
CopyInDParam(0, this->params, lengthof(this->params));
DrawStringMultiCenter(this->width / 2, (this->height / 2) - 10, this->message, this->width - 2);
@@ -1419,7 +1419,7 @@ struct SaveLoadWindow : public QueryStringBaseWindow {
int y;
SetVScrollCount(this, _fios_num);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
DrawFiosTexts(this->width);
if (_savegame_sort_dirty) {
@@ -1428,7 +1428,7 @@ struct SaveLoadWindow : public QueryStringBaseWindow {
}
GfxFillRect(this->widget[7].left + 1, this->widget[7].top + 1, this->widget[7].right, this->widget[7].bottom, 0xD7);
- DrawSortButtonState(this, _savegame_sort_order & SORT_BY_NAME ? 2 : 3, _savegame_sort_order & SORT_DESCENDING ? SBS_DOWN : SBS_UP);
+ this->DrawSortButtonState(_savegame_sort_order & SORT_BY_NAME ? 2 : 3, _savegame_sort_order & SORT_DESCENDING ? SBS_DOWN : SBS_UP);
y = this->widget[7].top + 1;
for (pos = this->vscroll.pos; pos < _fios_num; pos++) {
diff --git a/src/music_gui.cpp b/src/music_gui.cpp
index 589dbeca9..3b032c5a0 100644
--- a/src/music_gui.cpp
+++ b/src/music_gui.cpp
@@ -204,7 +204,7 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e)
w->SetWidgetDisabledState(11, msf.playlist <= 3);
w->LowerWidget(3);
w->LowerWidget(4);
- DrawWindowWidgets(w);
+ w->DrawWidgets();
GfxFillRect(3, 23, 3 + 177, 23 + 191, 0);
GfxFillRect(251, 23, 251 + 177, 23 + 191, 0);
@@ -346,7 +346,7 @@ static void MusicWindowWndProc(Window *w, WindowEvent *e)
w->RaiseWidget(7);
w->RaiseWidget(9);
- DrawWindowWidgets(w);
+ w->DrawWidgets();
GfxFillRect(187, 16, 200, 33, 0);
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 8e429589c..61beab24a 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -318,7 +318,7 @@ struct NetworkGameWindow : public QueryStringBaseWindow {
SetDParam(0, 0x00);
SetDParam(1, _lan_internet_types_dropdown[_network_lan_internet]);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* Edit box to set player name */
this->DrawEditBox(NGWW_PLAYER);
@@ -327,9 +327,9 @@ struct NetworkGameWindow : public QueryStringBaseWindow {
/* Sort based on widgets: name, clients, compatibility */
switch (this->servers.sort_type) {
- case NGWW_NAME - NGWW_NAME: DrawSortButtonState(this, NGWW_NAME, arrow); break;
- case NGWW_CLIENTS - NGWW_NAME: DrawSortButtonState(this, NGWW_CLIENTS, arrow); break;
- case NGWW_INFO - NGWW_NAME: DrawSortButtonState(this, NGWW_INFO, arrow); break;
+ case NGWW_NAME - NGWW_NAME: this->DrawSortButtonState(NGWW_NAME, arrow); break;
+ case NGWW_CLIENTS - NGWW_NAME: this->DrawSortButtonState(NGWW_CLIENTS, arrow); break;
+ case NGWW_INFO - NGWW_NAME: this->DrawSortButtonState(NGWW_INFO, arrow); break;
}
uint16 y = NET_PRC__OFFSET_TOP_WIDGET + 3;
@@ -727,7 +727,7 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow {
SetDParam(3, _network_game_info.companies_max);
SetDParam(4, _network_game_info.spectators_max);
SetDParam(5, STR_NETWORK_LANG_ANY + _network_game_info.server_lang);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* editbox to set game name */
this->DrawEditBox(NSSW_GAMENAME);
@@ -1036,7 +1036,7 @@ struct NetworkLobbyWindow : public Window {
/* Draw window widgets */
SetDParamStr(0, gi->server_name);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* Draw company list */
pos = this->vscroll.pos;
@@ -1410,7 +1410,7 @@ struct NetworkClientListPopupWindow : Window {
virtual void OnPaint()
{
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* Draw the actions */
int sel = this->sel_index;
@@ -1514,7 +1514,7 @@ struct NetworkClientListWindow : Window
/* Check if we need to reset the height */
if (!this->CheckClientListHeight()) return;
- DrawWindowWidgets(this);
+ this->DrawWidgets();
int y = CLNWND_OFFSET;
@@ -1606,7 +1606,7 @@ struct NetworkJoinStatusWindow : Window {
virtual void OnPaint()
{
uint8 progress; // used for progress bar
- DrawWindowWidgets(this);
+ this->DrawWidgets();
DrawStringCentered(125, 35, STR_NETWORK_CONNECTING_1 + _network_join_status, TC_GREY);
switch (_network_join_status) {
@@ -1851,7 +1851,7 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
STR_NETWORK_CHAT_CLIENT_CAPTION
};
- DrawWindowWidgets(this);
+ this->DrawWidgets();
assert((uint)this->dtype < lengthof(chat_captions));
DrawStringRightAligned(this->widget[2].left - 2, this->widget[2].top + 1, chat_captions[this->dtype], TC_BLACK);
@@ -1953,7 +1953,7 @@ struct NetworkCompanyPasswordWindow : public QueryStringBaseWindow {
virtual void OnPaint()
{
- DrawWindowWidgets(this);
+ this->DrawWidgets();
this->DrawEditBox(4);
}
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index b03ae8faf..da8fa6507 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -150,7 +150,7 @@ struct NewGRFAddWindow : public Window {
SetVScrollCount(this, n);
this->SetWidgetDisabledState(ANGRFW_ADD, this->sel == NULL || this->sel->IsOpenTTDBaseGRF());
- DrawWindowWidgets(this);
+ this->DrawWidgets();
GfxFillRect(wl->left + 1, wl->top + 1, wl->right, wl->bottom, 0xD7);
@@ -345,7 +345,7 @@ struct NewGRFWindow : public Window {
if (this->sel->IsOpenTTDBaseGRF()) this->DisableWidget(SNGRFS_REMOVE);
}
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* Draw NewGRF list */
int y = this->widget[SNGRFS_FILE_LIST].top;
diff --git a/src/news_gui.cpp b/src/news_gui.cpp
index 67bf141a8..c16984114 100644
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -182,7 +182,7 @@ struct NewsWindow : Window {
/* Back up transparency options to draw news view */
TransparencyOptionBits to_backup = _transparency_opt;
_transparency_opt = 0;
- DrawWindowViewport(this);
+ this->DrawViewport();
_transparency_opt = to_backup;
/* Shade the viewport into gray, or color*/
@@ -204,12 +204,12 @@ struct NewsWindow : Window {
break;
default:
- DrawWindowWidgets(this);
+ this->DrawWidgets();
if (!(this->ni->flags & NF_VIEWPORT)) {
CopyInDParam(0, this->ni->params, lengthof(this->ni->params));
DrawStringMultiCenter(140, 38, this->ni->string_id, 276);
} else {
- DrawWindowViewport(this);
+ this->DrawViewport();
CopyInDParam(0, this->ni->params, lengthof(this->ni->params));
DrawStringMultiCenter(this->width / 2, this->height - 16, this->ni->string_id, this->width - 4);
}
@@ -647,7 +647,7 @@ static void MessageHistoryWndProc(Window *w, WindowEvent *e)
int y = 19;
SetVScrollCount(w, _total_news);
- DrawWindowWidgets(w);
+ w->DrawWidgets();
if (_total_news == 0) break;
NewsID show = min(_total_news, w->vscroll.cap);
@@ -764,7 +764,7 @@ struct MessageOptionsWindow : Window {
if (_news_ticker_sound) this->LowerWidget(WIDGET_NEWSOPT_SOUNDTICKER);
this->widget[WIDGET_NEWSOPT_DROP_SUMMARY].data = _message_opt[this->state];
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* Draw the string of each setting on each button. */
for (int i = 0, y = 26; i < NT_END; i++, y += 12) {
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index 4589080fb..301e57374 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -709,7 +709,7 @@ public:
}
SetDParam(0, this->vehicle->index);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
int y = 15;
diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp
index c24c5c42e..df954b628 100644
--- a/src/osk_gui.cpp
+++ b/src/osk_gui.cpp
@@ -98,7 +98,7 @@ struct OskWindow : public Window {
this->ChangeOskDiabledState(shift);
SetDParam(0, this->caption);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
for (uint i = 0; i < OSK_KEYBOARD_ENTRIES; i++) {
DrawCharCentered(_keyboard[shift][i],
diff --git a/src/player_gui.cpp b/src/player_gui.cpp
index b7fb61b40..bdc667fa6 100644
--- a/src/player_gui.cpp
+++ b/src/player_gui.cpp
@@ -193,7 +193,7 @@ struct PlayerFinancesWindow : Window {
SetDParam(0, p->index);
SetDParam(1, p->index);
SetDParam(2, LOAN_INTERVAL);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
DrawPlayerEconomyStats(p, this->small);
}
@@ -398,7 +398,7 @@ public:
SetDParam(0, STR_00D1_DARK_BLUE + p->livery[scheme].colour1);
SetDParam(1, STR_00D1_DARK_BLUE + p->livery[scheme].colour2);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
for (scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
if (_livery_class[scheme] == this->livery_class) {
@@ -834,7 +834,7 @@ public:
PFW_WIDGET_GLASSES, PFW_WIDGET_GLASSES_L, PFW_WIDGET_GLASSES_R, WIDGET_LIST_END);
}
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* Draw dynamic button value and labels for the advanced player face selection window */
if (this->advanced) {
@@ -1213,7 +1213,7 @@ struct PlayerCompanyWindow : Window
SetDParam(0, p->index);
SetDParam(1, p->index);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* Player face */
DrawPlayerFace(p->face, p->player_color, 2, 16);
@@ -1367,7 +1367,7 @@ static void BuyCompanyWndProc(Window *w, WindowEvent *e)
Player *p = GetPlayer((PlayerID)w->window_number);
SetDParam(0, STR_COMPANY_NAME);
SetDParam(1, p->index);
- DrawWindowWidgets(w);
+ w->DrawWidgets();
DrawPlayerFace(p->face, p->player_color, 2, 16);
@@ -1436,7 +1436,7 @@ struct EndGameHighScoreBaseWindow : Window
this->widget[0].right = this->width - 1;
this->widget[0].bottom = this->height - 1;
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* Center Highscore/Endscreen background */
*x = max(0, (_screen.width / 2) - (640 / 2));
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index c56f014c4..34a91a6e6 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -567,7 +567,7 @@ static void BuildRailToolbWndProc(Window *w, WindowEvent *e)
switch (e->event) {
case WE_CREATE: w->DisableWidget(RTW_REMOVE); break;
- case WE_PAINT: DrawWindowWidgets(w); break;
+ case WE_PAINT: w->DrawWidgets(); break;
case WE_CLICK:
if (e->we.click.widget >= RTW_BUILD_NS) {
@@ -899,7 +899,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
}
SetDParam(0, GetStationClassName(_railstation.station_class));
- DrawWindowWidgets(w);
+ w->DrawWidgets();
int y_offset = newstations ? 90 : 0;
@@ -1277,7 +1277,7 @@ static void SignalBuildWndProc(Window *w, WindowEvent *e)
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);
+ w->DrawWidgets();
/* The 'hardcoded' off sets are needed because they are reused sprites. */
DrawSignalSprite(w, BSW_SEMAPHORE_NORM, SPR_IMG_SIGNAL_SEMAPHORE_NORM, 0, 12); // xsize of sprite + 1 == 9
@@ -1399,7 +1399,7 @@ static void BuildTrainDepotWndProc(Window *w, WindowEvent *e)
case WE_CREATE: w->LowerWidget(_build_depot_direction + BRDW_DEPOT_NE); break;
case WE_PAINT: {
- DrawWindowWidgets(w);
+ w->DrawWidgets();
DrawTrainDepotSprite(70, 17, DIAGDIR_NE, _cur_railtype);
DrawTrainDepotSprite(70, 69, DIAGDIR_SE, _cur_railtype);
@@ -1477,7 +1477,7 @@ static void BuildWaypointWndProc(Window *w, WindowEvent *e)
w->SetWidgetLoweredState(i + BRWW_WAYPOINT_1, (w->hscroll.pos + i) == _cur_waypoint_type);
}
- DrawWindowWidgets(w);
+ w->DrawWidgets();
for (i = 0; i < w->hscroll.cap; i++) {
if (w->hscroll.pos + i < w->hscroll.count) {
diff --git a/src/road_gui.cpp b/src/road_gui.cpp
index 7016d4b43..fea313c1b 100644
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -468,7 +468,7 @@ static void BuildRoadToolbWndProc(Window *w, WindowEvent *e)
RTW_BUS_STATION,
RTW_TRUCK_STATION,
WIDGET_LIST_END);
- DrawWindowWidgets(w);
+ w->DrawWidgets();
break;
case WE_CLICK:
@@ -733,7 +733,7 @@ static void BuildRoadDepotWndProc(Window *w, WindowEvent *e)
break;
case WE_PAINT:
- DrawWindowWidgets(w);
+ w->DrawWidgets();
DrawRoadDepotSprite(70, 17, DIAGDIR_NE, _cur_roadtype);
DrawRoadDepotSprite(70, 69, DIAGDIR_SE, _cur_roadtype);
@@ -849,7 +849,7 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
break;
case WE_PAINT: {
- DrawWindowWidgets(w);
+ w->DrawWidgets();
if (_station_show_coverage) {
int rad = _patches.modified_catchment ? CA_TRUCK /* = CA_BUS */ : CA_UNMODIFIED;
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index bfa13eadf..3f9176eaf 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -194,7 +194,7 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e)
SetDParam(8, SPECSTR_SCREENSHOT_START + _cur_screenshot_format);
w->SetWidgetLoweredState(GAMEOPT_FULLSCREEN, _fullscreen);
- DrawWindowWidgets(w);
+ w->DrawWidgets();
DrawString(20, 175, STR_OPTIONS_FULLSCREEN, TC_FROMSTRING); // fullscreen
} break;
@@ -565,7 +565,7 @@ public:
virtual void OnPaint()
{
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* XXX - Disabled buttons in normal gameplay or during muliplayer as non server.
* Bitshifted for each button to see if that bit is set. If it is set, the
@@ -903,7 +903,7 @@ struct PatchesSelectionWindow : Window {
uint i;
/* Set up selected category */
- DrawWindowWidgets(this);
+ this->DrawWidgets();
x = 5;
y = 47;
@@ -1159,7 +1159,7 @@ struct CustomCurrencyWindow : Window {
{
int x;
int y = 20;
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* exchange rate */
DrawArrowButtons(10, y, 3, GB(this->click, 0, 2), true, true);
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index 3c282b6a5..63fb571b1 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -75,7 +75,7 @@ static void SignListWndProc(Window *w, WindowEvent *e)
SetVScrollCount(w, _num_sign_sort);
SetDParam(0, w->vscroll.count);
- DrawWindowWidgets(w);
+ w->DrawWidgets();
/* No signs? */
int y = 16; // offset from top of widget
@@ -197,7 +197,7 @@ struct SignWindow : QueryStringBaseWindow {
virtual void OnPaint()
{
SetDParam(0, this->caption);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
this->DrawEditBox(QUERY_EDIT_SIGN_WIDGET_TEXT);
}
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp
index b2e4be10d..0d25b28b5 100644
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -847,7 +847,7 @@ public:
/* draw the window */
SetDParam(0, STR_00E5_CONTOURS + _smallmap_type);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
tbl = _legend_table[_smallmap_type];
@@ -1153,8 +1153,8 @@ public:
/* set the number in the title bar */
SetDParam(0, this->window_number + 1);
- DrawWindowWidgets(this);
- DrawWindowViewport(this);
+ this->DrawWidgets();
+ this->DrawViewport();
}
virtual void OnClick(Point pt, int widget)
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 36f2fc21b..2e05722b4 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -369,10 +369,10 @@ struct PlayerStationsWindow : public Window, public GUIStationList
/* Set text of sort by dropdown */
this->widget[SLW_SORTDROPBTN].data = _station_sort_listing[this->sort_type];
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* draw arrow pointing up/down for ascending/descending sorting */
- DrawSortButtonState(this, SLW_SORTBY, this->flags & VL_DESC ? SBS_DOWN : SBS_UP);
+ this->DrawSortButtonState(SLW_SORTBY, this->flags & VL_DESC ? SBS_DOWN : SBS_UP);
int cg_ofst;
int x = 89;
@@ -813,7 +813,7 @@ struct StationViewWindow : public Window {
SetDParam(0, st->index);
SetDParam(1, st->facilities);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
int x = 2; ///< coordinates used for printing waiting/accepted/rating of cargo
int y = 15;
diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp
index f31a0744b..aa3a3c90c 100644
--- a/src/statusbar_gui.cpp
+++ b/src/statusbar_gui.cpp
@@ -80,7 +80,7 @@ struct StatusBarWindow : Window {
{
const Player *p = (_local_player == PLAYER_SPECTATOR) ? NULL : GetPlayer(_local_player);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
SetDParam(0, _date);
DrawStringCentered(70, 1, (_pause_game || _patches.status_long_date) ? STR_00AF : STR_00AE, TC_FROMSTRING);
diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp
index a9c62154f..bf1a67181 100644
--- a/src/subsidy_gui.cpp
+++ b/src/subsidy_gui.cpp
@@ -96,7 +96,7 @@ static void DrawSubsidiesWindow(const Window *w)
int x;
int y;
- DrawWindowWidgets(w);
+ w->DrawWidgets();
ConvertDateToYMD(_date, &ymd);
diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp
index 692c7cc57..c24d85c6a 100644
--- a/src/terraform_gui.cpp
+++ b/src/terraform_gui.cpp
@@ -236,7 +236,7 @@ static void TerraformToolbWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
case WE_PAINT:
- DrawWindowWidgets(w);
+ w->DrawWidgets();
break;
case WE_CLICK:
@@ -578,7 +578,7 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e)
break;
case WE_PAINT: {
- DrawWindowWidgets(w);
+ w->DrawWidgets();
int n = _terraform_size * _terraform_size;
const int8 *coords = &_multi_terraform_coords[0][0];
diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp
index b69a44217..70a72bef3 100644
--- a/src/timetable_gui.cpp
+++ b/src/timetable_gui.cpp
@@ -108,7 +108,7 @@ struct TimetableWindow : Window {
this->SetWidgetLoweredState(TTV_AUTOFILL, HasBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE));
SetDParam(0, v->index);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
int y = 15;
int i = this->vscroll.pos;
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp
index 45274bce3..0a3be270e 100644
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -684,7 +684,7 @@ static void MainToolbarWndProc(Window *w, WindowEvent *e)
w->SetWidgetDisabledState(19, !CanBuildVehicleInfrastructure(VEH_TRAIN));
w->SetWidgetDisabledState(22, !CanBuildVehicleInfrastructure(VEH_AIRCRAFT));
- DrawWindowWidgets(w);
+ w->DrawWidgets();
break;
case WE_CLICK:
@@ -887,7 +887,7 @@ static void ScenEditToolbarWndProc(Window *w, WindowEvent *e)
GfxFillRect(0, 0, w->width - 1, w->height - 1, 0xB2);
GfxFillRect(0, 0, w->width - 1, w->height - 1, 0xB4 | (1 << PALETTE_MODIFIER_GREYOUT));
- DrawWindowWidgets(w);
+ w->DrawWidgets();
SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1));
DrawStringCenteredTruncated(w->widget[6].right, w->widget[7].left, 6, STR_00AF, TC_FROMSTRING);
@@ -1146,7 +1146,7 @@ struct ToolbarMenuWindow : Window {
virtual void OnPaint()
{
- DrawWindowWidgets(this);
+ this->DrawWidgets();
for (int i = 0, x = 1, y = 1; i != this->item_count; i++, y += 10) {
TextColour color = HasBit(this->disabled_items, i) ? TC_GREY : (this->sel_index == i) ? TC_WHITE : TC_BLACK;
@@ -1323,7 +1323,7 @@ struct ToolbarPlayerMenuWindow : Window {
virtual void OnPaint()
{
this->UpdatePlayerMenuHeight();
- DrawWindowWidgets(this);
+ this->DrawWidgets();
int x = 1;
int y = 1;
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index bb59b71bb..d8d32153c 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -167,7 +167,7 @@ struct TownAuthorityWindow : Window {
this->SetWidgetDisabledState(6, this->sel_index == -1);
SetDParam(0, this->window_number);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
DrawString(2, 15, STR_2023_TRANSPORT_COMPANY_RATINGS, TC_FROMSTRING);
@@ -310,7 +310,7 @@ static void TownViewWndProc(Window *w, WindowEvent *e)
w->SetWidgetDisabledState(TVW_CHANGENAME, _networking && !_network_server);
SetDParam(0, t->index);
- DrawWindowWidgets(w);
+ w->DrawWidgets();
SetDParam(0, t->population);
SetDParam(1, t->num_houses);
@@ -324,7 +324,7 @@ static void TownViewWndProc(Window *w, WindowEvent *e)
SetDParam(1, t->max_mail);
DrawString(2, 127, STR_200E_MAIL_LAST_MONTH_MAX, TC_FROMSTRING);
- DrawWindowViewport(w);
+ w->DrawViewport();
break;
case WE_CLICK:
@@ -489,8 +489,8 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e)
SetVScrollCount(w, _num_town_sort);
- DrawWindowWidgets(w);
- DrawSortButtonState(w, (_town_sort_order <= 1) ? TDW_SORTNAME : TDW_SORTPOPULATION, _town_sort_order & 1 ? SBS_DOWN : SBS_UP);
+ w->DrawWidgets();
+ w->DrawSortButtonState((_town_sort_order <= 1) ? TDW_SORTNAME : TDW_SORTPOPULATION, _town_sort_order & 1 ? SBS_DOWN : SBS_UP);
{
int n = 0;
@@ -626,7 +626,7 @@ static void ScenEditTownGenWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
case WE_PAINT:
- DrawWindowWidgets(w);
+ w->DrawWidgets();
break;
case WE_CREATE:
diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp
index f1e0d52fa..33ace7898 100644
--- a/src/transparency_gui.cpp
+++ b/src/transparency_gui.cpp
@@ -49,7 +49,7 @@ public:
this->SetWidgetLoweredState(i, IsTransparencySet((TransparencyOption)(i - TTW_WIDGET_SIGNS)));
}
- DrawWindowWidgets(this);
+ this->DrawWidgets();
for (uint i = TO_SIGNS; i < TO_END; i++) {
if (HasBit(_transparency_lock, i)) DrawSprite(SPR_LOCK, PAL_NONE, this->widget[TTW_WIDGET_SIGNS + i].left + 1, this->widget[TTW_WIDGET_SIGNS + i].top + 1);
}
diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp
index 866ac91f1..d02c55648 100644
--- a/src/tree_gui.cpp
+++ b/src/tree_gui.cpp
@@ -72,7 +72,7 @@ public:
{ 0x7BA, PAL_NONE }, { 0x7C1, PALETTE_TO_RED, }, { 0x7C8, PALETTE_TO_PALE_GREEN }, { 0x7CF, PALETTE_TO_YELLOW }, { 0x7D6, PALETTE_TO_RED }
};
- DrawWindowWidgets(this);
+ this->DrawWidgets();
int i = this->base = _tree_base_by_landscape[_opt.landscape];
int count = this->count = _tree_count_by_landscape[_opt.landscape];
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index b5e6568d5..274c9e20f 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -394,7 +394,7 @@ struct RefitWindow : public Window {
SetVScrollCount(this, this->list->num_lines);
SetDParam(0, v->index);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
this->cargo = DrawVehicleRefitWindow(this->list, this->sel, this->vscroll.pos, this->vscroll.cap, this->resize.step_height);
@@ -1028,12 +1028,12 @@ struct VehicleListWindow : public Window, public VehicleListBase {
VLW_WIDGET_START_ALL,
WIDGET_LIST_END);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* draw sorting criteria string */
DrawString(85, 15, _vehicle_sort_listing[this->vehicles.sort_type], TC_BLACK);
/* draw arrow pointing up/down for ascending/descending sorting */
- DrawSortButtonState(this, VLW_WIDGET_SORT_ORDER, this->vehicles.flags & VL_DESC ? SBS_DOWN : SBS_UP);
+ this->DrawSortButtonState(VLW_WIDGET_SORT_ORDER, this->vehicles.flags & VL_DESC ? SBS_DOWN : SBS_UP);
max = min(this->vscroll.pos + this->vscroll.cap, this->vehicles.list_length);
for (i = this->vscroll.pos; i < max; ++i) {
@@ -1508,7 +1508,7 @@ struct VehicleDetailsWindow : Window {
SetDParam(0, v->index);
- DrawWindowWidgets(this);
+ this->DrawWidgets();
/* Draw running cost */
SetDParam(1, v->age / 366);
@@ -1942,7 +1942,7 @@ static void DrawVehicleViewWindow(Window *w)
/* draw widgets & caption */
SetDParam(0, v->index);
- DrawWindowWidgets(w);
+ w->DrawWidgets();
if (v->vehstatus & VS_CRASHED) {
str = STR_8863_CRASHED;
@@ -2021,7 +2021,7 @@ static void DrawVehicleViewWindow(Window *w)
/* draw the flag plus orders */
DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, PAL_NONE, 2, w->widget[VVW_WIDGET_START_STOP_VEH].top + 1);
DrawStringCenteredTruncated(w->widget[VVW_WIDGET_START_STOP_VEH].left + 8, w->widget[VVW_WIDGET_START_STOP_VEH].right, w->widget[VVW_WIDGET_START_STOP_VEH].top + 1, str, TC_FROMSTRING);
- DrawWindowViewport(w);
+ w->DrawViewport();
}
/** Command indices for the _vehicle_command_translation_table. */
diff --git a/src/viewport.cpp b/src/viewport.cpp
index f090a7565..6cc15e30c 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -1536,17 +1536,17 @@ static inline void ViewportDraw(const ViewPort *vp, int left, int top, int right
ViewportDrawChk(vp, left, top, right, bottom);
}
-void DrawWindowViewport(const Window *w)
+void Window::DrawViewport() const
{
DrawPixelInfo *dpi = _cur_dpi;
- dpi->left += w->left;
- dpi->top += w->top;
+ dpi->left += this->left;
+ dpi->top += this->top;
- ViewportDraw(w->viewport, dpi->left, dpi->top, dpi->left + dpi->width, dpi->top + dpi->height);
+ ViewportDraw(this->viewport, dpi->left, dpi->top, dpi->left + dpi->width, dpi->top + dpi->height);
- dpi->left -= w->left;
- dpi->top -= w->top;
+ dpi->left -= this->left;
+ dpi->top -= this->top;
}
static inline void ClampViewportToMap(const ViewPort *vp, int &x, int &y)
diff --git a/src/widget.cpp b/src/widget.cpp
index 737d3d6d5..9aa1e42d9 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -190,20 +190,20 @@ void DrawFrameRect(int left, int top, int right, int bottom, int ctab, FrameFlag
* Paint all widgets of a window.
* @param w Window
*/
-void DrawWindowWidgets(const Window *w)
+void Window::DrawWidgets() const
{
const DrawPixelInfo* dpi = _cur_dpi;
- for (uint i = 0; i < w->widget_count; i++) {
- const Widget *wi = &w->widget[i];
- bool clicked = w->IsWidgetLowered(i);
+ for (uint i = 0; i < this->widget_count; i++) {
+ const Widget *wi = &this->widget[i];
+ bool clicked = this->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) ||
- w->IsWidgetHidden(i)) {
+ this->IsWidgetHidden(i)) {
continue;
}
@@ -304,11 +304,11 @@ void DrawWindowWidgets(const Window *w)
assert(r.right - r.left == 11); // To ensure the same sizes are used everywhere!
/* draw up/down buttons */
- clicked = ((w->flags4 & (WF_SCROLL_UP | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_UP);
+ clicked = ((this->flags4 & (WF_SCROLL_UP | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_UP);
DrawFrameRect(r.left, r.top, r.right, r.top + 9, wi->color, (clicked) ? FR_LOWERED : FR_NONE);
DoDrawString(UPARROW, r.left + 2 + clicked, r.top + clicked, TC_BLACK);
- clicked = (((w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_DOWN));
+ clicked = (((this->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_DOWN));
DrawFrameRect(r.left, r.bottom - 9, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : FR_NONE);
DoDrawString(DOWNARROW, r.left + 2 + clicked, r.bottom - 9 + clicked, TC_BLACK);
@@ -325,8 +325,8 @@ void DrawWindowWidgets(const Window *w)
GfxFillRect(r.left + 7, r.top + 10, r.left + 7, r.bottom - 10, c1);
GfxFillRect(r.left + 8, r.top + 10, r.left + 8, r.bottom - 10, c2);
- Point pt = HandleScrollbarHittest(&w->vscroll, r.top, r.bottom);
- DrawFrameRect(r.left, pt.x, r.right, pt.y, wi->color, (w->flags4 & (WF_SCROLL_MIDDLE | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_MIDDLE ? FR_LOWERED : FR_NONE);
+ Point pt = HandleScrollbarHittest(&this->vscroll, r.top, r.bottom);
+ DrawFrameRect(r.left, pt.x, r.right, pt.y, wi->color, (this->flags4 & (WF_SCROLL_MIDDLE | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_MIDDLE ? FR_LOWERED : FR_NONE);
break;
}
@@ -335,11 +335,11 @@ void DrawWindowWidgets(const Window *w)
assert(r.right - r.left == 11); // To ensure the same sizes are used everywhere!
/* draw up/down buttons */
- clicked = ((w->flags4 & (WF_SCROLL_UP | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_UP | WF_SCROLL2));
+ clicked = ((this->flags4 & (WF_SCROLL_UP | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_UP | WF_SCROLL2));
DrawFrameRect(r.left, r.top, r.right, r.top + 9, wi->color, (clicked) ? FR_LOWERED : FR_NONE);
DoDrawString(UPARROW, r.left + 2 + clicked, r.top + clicked, TC_BLACK);
- clicked = ((w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_DOWN | WF_SCROLL2));
+ clicked = ((this->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_DOWN | WF_SCROLL2));
DrawFrameRect(r.left, r.bottom - 9, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : FR_NONE);
DoDrawString(DOWNARROW, r.left + 2 + clicked, r.bottom - 9 + clicked, TC_BLACK);
@@ -356,8 +356,8 @@ void DrawWindowWidgets(const Window *w)
GfxFillRect(r.left + 7, r.top + 10, r.left + 7, r.bottom - 10, c1);
GfxFillRect(r.left + 8, r.top + 10, r.left + 8, r.bottom - 10, c2);
- Point pt = HandleScrollbarHittest(&w->vscroll2, r.top, r.bottom);
- DrawFrameRect(r.left, pt.x, r.right, pt.y, wi->color, (w->flags4 & (WF_SCROLL_MIDDLE | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_MIDDLE | WF_SCROLL2) ? FR_LOWERED : FR_NONE);
+ Point pt = HandleScrollbarHittest(&this->vscroll2, r.top, r.bottom);
+ DrawFrameRect(r.left, pt.x, r.right, pt.y, wi->color, (this->flags4 & (WF_SCROLL_MIDDLE | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_MIDDLE | WF_SCROLL2) ? FR_LOWERED : FR_NONE);
break;
}
@@ -366,11 +366,11 @@ void DrawWindowWidgets(const Window *w)
assert(wi->data == 0);
assert(r.bottom - r.top == 11); // To ensure the same sizes are used everywhere!
- clicked = ((w->flags4 & (WF_SCROLL_UP | WF_HSCROLL)) == (WF_SCROLL_UP | WF_HSCROLL));
+ clicked = ((this->flags4 & (WF_SCROLL_UP | WF_HSCROLL)) == (WF_SCROLL_UP | WF_HSCROLL));
DrawFrameRect(r.left, r.top, r.left + 9, r.bottom, wi->color, (clicked) ? FR_LOWERED : FR_NONE);
DrawSprite(SPR_ARROW_LEFT, PAL_NONE, r.left + 1 + clicked, r.top + 1 + clicked);
- clicked = ((w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL)) == (WF_SCROLL_DOWN | WF_HSCROLL));
+ clicked = ((this->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL)) == (WF_SCROLL_DOWN | WF_HSCROLL));
DrawFrameRect(r.right - 9, r.top, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : FR_NONE);
DrawSprite(SPR_ARROW_RIGHT, PAL_NONE, r.right - 8 + clicked, r.top + 1 + clicked);
@@ -388,8 +388,8 @@ void DrawWindowWidgets(const Window *w)
GfxFillRect(r.left + 10, r.top + 8, r.right - 10, r.top + 8, c2);
/* draw actual scrollbar */
- Point pt = HandleScrollbarHittest(&w->hscroll, r.left, r.right);
- DrawFrameRect(pt.x, r.top, pt.y, r.bottom, wi->color, (w->flags4 & (WF_SCROLL_MIDDLE | WF_HSCROLL)) == (WF_SCROLL_MIDDLE | WF_HSCROLL) ? FR_LOWERED : FR_NONE);
+ Point pt = HandleScrollbarHittest(&this->hscroll, r.left, r.right);
+ DrawFrameRect(pt.x, r.top, pt.y, r.bottom, wi->color, (this->flags4 & (WF_SCROLL_MIDDLE | WF_HSCROLL)) == (WF_SCROLL_MIDDLE | WF_HSCROLL) ? FR_LOWERED : FR_NONE);
break;
}
@@ -429,7 +429,7 @@ void DrawWindowWidgets(const Window *w)
assert(wi->data == 0);
assert(r.right - r.left == 11); // To ensure the same sizes are used everywhere!
- clicked = !!(w->flags4 & WF_STICKY);
+ clicked = !!(this->flags4 & WF_STICKY);
DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : FR_NONE);
DrawSprite((clicked) ? SPR_PIN_UP : SPR_PIN_DOWN, PAL_NONE, r.left + 2 + clicked, r.top + 3 + clicked);
break;
@@ -438,7 +438,7 @@ void DrawWindowWidgets(const Window *w)
assert(wi->data == 0);
assert(r.right - r.left == 11); // To ensure the same sizes are used everywhere!
- clicked = !!(w->flags4 & WF_SIZING);
+ clicked = !!(this->flags4 & WF_SIZING);
DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : FR_NONE);
DrawSprite(SPR_WINDOW_RESIZE, PAL_NONE, r.left + 3 + clicked, r.top + 3 + clicked);
break;
@@ -457,10 +457,10 @@ void DrawWindowWidgets(const Window *w)
case WWT_CAPTION:
assert(r.bottom - r.top == 13); // To ensure the same sizes are used everywhere!
DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, FR_BORDERONLY);
- DrawFrameRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, wi->color, (w->caption_color == 0xFF) ? FR_LOWERED | FR_DARKENED : FR_LOWERED | FR_DARKENED | FR_BORDERONLY);
+ DrawFrameRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, wi->color, (this->caption_color == 0xFF) ? FR_LOWERED | FR_DARKENED : FR_LOWERED | FR_DARKENED | FR_BORDERONLY);
- if (w->caption_color != 0xFF) {
- GfxFillRect(r.left + 2, r.top + 2, r.right - 2, r.bottom - 2, _colour_gradient[_player_colors[w->caption_color]][4]);
+ if (this->caption_color != 0xFF) {
+ GfxFillRect(r.left + 2, r.top + 2, r.right - 2, r.bottom - 2, _colour_gradient[_player_colors[this->caption_color]][4]);
}
DrawStringCenteredTruncated(r.left + 2, r.right - 2, r.top + 2, wi->data, 0x84);
@@ -489,14 +489,14 @@ void DrawWindowWidgets(const Window *w)
}
}
- if (w->IsWidgetDisabled(i)) {
+ if (this->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));
}
}
- if (w->flags4 & WF_WHITE_BORDER_MASK) {
- DrawFrameRect(0, 0, w->width - 1, w->height - 1, 0xF, FR_BORDERONLY);
+ if (this->flags4 & WF_WHITE_BORDER_MASK) {
+ DrawFrameRect(0, 0, this->width - 1, this->height - 1, 0xF, FR_BORDERONLY);
}
}
@@ -597,10 +597,10 @@ void ResizeWindowForWidget(Window *w, int widget, int delta_x, int delta_y)
* @param widget Sort button widget
* @param state State of sort button
*/
-void DrawSortButtonState(const Window *w, int widget, SortButtonState state)
+void Window::DrawSortButtonState(int widget, SortButtonState state) const
{
if (state == SBS_OFF) return;
- int offset = w->IsWidgetLowered(widget) ? 1 : 0;
- DoDrawString(state == SBS_DOWN ? DOWNARROW : UPARROW, w->widget[widget].right - 11 + offset, w->widget[widget].top + 1 + offset, TC_BLACK);
+ int offset = this->IsWidgetLowered(widget) ? 1 : 0;
+ DoDrawString(state == SBS_DOWN ? DOWNARROW : UPARROW, this->widget[widget].right - 11 + offset, this->widget[widget].top + 1 + offset, TC_BLACK);
}
diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp
index bab184da7..67cb77b89 100644
--- a/src/widgets/dropdown.cpp
+++ b/src/widgets/dropdown.cpp
@@ -118,7 +118,7 @@ struct DropdownWindow : Window {
virtual void OnPaint()
{
- DrawWindowWidgets(this);
+ this->DrawWidgets();
int x = 1;
int y = 2;
diff --git a/src/window_gui.h b/src/window_gui.h
index 44b915a15..ab74b0c42 100644
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -245,6 +245,12 @@ struct ResizeInfo {
uint step_height; ///< Step-size of height resize changes
};
+enum SortButtonState {
+ SBS_OFF,
+ SBS_DOWN,
+ SBS_UP,
+};
+
/**
* Data structure for a window viewport
*/
@@ -322,6 +328,10 @@ public:
void CDECL SetWidgetsLoweredState(bool lowered_stat, int widgets, ...);
void InvalidateWidget(byte widget_index) const;
+ void DrawWidgets() const;
+ void DrawViewport() const;
+ void DrawSortButtonState(int widget, SortButtonState state) const;
+
void SetDirty() const;
/*** Event handling ***/
@@ -612,8 +622,6 @@ Wcls *AllocateWindowDescFront(const WindowDesc *desc, int window_number)
return new Wcls(desc, window_number);
}
-void DrawWindowViewport(const Window *w);
-
void RelocateAllWindows(int neww, int newh);
/* misc_gui.cpp */
@@ -625,17 +633,6 @@ static inline void GuiShowTooltips(StringID str)
/* widget.cpp */
int GetWidgetFromPos(const Window *w, int x, int y);
-void DrawWindowWidgets(const Window *w);
-
-enum SortButtonState {
- SBS_OFF,
- SBS_DOWN,
- SBS_UP,
-};
-
-void DrawSortButtonState(const Window *w, int widget, SortButtonState state);
-
-
/* window.cpp */
extern Window *_z_windows[];