Codechange: Use override specifier in Window-derived classes.

This commit is contained in:
peter1138
2019-03-04 07:49:37 +00:00
committed by Michael Lutz
parent aafce47596
commit 317f69c152
54 changed files with 765 additions and 765 deletions

View File

@@ -1997,12 +1997,12 @@ struct MainToolbarWindow : Window {
this->timer.SetInterval(MILLISECONDS_PER_TICK);
}
virtual void FindWindowPlacementAndResize(int def_width, int def_height)
void FindWindowPlacementAndResize(int def_width, int def_height) override
{
Window::FindWindowPlacementAndResize(_toolbar_width, def_height);
}
virtual void OnPaint()
void OnPaint() override
{
/* If spectator, disable all construction buttons
* ie : Build road, rail, ships, airports and landscaping
@@ -2020,18 +2020,18 @@ struct MainToolbarWindow : Window {
this->DrawWidgets();
}
virtual void OnClick(Point pt, int widget, int click_count)
void OnClick(Point pt, int widget, int click_count) override
{
if (_game_mode != GM_MENU && !this->IsWidgetDisabled(widget)) _toolbar_button_procs[widget](this);
}
virtual void OnDropdownSelect(int widget, int index)
void OnDropdownSelect(int widget, int index) override
{
CallBackFunction cbf = _menu_clicked_procs[widget](index);
if (cbf != CBF_NONE) _last_started_action = cbf;
}
virtual EventState OnHotkey(int hotkey)
EventState OnHotkey(int hotkey) override
{
switch (hotkey) {
case MTHK_PAUSE: ToolbarPauseClick(this); break;
@@ -2077,7 +2077,7 @@ struct MainToolbarWindow : Window {
return ES_HANDLED;
}
virtual void OnPlaceObject(Point pt, TileIndex tile)
void OnPlaceObject(Point pt, TileIndex tile) override
{
switch (_last_started_action) {
case CBF_PLACE_SIGN:
@@ -2092,12 +2092,12 @@ struct MainToolbarWindow : Window {
}
}
virtual void OnPlaceObjectAbort()
void OnPlaceObjectAbort() override
{
_last_started_action = CBF_NONE;
}
virtual void OnRealtimeTick(uint delta_ms)
void OnRealtimeTick(uint delta_ms) override
{
if (!this->timer.Elapsed(delta_ms)) return;
this->timer.SetInterval(MILLISECONDS_PER_TICK);
@@ -2113,7 +2113,7 @@ struct MainToolbarWindow : Window {
}
}
virtual void OnTimeout()
void OnTimeout() override
{
/* We do not want to automatically raise the pause, fast forward and
* switchbar buttons; they have to stay down when pressed etc. */
@@ -2130,7 +2130,7 @@ struct MainToolbarWindow : Window {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
void OnInvalidateData(int data = 0, bool gui_scope = true) override
{
if (!gui_scope) return;
if (FindWindowById(WC_MAIN_WINDOW, 0) != NULL) HandleZoomMessage(this, FindWindowById(WC_MAIN_WINDOW, 0)->viewport, WID_TN_ZOOM_IN, WID_TN_ZOOM_OUT);
@@ -2330,12 +2330,12 @@ struct ScenarioEditorToolbarWindow : Window {
this->timer.SetInterval(MILLISECONDS_PER_TICK);
}
virtual void FindWindowPlacementAndResize(int def_width, int def_height)
void FindWindowPlacementAndResize(int def_width, int def_height) override
{
Window::FindWindowPlacementAndResize(_toolbar_width, def_height);
}
virtual void OnPaint()
void OnPaint() override
{
this->SetWidgetDisabledState(WID_TE_DATE_BACKWARD, _settings_game.game_creation.starting_year <= MIN_YEAR);
this->SetWidgetDisabledState(WID_TE_DATE_FORWARD, _settings_game.game_creation.starting_year >= MAX_YEAR);
@@ -2343,7 +2343,7 @@ struct ScenarioEditorToolbarWindow : Window {
this->DrawWidgets();
}
virtual void DrawWidget(const Rect &r, int widget) const
void DrawWidget(const Rect &r, int widget) const override
{
switch (widget) {
case WID_TE_DATE:
@@ -2364,7 +2364,7 @@ struct ScenarioEditorToolbarWindow : Window {
}
}
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
{
switch (widget) {
case WID_TE_SPACER:
@@ -2379,14 +2379,14 @@ struct ScenarioEditorToolbarWindow : Window {
}
}
virtual void OnClick(Point pt, int widget, int click_count)
void OnClick(Point pt, int widget, int click_count) override
{
if (_game_mode == GM_MENU) return;
CallBackFunction cbf = _scen_toolbar_button_procs[widget](this);
if (cbf != CBF_NONE) _last_started_action = cbf;
}
virtual void OnDropdownSelect(int widget, int index)
void OnDropdownSelect(int widget, int index) override
{
/* The map button is in a different location on the scenario
* editor toolbar, so we need to adjust for it. */
@@ -2396,7 +2396,7 @@ struct ScenarioEditorToolbarWindow : Window {
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
}
virtual EventState OnHotkey(int hotkey)
EventState OnHotkey(int hotkey) override
{
CallBackFunction cbf = CBF_NONE;
switch (hotkey) {
@@ -2428,7 +2428,7 @@ struct ScenarioEditorToolbarWindow : Window {
return ES_HANDLED;
}
virtual void OnPlaceObject(Point pt, TileIndex tile)
void OnPlaceObject(Point pt, TileIndex tile) override
{
switch (_last_started_action) {
case CBF_PLACE_SIGN:
@@ -2443,19 +2443,19 @@ struct ScenarioEditorToolbarWindow : Window {
}
}
virtual void OnPlaceObjectAbort()
void OnPlaceObjectAbort() override
{
_last_started_action = CBF_NONE;
}
virtual void OnTimeout()
void OnTimeout() override
{
this->SetWidgetsLoweredState(false, WID_TE_DATE_BACKWARD, WID_TE_DATE_FORWARD, WIDGET_LIST_END);
this->SetWidgetDirty(WID_TE_DATE_BACKWARD);
this->SetWidgetDirty(WID_TE_DATE_FORWARD);
}
virtual void OnRealtimeTick(uint delta_ms)
void OnRealtimeTick(uint delta_ms) override
{
if (!this->timer.Elapsed(delta_ms)) return;
this->timer.SetInterval(MILLISECONDS_PER_TICK);
@@ -2476,13 +2476,13 @@ struct ScenarioEditorToolbarWindow : Window {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
void OnInvalidateData(int data = 0, bool gui_scope = true) override
{
if (!gui_scope) return;
if (FindWindowById(WC_MAIN_WINDOW, 0) != NULL) HandleZoomMessage(this, FindWindowById(WC_MAIN_WINDOW, 0)->viewport, WID_TE_ZOOM_IN, WID_TE_ZOOM_OUT);
}
virtual void OnQueryTextFinished(char *str)
void OnQueryTextFinished(char *str) override
{
/* Was 'cancel' pressed? */
if (str == NULL) return;