diff options
author | alberth <alberth@openttd.org> | 2010-11-26 15:22:18 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2010-11-26 15:22:18 +0000 |
commit | f5c6fd1a2582be29c9a5376ccb638781fbf355f7 (patch) | |
tree | 8409730a69d50fb7fca3002c94102bb37e7c14b1 /src | |
parent | 61637f493afd89ebab58ae6282b80fe326db33af (diff) | |
download | openttd-f5c6fd1a2582be29c9a5376ccb638781fbf355f7.tar.xz |
(svn r21331) -Codechange: Make drawing the widgets default behaviour in OnPaint().
Diffstat (limited to 'src')
34 files changed, 4 insertions, 274 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index bf1357e71..850a0f28c 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -88,11 +88,6 @@ struct AIListWindow : public Window { } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { @@ -284,11 +279,6 @@ struct AISettingsWindow : public Window { } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void DrawWidget(const Rect &r, int widget) const { if (widget != AIS_WIDGET_BACKGROUND) return; @@ -581,11 +571,6 @@ struct AIConfigWindow : public Window { } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index c518a63b7..a59cd4b1b 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -94,11 +94,6 @@ struct BuildAirToolbarWindow : Window { if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false); } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnClick(Point pt, int widget, int click_count) { if (!IsInsideBS(widget, ATW_AIRPORT, lengthof(_build_air_button_proc))) return; diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index 7c636928f..efe1d1636 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -160,11 +160,6 @@ public: delete bridges; } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp index f9715da85..11aea4fdd 100644 --- a/src/cheat_gui.cpp +++ b/src/cheat_gui.cpp @@ -270,11 +270,6 @@ struct CheatWindow : Window { size->height = this->header_height + WD_FRAMERECT_TOP + WD_PAR_VSEP_NORMAL + WD_FRAMERECT_BOTTOM + (FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL) * lengthof(_cheats_ui); } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnClick(Point pt, int widget, int click_count) { const NWidgetBase *wid = this->GetWidget<NWidgetBase>(CW_PANEL); diff --git a/src/company_gui.cpp b/src/company_gui.cpp index ff1012777..56d6e94a9 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -2084,11 +2084,6 @@ struct BuyCompanyWindow : Window { this->InitNested(desc, window_number); } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { diff --git a/src/date_gui.cpp b/src/date_gui.cpp index 22fbc2085..85e9fcb7a 100644 --- a/src/date_gui.cpp +++ b/src/date_gui.cpp @@ -146,11 +146,6 @@ struct SetDateWindow : Window { } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index a89312815..a0c676a05 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -225,11 +225,6 @@ struct BuildDocksToolbarWindow : Window { WIDGET_LIST_END); } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnClick(Point pt, int widget, int click_count) { this->last_clicked_widget = (DockToolbarWidgets)widget; diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp index b2bed8cff..3fd30efd7 100644 --- a/src/engine_gui.cpp +++ b/src/engine_gui.cpp @@ -72,11 +72,6 @@ struct EnginePreviewWindow : Window { this->InitNested(desc, window_number); } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { if (widget != EPW_QUESTION) return; diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index f28306c2a..c16742fa3 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -1239,11 +1239,6 @@ struct GenerateProgressWindow : public Window { } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index f646bb318..e5389a51a 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -61,11 +61,6 @@ struct GraphLegendWindow : Window { } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void DrawWidget(const Rect &r, int widget) const { if (!IsInsideMM(widget, GLW_FIRST_COMPANY, MAX_COMPANIES + GLW_FIRST_COMPANY)) return; @@ -490,11 +485,6 @@ protected: } public: - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { if (widget != this->graph_widget) return; @@ -1394,12 +1384,6 @@ struct PerformanceRatingDetailWindow : Window { } } - virtual void OnPaint() - { - /* Draw standard stuff */ - this->DrawWidgets(); - } - virtual void DrawWidget(const Rect &r, int widget) const { /* No need to draw when there's nothing to draw */ diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index b574cee06..4f9aecaec 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -470,11 +470,6 @@ public: } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { @@ -1234,11 +1229,6 @@ public: if (widget == IDW_DROPDOWN_CRITERIA) SetDParam(0, IndustryDirectoryWindow::sorter_names[this->industries.SortType()]); } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { @@ -2585,11 +2575,6 @@ struct IndustryCargoesWindow : public Window { } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnResize() { this->vscroll->SetCapacityFromWidget(this, ICW_PANEL); diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp index 9c0b6ce54..abd35de76 100644 --- a/src/intro_gui.cpp +++ b/src/intro_gui.cpp @@ -65,11 +65,6 @@ struct SelectGameWindow : public Window { this->SetWidgetLoweredState(SGI_TOYLAND_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TOYLAND); } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void SetStringParameters(int widget) const { if (widget == SGI_DIFFICULTIES) SetDParam(0, STR_DIFFICULTY_LEVEL_EASY + _settings_newgame.difficulty.diff_level); diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 4316adc7d..8721d8e80 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -79,11 +79,6 @@ public: char landinfo_data[LAND_INFO_LINE_END][LAND_INFO_LINE_BUFF_SIZE]; TileIndex tile; - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void DrawWidget(const Rect &r, int widget) const { if (widget != LIW_BACKGROUND) return; @@ -473,11 +468,6 @@ struct AboutWindow : public Window { *size = maxdim(*size, d); } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void DrawWidget(const Rect &r, int widget) const { if (widget != AW_SCROLLING_TEXT) return; @@ -641,11 +631,6 @@ public: return pt; } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnInvalidateData(int data) { /* If company gets shut down, while displaying an error about it, remove the error message. */ @@ -896,12 +881,6 @@ struct TooltipsWindow : public Window DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, r.bottom - WD_FRAMERECT_BOTTOM, this->string_id, TC_FROMSTRING, SA_CENTER); } - - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnMouseLoop() { /* Always close tooltips when the cursor is not in our window. */ @@ -1520,11 +1499,6 @@ struct QueryWindow : public Window { DrawStringMultiLine(r.left, r.right, r.top, r.bottom, this->message, TC_FROMSTRING, SA_CENTER); } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { diff --git a/src/music_gui.cpp b/src/music_gui.cpp index 740744e3e..9f2e49f58 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -396,11 +396,6 @@ struct MusicTrackSelectionWindow : public Window { } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { @@ -642,11 +637,6 @@ struct MusicWindow : public Window { } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnInvalidateData(int data = 0) { for (int i = 0; i < 6; i++) { diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index 8e5214ebc..44b37cc4a 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -138,11 +138,6 @@ public: _network_content_client.RemoveCallback(this); } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void DrawWidget(const Rect &r, int widget) const { if (widget != NCDSWW_BACKGROUND) return; diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 6db9f5d1b..6b1c15da7 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -1937,11 +1937,6 @@ struct NetworkClientListPopupWindow : Window { } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnMouseLoop() { /* We selected an action */ @@ -2163,11 +2158,6 @@ struct NetworkJoinStatusWindow : Window { this->InitNested(desc, 0); } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void DrawWidget(const Rect &r, int widget) const { if (widget != NJSW_BACKGROUND) return; diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index 8b2b4bf96..8504094ad 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -416,11 +416,6 @@ struct NewGRFInspectWindow : Window { const_cast<NewGRFInspectWindow*>(this)->vscroll->SetCount(i); } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { @@ -657,11 +652,6 @@ struct SpriteAlignerWindow : Window { } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 864b2a600..343c30df9 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -217,11 +217,6 @@ struct NewGRFParametersWindow : public Window { } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void SetStringParameters(int widget) const { switch (widget) { diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 03033beae..e848f3dd5 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -348,11 +348,6 @@ struct NewsWindow : Window { return pt; } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { StringID str = STR_NULL; @@ -1136,11 +1131,6 @@ struct MessageOptionsWindow : Window { this->SetWidgetDisabledState(element + WIDGET_NEWSOPT_START_OPTION + 2, value == 2); } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void DrawWidget(const Rect &r, int widget) const { if (widget >= WIDGET_NEWSOPT_START_OPTION && widget < WIDGET_NEWSOPT_END_OPTION && (widget - WIDGET_NEWSOPT_START_OPTION) % MOS_WIDG_PER_SETTING == 1) { diff --git a/src/object_gui.cpp b/src/object_gui.cpp index f54492caf..a56fc051f 100644 --- a/src/object_gui.cpp +++ b/src/object_gui.cpp @@ -205,11 +205,6 @@ public: } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - void SelectOtherObject(int object_index) { _selected_object_index = object_index; diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 78301c0e2..b76067a41 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -717,11 +717,6 @@ struct BuildRailToolbarWindow : Window { } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnClick(Point pt, int widget, int click_count) { if (widget >= RTW_BUILD_NS) { @@ -1544,11 +1539,6 @@ public: } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void DrawWidget(const Rect &r, int widget) const { if (IsInsideMM(widget, BSW_SEMAPHORE_NORM, BSW_ELECTRIC_PBS_OWAY + 1)) { @@ -1689,11 +1679,6 @@ struct BuildRailDepotWindow : public PickerWindowBase { this->LowerWidget(_build_depot_direction + BRDW_DEPOT_NE); } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void DrawWidget(const Rect &r, int widget) const { if (!IsInsideMM(widget, BRDW_DEPOT_NE, BRDW_DEPOT_NW + 1)) return; diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 71a568fca..1902123a9 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -527,11 +527,6 @@ struct BuildRoadToolbarWindow : Window { } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnClick(Point pt, int widget, int click_count) { if (widget >= RTW_ROAD_X) { @@ -880,11 +875,6 @@ struct BuildRoadDepotWindow : public PickerWindowBase { this->FinishInitNested(desc, TRANSPORT_ROAD); } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void DrawWidget(const Rect &r, int widget) const { if (!IsInsideMM(widget, BRDW_DEPOT_NE, BRDW_DEPOT_NW + 1)) return; diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 8d58d5246..c0f75b9c5 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -202,11 +202,6 @@ struct GameOptionsWindow : Window { } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { @@ -627,11 +622,6 @@ public: } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnClick(Point pt, int widget, int click_count) { if (widget >= GDW_OPTIONS_START) { @@ -1555,11 +1545,6 @@ struct GameSettingsWindow : Window { this->vscroll->GetPosition(), this->vscroll->GetPosition() + this->vscroll->GetCapacity()); } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnClick(Point pt, int widget, int click_count) { if (widget != SETTINGSEL_OPTIONSPANEL) return; @@ -1840,11 +1825,6 @@ struct CustomCurrencyWindow : Window { } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnClick(Point pt, int widget, int click_count) { int line = 0; diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index 6d7184b3e..e63c3cc10 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -1130,11 +1130,6 @@ public: } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - /** * Select a new map type. * @param map_type New map type. diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 41194e4b4..12a103ee3 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -1393,11 +1393,6 @@ struct SelectStationWindow : Window { *size = d; } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void DrawWidget(const Rect &r, int widget) const { if (widget != JSW_PANEL) return; diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp index 80efb1805..11feeaec0 100644 --- a/src/statusbar_gui.cpp +++ b/src/statusbar_gui.cpp @@ -104,11 +104,6 @@ struct StatusBarWindow : Window { return pt; } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { Dimension d; diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp index d6fed1c3e..0b9182fdd 100644 --- a/src/subsidy_gui.cpp +++ b/src/subsidy_gui.cpp @@ -106,11 +106,6 @@ struct SubsidyListWindow : Window { } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - /** * Count the number of lines in this window. * @return the number of lines diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 349e539ba..5f4d15a44 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -245,12 +245,6 @@ struct TerraformToolbarWindow : Window { show_object->SetDisplayedPlane(ObjectClass::GetCount() != 0 ? 0 : SZSP_NONE); } - - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnClick(Point pt, int widget, int click_count) { if (widget >= TTW_BUTTONS_START) _terraform_button_proc[widget - TTW_BUTTONS_START](this); diff --git a/src/town_gui.cpp b/src/town_gui.cpp index c3bf70312..7da0528a1 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -338,11 +338,6 @@ public: this->SetWidgetDisabledState(TVW_CHANGENAME, _networking && !_network_server); } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void SetStringParameters(int widget) const { if (widget == TVW_CAPTION) SetDParam(0, this->town->index); @@ -734,11 +729,6 @@ public: this->last_sorting = this->towns.GetListing(); } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void SetStringParameters(int widget) const { if (widget == TDW_BOTTOM_TEXT) SetDParam(0, GetWorldPopulation()); diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 4ba023809..46a4f1b8f 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -513,11 +513,6 @@ struct RefitWindow : public Window { } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { diff --git a/src/viewport_gui.cpp b/src/viewport_gui.cpp index 9d74a3369..ef831af39 100644 --- a/src/viewport_gui.cpp +++ b/src/viewport_gui.cpp @@ -97,11 +97,6 @@ public: } } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp index 070e4eea7..b766a81f2 100644 --- a/src/waypoint_gui.cpp +++ b/src/waypoint_gui.cpp @@ -88,11 +88,6 @@ public: if (widget == WAYPVW_CAPTION) SetDParam(0, this->wp->index); } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index 80b06e6f5..67dca1cd4 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -219,11 +219,6 @@ struct DropdownWindow : Window { return false; } - virtual void OnPaint() - { - this->DrawWidgets(); - } - virtual void DrawWidget(const Rect &r, int widget) const { if (widget != DDM_ITEMS) return; diff --git a/src/window_gui.h b/src/window_gui.h index d6ef9a055..b69f01294 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -460,7 +460,10 @@ public: * The window must be repainted. * @note This method should not change any state, it should only use drawing functions. */ - virtual void OnPaint() {} + virtual void OnPaint() + { + this->DrawWidgets(); + } /** * Draw the contents of a nested widget. |