(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.

pull/155/head
rubidium 17 years ago
parent 7f6ccdc624
commit a89b5721a8

@ -69,7 +69,7 @@ static void BuildAirToolbWndProc(Window *w, WindowEvent *e)
{ {
switch (e->event) { switch (e->event) {
case WE_PAINT: case WE_PAINT:
DrawWindowWidgets(w); w->DrawWidgets();
break; break;
case WE_CLICK: case WE_CLICK:
@ -197,7 +197,7 @@ public:
if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
DrawWindowWidgets(this); this->DrawWidgets();
/* strings such as 'Size' and 'Coverage Area' */ /* strings such as 'Size' and 'Coverage Area' */
int text_end = DrawStationCoverageAreaText(2, 206, SCT_ALL, rad, false); int text_end = DrawStationCoverageAreaText(2, 206, SCT_ALL, rad, false);
text_end = DrawStationCoverageAreaText(2, text_end + 4, SCT_ALL, rad, true) + 4; text_end = DrawStationCoverageAreaText(2, text_end + 4, SCT_ALL, rad, true) + 4;

@ -360,7 +360,7 @@ public:
this->widget[RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN].data = _rail_types_list[sel_railtype]; 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 */ /* sets up the string for the vehicle that is being replaced to */
if (selected_id[0] != INVALID_ENGINE) { if (selected_id[0] != INVALID_ENGINE) {

@ -75,7 +75,7 @@ static void BuildBridgeWndProc(Window *w, WindowEvent *e)
break; break;
case WE_PAINT: { case WE_PAINT: {
DrawWindowWidgets(w); w->DrawWidgets();
uint y = 15; uint y = 15;
for (uint i = 0; (i < w->vscroll.cap) && ((i + w->vscroll.pos) < _bridgedata.count); i++) { for (uint i = 0; (i < w->vscroll.cap) && ((i + w->vscroll.pos) < _bridgedata.count); i++) {

@ -1114,7 +1114,7 @@ struct BuildVehicleWindow : Window {
/* Set text of sort by dropdown */ /* Set text of sort by dropdown */
this->widget[BUILD_VEHICLE_WIDGET_SORT_DROPDOWN].data = _sort_listing[this->vehicle_type][this->sort_criteria]; 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); 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) virtual void OnDoubleClick(Point pt, int widget)

@ -129,7 +129,7 @@ struct CheatWindow : Window {
virtual void OnPaint() virtual void OnPaint()
{ {
DrawWindowWidgets(this); this->DrawWidgets();
DrawStringMultiCenter(200, 25, STR_CHEATS_WARNING, width - 50); DrawStringMultiCenter(200, 25, STR_CHEATS_WARNING, width - 50);
for (int i = 0, x = 0, y = 45; i != lengthof(_cheats_ui); i++) { for (int i = 0, x = 0, y = 45; i != lengthof(_cheats_ui); i++) {

@ -365,7 +365,7 @@ struct DepotWindow : Window {
SetDParam(0, depot->town_index); SetDParam(0, depot->town_index);
} }
DrawWindowWidgets(w); w->DrawWidgets();
num = this->vscroll.pos * boxes_in_each_row; num = this->vscroll.pos * boxes_in_each_row;
maxval = min(this->engine_count, num + (rows_in_display * boxes_in_each_row)); maxval = min(this->engine_count, num + (rows_in_display * boxes_in_each_row));

@ -129,7 +129,7 @@ static void BuildDocksToolbWndProc(Window *w, WindowEvent *e)
{ {
switch (e->event) { switch (e->event) {
case WE_PAINT: case WE_PAINT:
DrawWindowWidgets(w); w->DrawWidgets();
w->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_SHIP), 7, 8, 9, WIDGET_LIST_END); w->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_SHIP), 7, 8, 9, WIDGET_LIST_END);
break; break;
@ -238,7 +238,7 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e)
case WE_PAINT: { case WE_PAINT: {
int rad = (_patches.modified_catchment) ? CA_DOCK : CA_UNMODIFIED; int rad = (_patches.modified_catchment) ? CA_DOCK : CA_UNMODIFIED;
DrawWindowWidgets(w); w->DrawWidgets();
if (_station_show_coverage) { if (_station_show_coverage) {
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); 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_CREATE: w->LowerWidget(_ship_depot_direction + 3); break;
case WE_PAINT: case WE_PAINT:
DrawWindowWidgets(w); w->DrawWidgets();
DrawShipDepotSprite(67, 35, 0); DrawShipDepotSprite(67, 35, 0);
DrawShipDepotSprite(35, 51, 1); DrawShipDepotSprite(35, 51, 1);

@ -74,7 +74,7 @@ static void EnginePreviewWndProc(Window *w, WindowEvent *e)
const DrawEngineInfo* dei; const DrawEngineInfo* dei;
int width; int width;
DrawWindowWidgets(w); w->DrawWidgets();
SetDParam(0, GetEngineCategoryName(engine)); SetDParam(0, GetEngineCategoryName(engine));
DrawStringMultiCenter(150, 44, STR_8101_WE_HAVE_JUST_DESIGNED_A, 296); DrawStringMultiCenter(150, 44, STR_8101_WE_HAVE_JUST_DESIGNED_A, 296);

@ -315,7 +315,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
SetDParam(2, 1 << _patches_newgame.map_y); // GLAND_MAPSIZE_Y_PULLDOWN SetDParam(2, 1 << _patches_newgame.map_y); // GLAND_MAPSIZE_Y_PULLDOWN
SetDParam(3, _patches_newgame.snow_line_height); // GLAND_SNOW_LEVEL_TEXT SetDParam(3, _patches_newgame.snow_line_height); // GLAND_SNOW_LEVEL_TEXT
DrawWindowWidgets(this); this->DrawWidgets();
this->DrawEditBox(GLAND_RANDOM_EDITBOX); 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(2, 1 << _patches_newgame.map_y); // CSCEN_MAPSIZE_Y_PULLDOWN
SetDParam(3, _patches_newgame.se_flat_world_height); // CSCEN_FLAT_LAND_HEIGHT_TEXT SetDParam(3, _patches_newgame.se_flat_world_height); // CSCEN_FLAT_LAND_HEIGHT_TEXT
DrawWindowWidgets(this); this->DrawWidgets();
} }
virtual void OnClick(Point pt, int widget) virtual void OnClick(Point pt, int widget)
@ -873,7 +873,7 @@ public:
virtual void OnPaint() virtual void OnPaint()
{ {
DrawWindowWidgets(this); this->DrawWidgets();
/* Draw the % complete with a bar and a text */ /* Draw the % complete with a bar and a text */
DrawFrameRect(19, 20, (this->width - 18), 37, 14, FR_BORDERONLY); DrawFrameRect(19, 20, (this->width - 18), 37, 14, FR_BORDERONLY);

@ -285,7 +285,7 @@ static void GraphLegendWndProc(Window *w, WindowEvent *e)
w->RaiseWidget(p->index + 3); w->RaiseWidget(p->index + 3);
} }
DrawWindowWidgets(w); w->DrawWidgets();
FOR_ALL_PLAYERS(p) { FOR_ALL_PLAYERS(p) {
if (!p->is_active) continue; if (!p->is_active) continue;
@ -384,7 +384,7 @@ static void OperatingProfitWndProc(Window *w, WindowEvent *e)
GraphDrawer gd; GraphDrawer gd;
const Player* p; const Player* p;
DrawWindowWidgets(w); w->DrawWidgets();
gd.left = 2; gd.left = 2;
gd.top = 18; gd.top = 18;
@ -455,7 +455,7 @@ static void IncomeGraphWndProc(Window *w, WindowEvent *e)
GraphDrawer gd; GraphDrawer gd;
const Player* p; const Player* p;
DrawWindowWidgets(w); w->DrawWidgets();
gd.left = 2; gd.left = 2;
gd.top = 18; gd.top = 18;
@ -522,7 +522,7 @@ static void DeliveredCargoGraphWndProc(Window *w, WindowEvent *e)
GraphDrawer gd; GraphDrawer gd;
const Player* p; const Player* p;
DrawWindowWidgets(w); w->DrawWidgets();
gd.left = 2; gd.left = 2;
gd.top = 18; gd.top = 18;
@ -589,7 +589,7 @@ static void PerformanceHistoryWndProc(Window *w, WindowEvent *e)
GraphDrawer gd; GraphDrawer gd;
const Player* p; const Player* p;
DrawWindowWidgets(w); w->DrawWidgets();
gd.left = 2; gd.left = 2;
gd.top = 18; gd.top = 18;
@ -658,7 +658,7 @@ static void CompanyValueGraphWndProc(Window *w, WindowEvent *e)
GraphDrawer gd; GraphDrawer gd;
const Player* p; const Player* p;
DrawWindowWidgets(w); w->DrawWidgets();
gd.left = 2; gd.left = 2;
gd.top = 18; gd.top = 18;
@ -724,7 +724,7 @@ static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e)
case WE_PAINT: { case WE_PAINT: {
GraphDrawer gd; GraphDrawer gd;
DrawWindowWidgets(w); w->DrawWidgets();
int x = 495; int x = 495;
int y = 24; int y = 24;
@ -886,7 +886,7 @@ static void CompanyLeagueWndProc(Window *w, WindowEvent *e)
const Player* plist[MAX_PLAYERS]; const Player* plist[MAX_PLAYERS];
const Player* p; const Player* p;
DrawWindowWidgets(w); w->DrawWidgets();
uint pl_num = 0; uint pl_num = 0;
FOR_ALL_PLAYERS(p) if (p->is_active) plist[pl_num++] = p; FOR_ALL_PLAYERS(p) if (p->is_active) plist[pl_num++] = p;
@ -973,7 +973,7 @@ struct PerformanceRatingDetailWindow : Window {
int color_done, color_notdone; int color_done, color_notdone;
/* Draw standard stuff */ /* Draw standard stuff */
DrawWindowWidgets(this); this->DrawWidgets();
/* Check if the currently selected player is still active. */ /* Check if the currently selected player is still active. */
if (player == INVALID_PLAYER || !GetPlayer(player)->is_active) { if (player == INVALID_PLAYER || !GetPlayer(player)->is_active) {

@ -403,7 +403,7 @@ struct VehicleGroupWindow : public Window, public VehicleListBase {
/* Set text of sort by dropdown */ /* Set text of sort by dropdown */
this->widget[GRP_WIDGET_SORT_BY_DROPDOWN].data = _vehicle_sort_listing[this->vehicles.sort_type]; this->widget[GRP_WIDGET_SORT_BY_DROPDOWN].data = _vehicle_sort_listing[this->vehicles.sort_type];
DrawWindowWidgets(this); this->DrawWidgets();
/* Draw Matrix Group /* Draw Matrix Group
* The selected group is drawn in white */ * 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); 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 */ /* Draw Matrix Vehicle according to the vehicle list built before */
max = min(this->vscroll2.pos + this->vscroll2.cap, this->vehicles.list_length); max = min(this->vscroll2.pos + this->vscroll2.cap, this->vehicles.list_length);

@ -204,7 +204,7 @@ public:
SetVScrollCount(this, this->count); SetVScrollCount(this, this->count);
DrawWindowWidgets(this); this->DrawWidgets();
/* and now with the matrix painting */ /* and now with the matrix painting */
for (byte i = 0; i < this->vscroll.cap && ((i + this->vscroll.pos) < this->count); i++) { for (byte i = 0; i < this->vscroll.cap && ((i + this->vscroll.pos) < this->count); i++) {
@ -481,7 +481,7 @@ public:
bool has_accept = false; bool has_accept = false;
SetDParam(0, this->window_number); 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)) { 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++) { for (byte j = 0; j < lengthof(i->accepts_cargo); j++) {
@ -564,7 +564,7 @@ public:
return; return;
} }
DrawWindowViewport(this); this->DrawViewport();
} }
virtual void OnClick(Point pt, int widget) virtual void OnClick(Point pt, int widget)
@ -840,8 +840,8 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
SetVScrollCount(w, _num_industry_sort); SetVScrollCount(w, _num_industry_sort);
DrawWindowWidgets(w); w->DrawWidgets();
DrawSortButtonState(w, IDW_SORTBYNAME + (_industry_sort_order >> 1), _industry_sort_order & 1 ? SBS_DOWN : SBS_UP); w->DrawSortButtonState(IDW_SORTBYNAME + (_industry_sort_order >> 1), _industry_sort_order & 1 ? SBS_DOWN : SBS_UP);
uint pos = w->vscroll.pos; uint pos = w->vscroll.pos;
int n = 0; int n = 0;

@ -82,7 +82,7 @@ static void SelectGameWndProc(Window *w, WindowEvent *e)
w->SetWidgetLoweredState(SGI_TROPIC_LANDSCAPE, _opt_newgame.landscape == LT_TROPIC); w->SetWidgetLoweredState(SGI_TROPIC_LANDSCAPE, _opt_newgame.landscape == LT_TROPIC);
w->SetWidgetLoweredState(SGI_TOYLAND_LANDSCAPE, _opt_newgame.landscape == LT_TOYLAND); w->SetWidgetLoweredState(SGI_TOYLAND_LANDSCAPE, _opt_newgame.landscape == LT_TOYLAND);
SetDParam(0, STR_6801_EASY + _opt_newgame.diff_level); SetDParam(0, STR_6801_EASY + _opt_newgame.diff_level);
DrawWindowWidgets(w); w->DrawWidgets();
break; break;
case WE_CLICK: case WE_CLICK:

@ -224,7 +224,7 @@ struct MainWindow : Window
virtual void OnPaint() virtual void OnPaint()
{ {
DrawWindowViewport(this); this->DrawViewport();
if (_game_mode == GM_MENU) { if (_game_mode == GM_MENU) {
int off_x = _screen.width / 2; int off_x = _screen.width / 2;

@ -83,7 +83,7 @@ public:
virtual void OnPaint() virtual void OnPaint()
{ {
DrawWindowWidgets(this); this->DrawWidgets();
DoDrawStringCentered(140, 16, this->landinfo_data[0], TC_LIGHT_BLUE); DoDrawStringCentered(140, 16, this->landinfo_data[0], TC_LIGHT_BLUE);
DoDrawStringCentered(140, 27, this->landinfo_data[1], TC_FROMSTRING); DoDrawStringCentered(140, 27, this->landinfo_data[1], TC_FROMSTRING);
@ -289,7 +289,7 @@ struct AboutWindow : public Window {
" Chris Sawyer - For an amazing game!" " Chris Sawyer - For an amazing game!"
}; };
DrawWindowWidgets(this); this->DrawWidgets();
/* Show original copyright and revision version */ /* Show original copyright and revision version */
DrawStringCentered(210, 17, STR_00B6_ORIGINAL_COPYRIGHT, TC_FROMSTRING); DrawStringCentered(210, 17, STR_00B6_ORIGINAL_COPYRIGHT, TC_FROMSTRING);
@ -371,7 +371,7 @@ public:
}; };
CopyInDParam(0, this->decode_params, lengthof(this->decode_params)); CopyInDParam(0, this->decode_params, lengthof(this->decode_params));
DrawWindowWidgets(this); this->DrawWidgets();
CopyInDParam(0, this->decode_params, lengthof(this->decode_params)); 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. /* 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() virtual void OnPaint()
{ {
SetDParam(0, this->caption); SetDParam(0, this->caption);
DrawWindowWidgets(this); this->DrawWidgets();
this->DrawEditBox(QUERY_STR_WIDGET_TEXT); this->DrawEditBox(QUERY_STR_WIDGET_TEXT);
} }
@ -1153,7 +1153,7 @@ struct QueryWindow : public Window {
virtual void OnPaint() virtual void OnPaint()
{ {
CopyInDParam(0, this->params, lengthof(this->params)); CopyInDParam(0, this->params, lengthof(this->params));
DrawWindowWidgets(this); this->DrawWidgets();
CopyInDParam(0, this->params, lengthof(this->params)); CopyInDParam(0, this->params, lengthof(this->params));
DrawStringMultiCenter(this->width / 2, (this->height / 2) - 10, this->message, this->width - 2); DrawStringMultiCenter(this->width / 2, (this->height / 2) - 10, this->message, this->width - 2);
@ -1419,7 +1419,7 @@ struct SaveLoadWindow : public QueryStringBaseWindow {
int y; int y;
SetVScrollCount(this, _fios_num); SetVScrollCount(this, _fios_num);
DrawWindowWidgets(this); this->DrawWidgets();
DrawFiosTexts(this->width); DrawFiosTexts(this->width);
if (_savegame_sort_dirty) { 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); 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; y = this->widget[7].top + 1;
for (pos = this->vscroll.pos; pos < _fios_num; pos++) { for (pos = this->vscroll.pos; pos < _fios_num; pos++) {

@ -204,7 +204,7 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e)
w->SetWidgetDisabledState(11, msf.playlist <= 3); w->SetWidgetDisabledState(11, msf.playlist <= 3);
w->LowerWidget(3); w->LowerWidget(3);
w->LowerWidget(4); w->LowerWidget(4);
DrawWindowWidgets(w); w->DrawWidgets();
GfxFillRect(3, 23, 3 + 177, 23 + 191, 0); GfxFillRect(3, 23, 3 + 177, 23 + 191, 0);
GfxFillRect(251, 23, 251 + 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(7);
w->RaiseWidget(9); w->RaiseWidget(9);
DrawWindowWidgets(w); w->DrawWidgets();
GfxFillRect(187, 16, 200, 33, 0); GfxFillRect(187, 16, 200, 33, 0);

@ -318,7 +318,7 @@ struct NetworkGameWindow : public QueryStringBaseWindow {
SetDParam(0, 0x00); SetDParam(0, 0x00);
SetDParam(1, _lan_internet_types_dropdown[_network_lan_internet]); SetDParam(1, _lan_internet_types_dropdown[_network_lan_internet]);
DrawWindowWidgets(this); this->DrawWidgets();
/* Edit box to set player name */ /* Edit box to set player name */
this->DrawEditBox(NGWW_PLAYER); this->DrawEditBox(NGWW_PLAYER);
@ -327,9 +327,9 @@ struct NetworkGameWindow : public QueryStringBaseWindow {
/* Sort based on widgets: name, clients, compatibility */ /* Sort based on widgets: name, clients, compatibility */
switch (this->servers.sort_type) { switch (this->servers.sort_type) {
case NGWW_NAME - NGWW_NAME: DrawSortButtonState(this, NGWW_NAME, arrow); break; case NGWW_NAME - NGWW_NAME: this->DrawSortButtonState(NGWW_NAME, arrow); break;
case NGWW_CLIENTS - NGWW_NAME: DrawSortButtonState(this, NGWW_CLIENTS, arrow); break; case NGWW_CLIENTS - NGWW_NAME: this->DrawSortButtonState(NGWW_CLIENTS, arrow); break;
case NGWW_INFO - NGWW_NAME: DrawSortButtonState(this, NGWW_INFO, arrow); break; case NGWW_INFO - NGWW_NAME: this->DrawSortButtonState(NGWW_INFO, arrow); break;
} }
uint16 y = NET_PRC__OFFSET_TOP_WIDGET + 3; uint16 y = NET_PRC__OFFSET_TOP_WIDGET + 3;
@ -727,7 +727,7 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow {
SetDParam(3, _network_game_info.companies_max); SetDParam(3, _network_game_info.companies_max);
SetDParam(4, _network_game_info.spectators_max); SetDParam(4, _network_game_info.spectators_max);
SetDParam(5, STR_NETWORK_LANG_ANY + _network_game_info.server_lang); SetDParam(5, STR_NETWORK_LANG_ANY + _network_game_info.server_lang);
DrawWindowWidgets(this); this->DrawWidgets();
/* editbox to set game name */ /* editbox to set game name */
this->DrawEditBox(NSSW_GAMENAME); this->DrawEditBox(NSSW_GAMENAME);
@ -1036,7 +1036,7 @@ struct NetworkLobbyWindow : public Window {
/* Draw window widgets */ /* Draw window widgets */
SetDParamStr(0, gi->server_name); SetDParamStr(0, gi->server_name);
DrawWindowWidgets(this); this->DrawWidgets();
/* Draw company list */ /* Draw company list */
pos = this->vscroll.pos; pos = this->vscroll.pos;
@ -1410,7 +1410,7 @@ struct NetworkClientListPopupWindow : Window {
virtual void OnPaint() virtual void OnPaint()
{ {
DrawWindowWidgets(this); this->DrawWidgets();
/* Draw the actions */ /* Draw the actions */
int sel = this->sel_index; int sel = this->sel_index;
@ -1514,7 +1514,7 @@ struct NetworkClientListWindow : Window
/* Check if we need to reset the height */ /* Check if we need to reset the height */
if (!this->CheckClientListHeight()) return; if (!this->CheckClientListHeight()) return;
DrawWindowWidgets(this); this->DrawWidgets();
int y = CLNWND_OFFSET; int y = CLNWND_OFFSET;
@ -1606,7 +1606,7 @@ struct NetworkJoinStatusWindow : Window {
virtual void OnPaint() virtual void OnPaint()
{ {
uint8 progress; // used for progress bar uint8 progress; // used for progress bar
DrawWindowWidgets(this); this->DrawWidgets();
DrawStringCentered(125, 35, STR_NETWORK_CONNECTING_1 + _network_join_status, TC_GREY); DrawStringCentered(125, 35, STR_NETWORK_CONNECTING_1 + _network_join_status, TC_GREY);
switch (_network_join_status) { switch (_network_join_status) {
@ -1851,7 +1851,7 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
STR_NETWORK_CHAT_CLIENT_CAPTION STR_NETWORK_CHAT_CLIENT_CAPTION
}; };
DrawWindowWidgets(this); this->DrawWidgets();
assert((uint)this->dtype < lengthof(chat_captions)); assert((uint)this->dtype < lengthof(chat_captions));
DrawStringRightAligned(this->widget[2].left - 2, this->widget[2].top + 1, chat_captions[this->dtype], TC_BLACK); 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() virtual void OnPaint()
{ {
DrawWindowWidgets(this); this->DrawWidgets();
this->DrawEditBox(4); this->DrawEditBox(4);
} }

@ -150,7 +150,7 @@ struct NewGRFAddWindow : public Window {
SetVScrollCount(this, n); SetVScrollCount(this, n);
this->SetWidgetDisabledState(ANGRFW_ADD, this->sel == NULL || this->sel->IsOpenTTDBaseGRF()); 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); 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); if (this->sel->IsOpenTTDBaseGRF()) this->DisableWidget(SNGRFS_REMOVE);
} }
DrawWindowWidgets(this); this->DrawWidgets();
/* Draw NewGRF list */ /* Draw NewGRF list */
int y = this->widget[SNGRFS_FILE_LIST].top; int y = this->widget[SNGRFS_FILE_LIST].top;

@ -182,7 +182,7 @@ struct NewsWindow : Window {
/* Back up transparency options to draw news view */ /* Back up transparency options to draw news view */
TransparencyOptionBits to_backup = _transparency_opt; TransparencyOptionBits to_backup = _transparency_opt;
_transparency_opt = 0; _transparency_opt = 0;
DrawWindowViewport(this); this->DrawViewport();
_transparency_opt = to_backup; _transparency_opt = to_backup;
/* Shade the viewport into gray, or color*/ /* Shade the viewport into gray, or color*/
@ -204,12 +204,12 @@ struct NewsWindow : Window {
break; break;
default: default:
DrawWindowWidgets(this); this->DrawWidgets();
if (!(this->ni->flags & NF_VIEWPORT)) { if (!(this->ni->flags & NF_VIEWPORT)) {
CopyInDParam(0, this->ni->params, lengthof(this->ni->params)); CopyInDParam(0, this->ni->params, lengthof(this->ni->params));
DrawStringMultiCenter(140, 38, this->ni->string_id, 276); DrawStringMultiCenter(140, 38, this->ni->string_id, 276);
} else { } else {
DrawWindowViewport(this); this->DrawViewport();
CopyInDParam(0, this->ni->params, lengthof(this->ni->params)); CopyInDParam(0, this->ni->params, lengthof(this->ni->params));
DrawStringMultiCenter(this->width / 2, this->height - 16, this->ni->string_id, this->width - 4); 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; int y = 19;
SetVScrollCount(w, _total_news); SetVScrollCount(w, _total_news);
DrawWindowWidgets(w); w->DrawWidgets();
if (_total_news == 0) break; if (_total_news == 0) break;
NewsID show = min(_total_news, w->vscroll.cap); NewsID show = min(_total_news, w->vscroll.cap);
@ -764,7 +764,7 @@ struct MessageOptionsWindow : Window {
if (_news_ticker_sound) this->LowerWidget(WIDGET_NEWSOPT_SOUNDTICKER); if (_news_ticker_sound) this->LowerWidget(WIDGET_NEWSOPT_SOUNDTICKER);
this->widget[WIDGET_NEWSOPT_DROP_SUMMARY].data = _message_opt[this->state]; this->widget[WIDGET_NEWSOPT_DROP_SUMMARY].data = _message_opt[this->state];
DrawWindowWidgets(this); this->DrawWidgets();
/* Draw the string of each setting on each button. */ /* Draw the string of each setting on each button. */
for (int i = 0, y = 26; i < NT_END; i++, y += 12) { for (int i = 0, y = 26; i < NT_END; i++, y += 12) {

@ -709,7 +709,7 @@ public:
} }
SetDParam(0, this->vehicle->index); SetDParam(0, this->vehicle->index);
DrawWindowWidgets(this); this->DrawWidgets();
int y = 15; int y = 15;

@ -98,7 +98,7 @@ struct OskWindow : public Window {
this->ChangeOskDiabledState(shift); this->ChangeOskDiabledState(shift);
SetDParam(0, this->caption); SetDParam(0, this->caption);
DrawWindowWidgets(this); this->DrawWidgets();
for (uint i = 0; i < OSK_KEYBOARD_ENTRIES; i++) { for (uint i = 0; i < OSK_KEYBOARD_ENTRIES; i++) {
DrawCharCentered(_keyboard[shift][i], DrawCharCentered(_keyboard[shift][i],

@ -193,7 +193,7 @@ struct PlayerFinancesWindow : Window {
SetDParam(0, p->index); SetDParam(0, p->index);
SetDParam(1, p->index); SetDParam(1, p->index);
SetDParam(2, LOAN_INTERVAL); SetDParam(2, LOAN_INTERVAL);
DrawWindowWidgets(this); this->DrawWidgets();
DrawPlayerEconomyStats(p, this->small); DrawPlayerEconomyStats(p, this->small);
} }
@ -398,7 +398,7 @@ public:
SetDParam(0, STR_00D1_DARK_BLUE + p->livery[scheme].colour1); SetDParam(0, STR_00D1_DARK_BLUE + p->livery[scheme].colour1);
SetDParam(1, STR_00D1_DARK_BLUE + p->livery[scheme].colour2); SetDParam(1, STR_00D1_DARK_BLUE + p->livery[scheme].colour2);
DrawWindowWidgets(this); this->DrawWidgets();
for (scheme = LS_DEFAULT; scheme < LS_END; scheme++) { for (scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
if (_livery_class[scheme] == this->livery_class) { 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); 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 */ /* Draw dynamic button value and labels for the advanced player face selection window */
if (this->advanced) { if (this->advanced) {
@ -1213,7 +1213,7 @@ struct PlayerCompanyWindow : Window
SetDParam(0, p->index); SetDParam(0, p->index);
SetDParam(1, p->index); SetDParam(1, p->index);
DrawWindowWidgets(this); this->DrawWidgets();
/* Player face */ /* Player face */
DrawPlayerFace(p->face, p->player_color, 2, 16); 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); Player *p = GetPlayer((PlayerID)w->window_number);
SetDParam(0, STR_COMPANY_NAME); SetDParam(0, STR_COMPANY_NAME);
SetDParam(1, p->index); SetDParam(1, p->index);
DrawWindowWidgets(w); w->DrawWidgets();
DrawPlayerFace(p->face, p->player_color, 2, 16); 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].right = this->width - 1;
this->widget[0].bottom = this->height - 1; this->widget[0].bottom = this->height - 1;
DrawWindowWidgets(this); this->DrawWidgets();
/* Center Highscore/Endscreen background */ /* Center Highscore/Endscreen background */
*x = max(0, (_screen.width / 2) - (640 / 2)); *x = max(0, (_screen.width / 2) - (640 / 2));

@ -567,7 +567,7 @@ static void BuildRailToolbWndProc(Window *w, WindowEvent *e)
switch (e->event) { switch (e->event) {
case WE_CREATE: w->DisableWidget(RTW_REMOVE); break; case WE_CREATE: w->DisableWidget(RTW_REMOVE); break;
case WE_PAINT: DrawWindowWidgets(w); break; case WE_PAINT: w->DrawWidgets(); break;
case WE_CLICK: case WE_CLICK:
if (e->we.click.widget >= RTW_BUILD_NS) { 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)); SetDParam(0, GetStationClassName(_railstation.station_class));
DrawWindowWidgets(w); w->DrawWidgets();
int y_offset = newstations ? 90 : 0; 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_DECREASE, _patches.drag_signals_density == 1);
w->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_INCREASE, _patches.drag_signals_density == 20); 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. */ /* 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 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_CREATE: w->LowerWidget(_build_depot_direction + BRDW_DEPOT_NE); break;
case WE_PAINT: { case WE_PAINT: {
DrawWindowWidgets(w); w->DrawWidgets();
DrawTrainDepotSprite(70, 17, DIAGDIR_NE, _cur_railtype); DrawTrainDepotSprite(70, 17, DIAGDIR_NE, _cur_railtype);
DrawTrainDepotSprite(70, 69, DIAGDIR_SE, _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); 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++) { for (i = 0; i < w->hscroll.cap; i++) {
if (w->hscroll.pos + i < w->hscroll.count) { if (w->hscroll.pos + i < w->hscroll.count) {

@ -468,7 +468,7 @@ static void BuildRoadToolbWndProc(Window *w, WindowEvent *e)
RTW_BUS_STATION, RTW_BUS_STATION,
RTW_TRUCK_STATION, RTW_TRUCK_STATION,
WIDGET_LIST_END); WIDGET_LIST_END);
DrawWindowWidgets(w); w->DrawWidgets();
break; break;
case WE_CLICK: case WE_CLICK:
@ -733,7 +733,7 @@ static void BuildRoadDepotWndProc(Window *w, WindowEvent *e)
break; break;
case WE_PAINT: case WE_PAINT:
DrawWindowWidgets(w); w->DrawWidgets();
DrawRoadDepotSprite(70, 17, DIAGDIR_NE, _cur_roadtype); DrawRoadDepotSprite(70, 17, DIAGDIR_NE, _cur_roadtype);
DrawRoadDepotSprite(70, 69, DIAGDIR_SE, _cur_roadtype); DrawRoadDepotSprite(70, 69, DIAGDIR_SE, _cur_roadtype);
@ -849,7 +849,7 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
break; break;
case WE_PAINT: { case WE_PAINT: {
DrawWindowWidgets(w); w->DrawWidgets();
if (_station_show_coverage) { if (_station_show_coverage) {
int rad = _patches.modified_catchment ? CA_TRUCK /* = CA_BUS */ : CA_UNMODIFIED; int rad = _patches.modified_catchment ? CA_TRUCK /* = CA_BUS */ : CA_UNMODIFIED;

@ -194,7 +194,7 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e)
SetDParam(8, SPECSTR_SCREENSHOT_START + _cur_screenshot_format); SetDParam(8, SPECSTR_SCREENSHOT_START + _cur_screenshot_format);
w->SetWidgetLoweredState(GAMEOPT_FULLSCREEN, _fullscreen); w->SetWidgetLoweredState(GAMEOPT_FULLSCREEN, _fullscreen);
DrawWindowWidgets(w); w->DrawWidgets();
DrawString(20, 175, STR_OPTIONS_FULLSCREEN, TC_FROMSTRING); // fullscreen DrawString(20, 175, STR_OPTIONS_FULLSCREEN, TC_FROMSTRING); // fullscreen
} break; } break;
@ -565,7 +565,7 @@ public:
virtual void OnPaint() virtual void OnPaint()
{ {
DrawWindowWidgets(this); this->DrawWidgets();
/* XXX - Disabled buttons in normal gameplay or during muliplayer as non server. /* 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 * 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; uint i;
/* Set up selected category */ /* Set up selected category */
DrawWindowWidgets(this); this->DrawWidgets();
x = 5; x = 5;
y = 47; y = 47;
@ -1159,7 +1159,7 @@ struct CustomCurrencyWindow : Window {
{ {
int x; int x;
int y = 20; int y = 20;
DrawWindowWidgets(this); this->DrawWidgets();
/* exchange rate */ /* exchange rate */
DrawArrowButtons(10, y, 3, GB(this->click, 0, 2), true, true); DrawArrowButtons(10, y, 3, GB(this->click, 0, 2), true, true);

@ -75,7 +75,7 @@ static void SignListWndProc(Window *w, WindowEvent *e)
SetVScrollCount(w, _num_sign_sort); SetVScrollCount(w, _num_sign_sort);
SetDParam(0, w->vscroll.count); SetDParam(0, w->vscroll.count);
DrawWindowWidgets(w); w->DrawWidgets();
/* No signs? */ /* No signs? */
int y = 16; // offset from top of widget int y = 16; // offset from top of widget
@ -197,7 +197,7 @@ struct SignWindow : QueryStringBaseWindow {
virtual void OnPaint() virtual void OnPaint()
{ {
SetDParam(0, this->caption); SetDParam(0, this->caption);
DrawWindowWidgets(this); this->DrawWidgets();
this->DrawEditBox(QUERY_EDIT_SIGN_WIDGET_TEXT); this->DrawEditBox(QUERY_EDIT_SIGN_WIDGET_TEXT);
} }

@ -847,7 +847,7 @@ public:
/* draw the window */ /* draw the window */
SetDParam(0, STR_00E5_CONTOURS + _smallmap_type); SetDParam(0, STR_00E5_CONTOURS + _smallmap_type);
DrawWindowWidgets(this); this->DrawWidgets();
tbl = _legend_table[_smallmap_type]; tbl = _legend_table[_smallmap_type];
@ -1153,8 +1153,8 @@ public:
/* set the number in the title bar */ /* set the number in the title bar */
SetDParam(0, this->window_number + 1); SetDParam(0, this->window_number + 1);
DrawWindowWidgets(this); this->DrawWidgets();
DrawWindowViewport(this); this->DrawViewport();
} }
virtual void OnClick(Point pt, int widget) virtual void OnClick(Point pt, int widget)

@ -369,10 +369,10 @@ struct PlayerStationsWindow : public Window, public GUIStationList
/* Set text of sort by dropdown */ /* Set text of sort by dropdown */
this->widget[SLW_SORTDROPBTN].data = _station_sort_listing[this->sort_type]; this->widget[SLW_SORTDROPBTN].data = _station_sort_listing[this->sort_type];
DrawWindowWidgets(this); this->DrawWidgets();
/* draw arrow pointing up/down for ascending/descending sorting */ /* 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 cg_ofst;
int x = 89; int x = 89;
@ -813,7 +813,7 @@ struct StationViewWindow : public Window {
SetDParam(0, st->index); SetDParam(0, st->index);
SetDParam(1, st->facilities); SetDParam(1, st->facilities);
DrawWindowWidgets(this); this->DrawWidgets();
int x = 2; ///< coordinates used for printing waiting/accepted/rating of cargo int x = 2; ///< coordinates used for printing waiting/accepted/rating of cargo
int y = 15; int y = 15;

@ -80,7 +80,7 @@ struct StatusBarWindow : Window {
{ {
const Player *p = (_local_player == PLAYER_SPECTATOR) ? NULL : GetPlayer(_local_player); const Player *p = (_local_player == PLAYER_SPECTATOR) ? NULL : GetPlayer(_local_player);
DrawWindowWidgets(this); this->DrawWidgets();
SetDParam(0, _date); SetDParam(0, _date);
DrawStringCentered(70, 1, (_pause_game || _patches.status_long_date) ? STR_00AF : STR_00AE, TC_FROMSTRING); DrawStringCentered(70, 1, (_pause_game || _patches.status_long_date) ? STR_00AF : STR_00AE, TC_FROMSTRING);

@ -96,7 +96,7 @@ static void DrawSubsidiesWindow(const Window *w)
int x; int x;
int y; int y;
DrawWindowWidgets(w); w->DrawWidgets();
ConvertDateToYMD(_date, &ymd); ConvertDateToYMD(_date, &ymd);

@ -236,7 +236,7 @@ static void TerraformToolbWndProc(Window *w, WindowEvent *e)
{ {
switch (e->event) { switch (e->event) {
case WE_PAINT: case WE_PAINT:
DrawWindowWidgets(w); w->DrawWidgets();
break; break;
case WE_CLICK: case WE_CLICK:
@ -578,7 +578,7 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e)
break; break;
case WE_PAINT: { case WE_PAINT: {
DrawWindowWidgets(w); w->DrawWidgets();
int n = _terraform_size * _terraform_size; int n = _terraform_size * _terraform_size;
const int8 *coords = &_multi_terraform_coords[0][0]; const int8 *coords = &_multi_terraform_coords[0][0];

@ -108,7 +108,7 @@ struct TimetableWindow : Window {
this->SetWidgetLoweredState(TTV_AUTOFILL, HasBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE)); this->SetWidgetLoweredState(TTV_AUTOFILL, HasBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE));
SetDParam(0, v->index); SetDParam(0, v->index);
DrawWindowWidgets(this); this->DrawWidgets();
int y = 15; int y = 15;
int i = this->vscroll.pos; int i = this->vscroll.pos;

@ -684,7 +684,7 @@ static void MainToolbarWndProc(Window *w, WindowEvent *e)
w->SetWidgetDisabledState(19, !CanBuildVehicleInfrastructure(VEH_TRAIN)); w->SetWidgetDisabledState(19, !CanBuildVehicleInfrastructure(VEH_TRAIN));
w->SetWidgetDisabledState(22, !CanBuildVehicleInfrastructure(VEH_AIRCRAFT)); w->SetWidgetDisabledState(22, !CanBuildVehicleInfrastructure(VEH_AIRCRAFT));
DrawWindowWidgets(w); w->DrawWidgets();
break; break;
case WE_CLICK: 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, 0xB2);
GfxFillRect(0, 0, w->width - 1, w->height - 1, 0xB4 | (1 << PALETTE_MODIFIER_GREYOUT)); 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)); SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1));
DrawStringCenteredTruncated(w->widget[6].right, w->widget[7].left, 6, STR_00AF, TC_FROMSTRING); DrawStringCenteredTruncated(w->widget[6].right, w->widget[7].left, 6, STR_00AF, TC_FROMSTRING);
@ -1146,7 +1146,7 @@ struct ToolbarMenuWindow : Window {
virtual void OnPaint() virtual void OnPaint()
{ {
DrawWindowWidgets(this); this->DrawWidgets();
for (int i = 0, x = 1, y = 1; i != this->item_count; i++, y += 10) { 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; 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() virtual void OnPaint()
{ {
this->UpdatePlayerMenuHeight(); this->UpdatePlayerMenuHeight();
DrawWindowWidgets(this); this->DrawWidgets();
int x = 1; int x = 1;
int y = 1; int y = 1;

@ -167,7 +167,7 @@ struct TownAuthorityWindow : Window {
this->SetWidgetDisabledState(6, this->sel_index == -1); this->SetWidgetDisabledState(6, this->sel_index == -1);
SetDParam(0, this->window_number); SetDParam(0, this->window_number);
DrawWindowWidgets(this); this->DrawWidgets();
DrawString(2, 15, STR_2023_TRANSPORT_COMPANY_RATINGS, TC_FROMSTRING); 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); w->SetWidgetDisabledState(TVW_CHANGENAME, _networking && !_network_server);
SetDParam(0, t->index); SetDParam(0, t->index);
DrawWindowWidgets(w); w->DrawWidgets();
SetDParam(0, t->population); SetDParam(0, t->population);
SetDParam(1, t->num_houses); SetDParam(1, t->num_houses);
@ -324,7 +324,7 @@ static void TownViewWndProc(Window *w, WindowEvent *e)
SetDParam(1, t->max_mail); SetDParam(1, t->max_mail);
DrawString(2, 127, STR_200E_MAIL_LAST_MONTH_MAX, TC_FROMSTRING); DrawString(2, 127, STR_200E_MAIL_LAST_MONTH_MAX, TC_FROMSTRING);
DrawWindowViewport(w); w->DrawViewport();
break; break;
case WE_CLICK: case WE_CLICK:
@ -489,8 +489,8 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e)
SetVScrollCount(w, _num_town_sort); SetVScrollCount(w, _num_town_sort);
DrawWindowWidgets(w); w->DrawWidgets();
DrawSortButtonState(w, (_town_sort_order <= 1) ? TDW_SORTNAME : TDW_SORTPOPULATION, _town_sort_order & 1 ? SBS_DOWN : SBS_UP); w->DrawSortButtonState((_town_sort_order <= 1) ? TDW_SORTNAME : TDW_SORTPOPULATION, _town_sort_order & 1 ? SBS_DOWN : SBS_UP);
{ {
int n = 0; int n = 0;
@ -626,7 +626,7 @@ static void ScenEditTownGenWndProc(Window *w, WindowEvent *e)
{ {
switch (e->event) { switch (e->event) {
case WE_PAINT: case WE_PAINT:
DrawWindowWidgets(w); w->DrawWidgets();
break; break;
case WE_CREATE: case WE_CREATE:

@ -49,7 +49,7 @@ public:
this->SetWidgetLoweredState(i, IsTransparencySet((TransparencyOption)(i - TTW_WIDGET_SIGNS))); this->SetWidgetLoweredState(i, IsTransparencySet((TransparencyOption)(i - TTW_WIDGET_SIGNS)));
} }
DrawWindowWidgets(this); this->DrawWidgets();
for (uint i = TO_SIGNS; i < TO_END; i++) { 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); 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);
} }

@ -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 } { 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 i = this->base = _tree_base_by_landscape[_opt.landscape];
int count = this->count = _tree_count_by_landscape[_opt.landscape]; int count = this->count = _tree_count_by_landscape[_opt.landscape];

@ -394,7 +394,7 @@ struct RefitWindow : public Window {
SetVScrollCount(this, this->list->num_lines); SetVScrollCount(this, this->list->num_lines);
SetDParam(0, v->index); 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); 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, VLW_WIDGET_START_ALL,
WIDGET_LIST_END); WIDGET_LIST_END);
DrawWindowWidgets(this); this->DrawWidgets();
/* draw sorting criteria string */ /* draw sorting criteria string */
DrawString(85, 15, _vehicle_sort_listing[this->vehicles.sort_type], TC_BLACK); DrawString(85, 15, _vehicle_sort_listing[this->vehicles.sort_type], TC_BLACK);
/* draw arrow pointing up/down for ascending/descending sorting */ /* 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); max = min(this->vscroll.pos + this->vscroll.cap, this->vehicles.list_length);
for (i = this->vscroll.pos; i < max; ++i) { for (i = this->vscroll.pos; i < max; ++i) {
@ -1508,7 +1508,7 @@ struct VehicleDetailsWindow : Window {
SetDParam(0, v->index); SetDParam(0, v->index);
DrawWindowWidgets(this); this->DrawWidgets();
/* Draw running cost */ /* Draw running cost */
SetDParam(1, v->age / 366); SetDParam(1, v->age / 366);
@ -1942,7 +1942,7 @@ static void DrawVehicleViewWindow(Window *w)
/* draw widgets & caption */ /* draw widgets & caption */
SetDParam(0, v->index); SetDParam(0, v->index);
DrawWindowWidgets(w); w->DrawWidgets();
if (v->vehstatus & VS_CRASHED) { if (v->vehstatus & VS_CRASHED) {
str = STR_8863_CRASHED; str = STR_8863_CRASHED;
@ -2021,7 +2021,7 @@ static void DrawVehicleViewWindow(Window *w)
/* draw the flag plus orders */ /* 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); 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); 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. */ /** Command indices for the _vehicle_command_translation_table. */

@ -1536,17 +1536,17 @@ static inline void ViewportDraw(const ViewPort *vp, int left, int top, int right
ViewportDrawChk(vp, left, top, right, bottom); ViewportDrawChk(vp, left, top, right, bottom);
} }
void DrawWindowViewport(const Window *w) void Window::DrawViewport() const
{ {
DrawPixelInfo *dpi = _cur_dpi; DrawPixelInfo *dpi = _cur_dpi;
dpi->left += w->left; dpi->left += this->left;
dpi->top += w->top; 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->left -= this->left;
dpi->top -= w->top; dpi->top -= this->top;
} }
static inline void ClampViewportToMap(const ViewPort *vp, int &x, int &y) static inline void ClampViewportToMap(const ViewPort *vp, int &x, int &y)

@ -190,20 +190,20 @@ void DrawFrameRect(int left, int top, int right, int bottom, int ctab, FrameFlag
* Paint all widgets of a window. * Paint all widgets of a window.
* @param w Window * @param w Window
*/ */
void DrawWindowWidgets(const Window *w) void Window::DrawWidgets() const
{ {
const DrawPixelInfo* dpi = _cur_dpi; const DrawPixelInfo* dpi = _cur_dpi;
for (uint i = 0; i < w->widget_count; i++) { for (uint i = 0; i < this->widget_count; i++) {
const Widget *wi = &w->widget[i]; const Widget *wi = &this->widget[i];
bool clicked = w->IsWidgetLowered(i); bool clicked = this->IsWidgetLowered(i);
Rect r; Rect r;
if (dpi->left > (r.right = wi->right) || if (dpi->left > (r.right = wi->right) ||
dpi->left + dpi->width <= (r.left = wi->left) || dpi->left + dpi->width <= (r.left = wi->left) ||
dpi->top > (r.bottom = wi->bottom) || dpi->top > (r.bottom = wi->bottom) ||
dpi->top + dpi->height <= (r.top = wi->top) || dpi->top + dpi->height <= (r.top = wi->top) ||
w->IsWidgetHidden(i)) { this->IsWidgetHidden(i)) {
continue; continue;
} }
@ -304,11 +304,11 @@ void DrawWindowWidgets(const Window *w)
assert(r.right - r.left == 11); // To ensure the same sizes are used everywhere! assert(r.right - r.left == 11); // To ensure the same sizes are used everywhere!
/* draw up/down buttons */ /* 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); 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); 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); 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); 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 + 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); GfxFillRect(r.left + 8, r.top + 10, r.left + 8, r.bottom - 10, c2);
Point pt = HandleScrollbarHittest(&w->vscroll, r.top, r.bottom); Point pt = HandleScrollbarHittest(&this->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); 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; break;
} }
@ -335,11 +335,11 @@ void DrawWindowWidgets(const Window *w)
assert(r.right - r.left == 11); // To ensure the same sizes are used everywhere! assert(r.right - r.left == 11); // To ensure the same sizes are used everywhere!
/* draw up/down buttons */ /* 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); 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); 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); 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); 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 + 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); GfxFillRect(r.left + 8, r.top + 10, r.left + 8, r.bottom - 10, c2);
Point pt = HandleScrollbarHittest(&w->vscroll2, r.top, r.bottom); Point pt = HandleScrollbarHittest(&this->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); 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; break;
} }
@ -366,11 +366,11 @@ void DrawWindowWidgets(const Window *w)
assert(wi->data == 0); assert(wi->data == 0);
assert(r.bottom - r.top == 11); // To ensure the same sizes are used everywhere! 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); 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); 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); 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); 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); GfxFillRect(r.left + 10, r.top + 8, r.right - 10, r.top + 8, c2);
/* draw actual scrollbar */ /* draw actual scrollbar */
Point pt = HandleScrollbarHittest(&w->hscroll, r.left, r.right); Point pt = HandleScrollbarHittest(&this->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); 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; break;
} }
@ -429,7 +429,7 @@ void DrawWindowWidgets(const Window *w)
assert(wi->data == 0); assert(wi->data == 0);
assert(r.right - r.left == 11); // To ensure the same sizes are used everywhere! 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); 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); DrawSprite((clicked) ? SPR_PIN_UP : SPR_PIN_DOWN, PAL_NONE, r.left + 2 + clicked, r.top + 3 + clicked);
break; break;
@ -438,7 +438,7 @@ void DrawWindowWidgets(const Window *w)
assert(wi->data == 0); assert(wi->data == 0);
assert(r.right - r.left == 11); // To ensure the same sizes are used everywhere! 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); 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); DrawSprite(SPR_WINDOW_RESIZE, PAL_NONE, r.left + 3 + clicked, r.top + 3 + clicked);
break; break;
@ -457,10 +457,10 @@ void DrawWindowWidgets(const Window *w)
case WWT_CAPTION: case WWT_CAPTION:
assert(r.bottom - r.top == 13); // To ensure the same sizes are used everywhere! 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, 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) { if (this->caption_color != 0xFF) {
GfxFillRect(r.left + 2, r.top + 2, r.right - 2, r.bottom - 2, _colour_gradient[_player_colors[w->caption_color]][4]); 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); 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)); 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) { if (this->flags4 & WF_WHITE_BORDER_MASK) {
DrawFrameRect(0, 0, w->width - 1, w->height - 1, 0xF, FR_BORDERONLY); 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 widget Sort button widget
* @param state State of sort button * @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; if (state == SBS_OFF) return;
int offset = w->IsWidgetLowered(widget) ? 1 : 0; int offset = this->IsWidgetLowered(widget) ? 1 : 0;
DoDrawString(state == SBS_DOWN ? DOWNARROW : UPARROW, w->widget[widget].right - 11 + offset, w->widget[widget].top + 1 + offset, TC_BLACK); DoDrawString(state == SBS_DOWN ? DOWNARROW : UPARROW, this->widget[widget].right - 11 + offset, this->widget[widget].top + 1 + offset, TC_BLACK);
} }

@ -118,7 +118,7 @@ struct DropdownWindow : Window {
virtual void OnPaint() virtual void OnPaint()
{ {
DrawWindowWidgets(this); this->DrawWidgets();
int x = 1; int x = 1;
int y = 2; int y = 2;

@ -245,6 +245,12 @@ struct ResizeInfo {
uint step_height; ///< Step-size of height resize changes uint step_height; ///< Step-size of height resize changes
}; };
enum SortButtonState {
SBS_OFF,
SBS_DOWN,
SBS_UP,
};
/** /**
* Data structure for a window viewport * Data structure for a window viewport
*/ */
@ -322,6 +328,10 @@ public:
void CDECL SetWidgetsLoweredState(bool lowered_stat, int widgets, ...); void CDECL SetWidgetsLoweredState(bool lowered_stat, int widgets, ...);
void InvalidateWidget(byte widget_index) const; void InvalidateWidget(byte widget_index) const;
void DrawWidgets() const;
void DrawViewport() const;
void DrawSortButtonState(int widget, SortButtonState state) const;
void SetDirty() const; void SetDirty() const;
/*** Event handling ***/ /*** Event handling ***/
@ -612,8 +622,6 @@ Wcls *AllocateWindowDescFront(const WindowDesc *desc, int window_number)
return new Wcls(desc, window_number); return new Wcls(desc, window_number);
} }
void DrawWindowViewport(const Window *w);
void RelocateAllWindows(int neww, int newh); void RelocateAllWindows(int neww, int newh);
/* misc_gui.cpp */ /* misc_gui.cpp */
@ -625,17 +633,6 @@ static inline void GuiShowTooltips(StringID str)
/* widget.cpp */ /* widget.cpp */
int GetWidgetFromPos(const Window *w, int x, int y); 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 */ /* window.cpp */
extern Window *_z_windows[]; extern Window *_z_windows[];

Loading…
Cancel
Save