(svn r21331) -Codechange: Make drawing the widgets default behaviour in OnPaint().

This commit is contained in:
alberth 2010-11-26 15:22:18 +00:00
parent 61637f493a
commit f5c6fd1a25
34 changed files with 4 additions and 274 deletions

View File

@ -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) {

View File

@ -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;

View File

@ -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) {

View File

@ -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);

View File

@ -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) {

View File

@ -146,11 +146,6 @@ struct SetDateWindow : Window {
}
}
virtual void OnPaint()
{
this->DrawWidgets();
}
virtual void OnClick(Point pt, int widget, int click_count)
{
switch (widget) {

View File

@ -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;

View File

@ -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;

View File

@ -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) {

View File

@ -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 */

View File

@ -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);

View File

@ -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);

View File

@ -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) {

View File

@ -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++) {

View File

@ -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;

View File

@ -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;

View File

@ -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) {

View File

@ -217,11 +217,6 @@ struct NewGRFParametersWindow : public Window {
}
}
virtual void OnPaint()
{
this->DrawWidgets();
}
virtual void SetStringParameters(int widget) const
{
switch (widget) {

View File

@ -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) {

View File

@ -205,11 +205,6 @@ public:
}
}
virtual void OnPaint()
{
this->DrawWidgets();
}
void SelectOtherObject(int object_index)
{
_selected_object_index = object_index;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -1130,11 +1130,6 @@ public:
}
}
virtual void OnPaint()
{
this->DrawWidgets();
}
/**
* Select a new map type.
* @param map_type New map type.

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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());

View File

@ -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) {

View File

@ -97,11 +97,6 @@ public:
}
}
virtual void OnPaint()
{
this->DrawWidgets();
}
virtual void OnClick(Point pt, int widget, int click_count)
{
switch (widget) {

View File

@ -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) {

View File

@ -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;

View File

@ -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.