Changeset - r14399:3f819c0da60a
src/ai/ai_gui.cpp
Show inline comments
 
@@ -149,7 +149,7 @@ struct AIListWindow : public Window {
 
		SetWindowDirty(WC_GAME_OPTIONS, 0);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case AIL_WIDGET_LIST: { // Select one of the AIs
 
@@ -157,6 +157,10 @@ struct AIListWindow : public Window {
 
				if (sel < (int)this->ai_info_list->size()) {
 
					this->selected = sel;
 
					this->SetDirty();
 
					if (click_count > 1) {
 
						this->ChangeAI();
 
						delete this;
 
					}
 
				}
 
				break;
 
			}
 
@@ -173,21 +177,6 @@ struct AIListWindow : public Window {
 
		}
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget)
 
	{
 
		switch (widget) {
 
			case AIL_WIDGET_LIST: {
 
				int sel = (pt.y - this->GetWidget<NWidgetBase>(AIL_WIDGET_LIST)->pos_y) / this->line_height + this->vscroll.GetPosition() - 1;
 
				if (sel < (int)this->ai_info_list->size()) {
 
					this->selected = sel;
 
					this->ChangeAI();
 
					delete this;
 
				}
 
				break;
 
			}
 
		}
 
	}
 

	
 
	virtual void OnResize()
 
	{
 
		NWidgetCore *nwi = this->GetWidget<NWidgetCore>(AIL_WIDGET_LIST);
 
@@ -332,7 +321,7 @@ struct AISettingsWindow : public Window 
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case AIS_WIDGET_BACKGROUND: {
 
@@ -588,7 +577,7 @@ struct AIConfigWindow : public Window {
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case AIC_WIDGET_DECREASE:
 
@@ -607,6 +596,7 @@ struct AIConfigWindow : public Window {
 
			case AIC_WIDGET_LIST: { // Select a slot
 
				this->selected_slot = (CompanyID)((pt.y - this->GetWidget<NWidgetBase>(widget)->pos_y) / this->line_height + this->vscroll.GetPosition());
 
				this->InvalidateData();
 
				if (click_count > 1 && this->selected_slot != INVALID_COMPANY) ShowAIListWindow((CompanyID)this->selected_slot);
 
				break;
 
			}
 

	
 
@@ -652,16 +642,6 @@ struct AIConfigWindow : public Window {
 
		}
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget)
 
	{
 
		switch (widget) {
 
			case AIC_WIDGET_LIST:
 
				this->OnClick(pt, widget);
 
				if (this->selected_slot != INVALID_COMPANY) ShowAIListWindow((CompanyID)this->selected_slot);
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	{
 
		if (this->selected_slot == 0 || this->selected_slot > _settings_newgame.difficulty.max_no_competitors) {
 
@@ -911,7 +891,7 @@ struct AIDebugWindow : public Window {
 
		DeleteWindowByClass(WC_AI_SETTINGS);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		/* Check which button is clicked */
 
		if (IsInsideMM(widget, AID_WIDGET_COMPANY_BUTTON_START, AID_WIDGET_COMPANY_BUTTON_END + 1)) {
src/airport_gui.cpp
Show inline comments
 
@@ -90,7 +90,7 @@ struct BuildAirToolbarWindow : Window {
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (!IsInsideBS(widget, ATW_AIRPORT, lengthof(_build_air_button_proc))) return;
 

	
 
@@ -257,7 +257,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BAW_SMALL_AIRPORT: case BAW_CITY_AIRPORT: case BAW_HELIPORT: case BAW_METRO_AIRPORT:
src/autoreplace_gui.cpp
Show inline comments
 
@@ -399,7 +399,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case RVW_WIDGET_TRAIN_ENGINEWAGON_TOGGLE:
src/bridge_gui.cpp
Show inline comments
 
@@ -243,7 +243,7 @@ public:
 
		return ES_NOT_HANDLED;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			default: break;
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -1002,7 +1002,7 @@ struct BuildVehicleWindow : Window {
 
		this->eng_list.RebuildDone();
 
	}
 

	
 
	void OnClick(Point pt, int widget)
 
	void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING:
 
@@ -1017,6 +1017,7 @@ struct BuildVehicleWindow : Window {
 
				size_t num_items = this->eng_list.Length();
 
				this->sel_engine = (i < num_items) ? this->eng_list[i] : INVALID_ENGINE;
 
				this->SetDirty();
 
				if (click_count > 1) this->OnClick(pt, BUILD_VEHICLE_WIDGET_BUILD, 1);
 
				break;
 
			}
 

	
 
@@ -1128,14 +1129,6 @@ struct BuildVehicleWindow : Window {
 
		}
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget)
 
	{
 
		if (widget == BUILD_VEHICLE_WIDGET_LIST) {
 
			/* When double clicking, we want to buy a vehicle */
 
			this->OnClick(pt, BUILD_VEHICLE_WIDGET_BUILD);
 
		}
 
	}
 

	
 
	virtual void OnQueryTextFinished(char *str)
 
	{
 
		if (str == NULL) return;
src/cheat_gui.cpp
Show inline comments
 
@@ -271,7 +271,7 @@ struct CheatWindow : Window {
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		const NWidgetBase *wid = this->GetWidget<NWidgetBase>(CW_PANEL);
 
		uint btn = (pt.y - wid->pos_y - WD_FRAMERECT_TOP - this->header_height) / (FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL);
src/company_gui.cpp
Show inline comments
 
@@ -433,7 +433,7 @@ struct CompanyFinancesWindow : Window {
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case CFW_TOGGLE_SIZE: // toggle size
 
@@ -729,7 +729,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			/* Livery Class buttons */
 
@@ -1393,7 +1393,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			/* Toggle size, advanced/simple face selection */
 
@@ -1916,7 +1916,7 @@ struct CompanyWindow : Window
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case CW_WIDGET_NEW_FACE: DoSelectCompanyManagerFace(this); break;
 
@@ -2115,7 +2115,7 @@ struct BuyCompanyWindow : Window {
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BCW_NO:
src/date_gui.cpp
Show inline comments
 
@@ -151,7 +151,7 @@ struct SetDateWindow : Window {
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case SDW_DAY:
src/depot_gui.cpp
Show inline comments
 
@@ -711,7 +711,7 @@ struct DepotWindow : Window {
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case DEPOT_WIDGET_MATRIX: { // List
src/dock_gui.cpp
Show inline comments
 
@@ -181,7 +181,7 @@ struct BuildDocksToolbarWindow : Window 
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget >= DTW_BUTTONS_BEGIN) _build_docks_button_proc[widget - DTW_BUTTONS_BEGIN](this);
 
	}
 
@@ -372,7 +372,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BDSW_LT_OFF:
 
@@ -457,7 +457,7 @@ public:
 
		DrawShipDepotSprite(this->GetWidget<NWidgetBase>(BDDW_Y)->pos_x + 64, this->GetWidget<NWidgetBase>(BDDW_Y)->pos_y + 34, 3);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BDDW_X:
src/engine_gui.cpp
Show inline comments
 
@@ -106,7 +106,7 @@ struct EnginePreviewWindow : Window {
 
		DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, r.bottom, GetEngineInfoString(engine), TC_FROMSTRING, SA_CENTER);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case EPW_YES:
src/genworld_gui.cpp
Show inline comments
 
@@ -519,7 +519,7 @@ struct GenerateLandscapeWindow : public 
 
		this->DrawEditBox(GLAND_RANDOM_EDITBOX);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case GLAND_TEMPERATE:
 
@@ -921,7 +921,7 @@ struct CreateScenarioWindow : public Win
 
		size->height += padding.height;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case CSCEN_TEMPERATE:
 
@@ -1161,7 +1161,7 @@ struct GenerateProgressWindow : public W
 
		this->InitNested(&_generate_progress_desc);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case GPWW_ABORT:
src/graph_gui.cpp
Show inline comments
 
@@ -81,7 +81,7 @@ struct GraphLegendWindow : Window {
 
		DrawString(r.left + (rtl ? WD_FRAMERECT_LEFT : 19), r.right - (rtl ? 19 : WD_FRAMERECT_RIGHT), r.top + WD_FRAMERECT_TOP, STR_COMPANY_NAME_COMPANY_NUM, HasBit(_legend_excluded_companies, cid) ? TC_BLACK : TC_WHITE);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (!IsInsideMM(widget, GLW_FIRST_COMPANY, MAX_COMPANIES + GLW_FIRST_COMPANY)) return;
 

	
 
@@ -513,7 +513,7 @@ public:
 
		return INVALID_DATAPOINT;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		/* Clicked on legend? */
 
		if (widget == BGW_KEY_BUTTON) ShowGraphLegend();
 
@@ -725,10 +725,10 @@ struct PerformanceHistoryGraphWindow : B
 
		return c->old_economy[j].performance_history;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget == PHW_DETAILED_PERFORMANCE) ShowPerformanceRatingDetail();
 
		this->BaseGraphWindow::OnClick(pt, widget);
 
		this->BaseGraphWindow::OnClick(pt, widget, click_count);
 
	}
 
};
 

	
 
@@ -874,7 +874,7 @@ struct PaymentRatesGraphWindow : BaseGra
 
		DrawString(rtl ? r.left : x + 14 + clk_dif, (rtl ? r.right - 14 + clk_dif : r.right), y + clk_dif, STR_GRAPH_CARGO_PAYMENT_CARGO);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget >= CPW_CARGO_FIRST) {
 
			int i = 0;
 
@@ -1330,7 +1330,7 @@ struct PerformanceRatingDetailWindow : W
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		/* Check which button is clicked */
 
		if (IsInsideMM(widget, PRW_COMPANY_FIRST, PRW_COMPANY_LAST + 1)) {
src/group_gui.cpp
Show inline comments
 
@@ -421,7 +421,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case GRP_WIDGET_SORT_BY_ORDER: // Flip sorting method ascending/descending
src/highscore_gui.cpp
Show inline comments
 
@@ -59,7 +59,7 @@ struct EndGameHighScoreBaseWindow : Wind
 
		return pt;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		delete this;
 
	}
src/industry_gui.cpp
Show inline comments
 
@@ -391,13 +391,7 @@ public:
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget)
 
	{
 
		if (widget != DPIW_MATRIX_WIDGET) return;
 
		this->OnClick(pt, DPIW_FUND_WIDGET);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case DPIW_MATRIX_WIDGET: {
 
@@ -419,6 +413,7 @@ public:
 
					}
 

	
 
					this->SetWidgetDisabledState(DPIW_FUND_WIDGET, !this->enabled[this->selected_index]);
 
					if (this->enabled[this->selected_index] && click_count > 1) this->OnClick(pt, DPIW_FUND_WIDGET, 1);
 
				}
 
			} break;
 

	
 
@@ -703,7 +698,7 @@ public:
 
		if (widget == IVW_INFO) size->height = this->info_height;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		Industry *i;
 

	
 
@@ -1105,7 +1100,7 @@ public:
 
	}
 

	
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case IDW_DROPDOWN_ORDER:
src/intro_gui.cpp
Show inline comments
 
@@ -97,7 +97,7 @@ struct SelectGameWindow : public Window 
 
		*size = maxdim(*size, textdim);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
#ifdef ENABLE_NETWORK
 
		/* Do not create a network server when you (just) have closed one of the game
src/misc_gui.cpp
Show inline comments
 
@@ -1285,7 +1285,7 @@ struct QueryStringWindow : public QueryS
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case QUERY_STR_WIDGET_DEFAULT:
 
@@ -1450,7 +1450,7 @@ struct QueryWindow : public Window {
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case QUERY_WIDGET_YES: {
 
@@ -1802,7 +1802,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case SLWW_SORT_BYNAME: // Sort save names by name
src/music_gui.cpp
Show inline comments
 
@@ -397,7 +397,7 @@ struct MusicTrackSelectionWindow : publi
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case MTSW_LIST_LEFT: { // add to playlist
 
@@ -643,7 +643,7 @@ struct MusicWindow : public Window {
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case MW_PREV: // skip to prev
src/network/network_chat_gui.cpp
Show inline comments
 
@@ -480,7 +480,7 @@ struct NetworkChatWindow : public QueryS
 
		DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, this->dest_string, TC_BLACK, SA_RIGHT);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			/* Send */
src/network/network_content_gui.cpp
Show inline comments
 
@@ -164,7 +164,7 @@ public:
 
		DrawStringMultiLine(r.left + 2, r.right - 2, y, y + FONT_HEIGHT_NORMAL * 2, str, TC_FROMSTRING, SA_CENTER);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget == NCDSWW_CANCELOK) {
 
			if (this->downloaded_bytes != this->total_bytes) _network_content_client.Close();
 
@@ -583,16 +583,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget)
 
	{
 
		/* Double clicking on a line in the matrix toggles the state of the checkbox */
 
		if (widget != NCLWW_MATRIX) return;
 

	
 
		pt.x = this->GetWidget<NWidgetBase>(NCLWW_CHECKBOX)->pos_x;
 
		this->OnClick(pt, widget);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case NCLWW_MATRIX: {
 
@@ -607,7 +598,7 @@ public:
 
				this->list_pos = id_v;
 

	
 
				const NWidgetBase *checkbox = this->GetWidget<NWidgetBase>(NCLWW_CHECKBOX);
 
				if (IsInsideBS(pt.x, checkbox->pos_x, checkbox->current_x)) {
 
				if (click_count > 1 || IsInsideBS(pt.x, checkbox->pos_x, checkbox->current_x)) {
 
					_network_content_client.ToggleSelectedState(this->selected);
 
					this->content.ForceResort();
 
				}
src/network/network_gui.cpp
Show inline comments
 
@@ -658,7 +658,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		this->field = widget;
 
		switch (widget) {
 
@@ -697,6 +697,9 @@ public:
 
				this->server = (id_v < this->servers.Length()) ? this->servers[id_v] : NULL;
 
				this->list_pos = (server == NULL) ? SLP_INVALID : id_v;
 
				this->SetDirty();
 

	
 
				/* FIXME the disabling should go into some InvalidateData, which is called instead of the SetDirty */
 
				if (!this->IsWidgetDisabled(NGWW_JOIN)) this->OnClick(pt, NGWW_JOIN, 1);
 
			} break;
 

	
 
			case NGWW_LASTJOINED: {
 
@@ -713,6 +716,9 @@ public:
 
					}
 
					this->ScrollToSelectedServer();
 
					this->SetDirty();
 

	
 
					/* FIXME the disabling should go into some InvalidateData, which is called instead of the SetDirty */
 
					if (!this->IsWidgetDisabled(NGWW_JOIN)) this->OnClick(pt, NGWW_JOIN, 1);
 
				}
 
			} break;
 

	
 
@@ -755,14 +761,6 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget)
 
	{
 
		if (widget == NGWW_MATRIX || widget == NGWW_LASTJOINED) {
 
			/* is the Join button enabled? */
 
			if (!this->IsWidgetDisabled(NGWW_JOIN)) this->OnClick(pt, NGWW_JOIN);
 
		}
 
	}
 

	
 
	virtual void OnDropdownSelect(int widget, int index)
 
	{
 
		switch (widget) {
 
@@ -1157,7 +1155,7 @@ struct NetworkStartServerWindow : public
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		this->field = widget;
 
		switch (widget) {
 
@@ -1621,7 +1619,7 @@ struct NetworkLobbyWindow : public Windo
 
		DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_GAME_LOBBY_PLAYERS); // players
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case NLWW_CANCEL:   // Cancel button
 
@@ -1636,6 +1634,9 @@ struct NetworkLobbyWindow : public Windo
 
				id_v += this->vscroll.GetPosition();
 
				this->company = (id_v >= this->server->info.companies_on) ? INVALID_COMPANY : NetworkLobbyFindCompanyIndex(id_v);
 
				this->SetDirty();
 

	
 
				/* FIXME the disabling should go into some InvalidateData, which is called instead of the SetDirty */
 
				if (!this->IsWidgetDisabled(NLWW_JOIN)) this->OnClick(pt, NLWW_JOIN, 1);
 
			} break;
 

	
 
			case NLWW_JOIN:     // Join company
 
@@ -1660,14 +1661,6 @@ struct NetworkLobbyWindow : public Windo
 
		}
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget)
 
	{
 
		if (widget == NLWW_MATRIX) {
 
			/* is the Join button enabled? */
 
			if (!this->IsWidgetDisabled(NLWW_JOIN)) this->OnClick(pt, NLWW_JOIN);
 
		}
 
	}
 

	
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacityFromWidget(this, NLWW_MATRIX);
 
@@ -2085,7 +2078,7 @@ struct NetworkClientListWindow : Window 
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		/* Show the popup with option */
 
		if (this->selected_item != -1) {
 
@@ -2218,7 +2211,7 @@ struct NetworkJoinStatusWindow : Window 
 
		size->width = width + WD_FRAMERECT_LEFT + WD_FRAMERECT_BOTTOM + 10;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget == NJSW_CANCELOK) { // Disconnect button
 
			NetworkDisconnect();
 
@@ -2304,7 +2297,7 @@ struct NetworkCompanyPasswordWindow : pu
 
		this->DrawEditBox(NCPWW_PASSWORD);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case NCPWW_OK:
src/newgrf_gui.cpp
Show inline comments
 
@@ -344,12 +344,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget)
 
	{
 
		if (widget == ANGRFW_GRF_LIST) this->OnClick(pt, ANGRFW_ADD);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case ANGRFW_GRF_LIST: {
 
@@ -364,9 +359,9 @@ public:
 
					this->sel_pos = -1;
 
				}
 
				this->InvalidateData(1);
 
				break;
 
				if (click_count == 1) break;
 
			}
 

	
 
			/* FALL THROUGH */
 
			case ANGRFW_ADD: // Add selection to list
 
				if (this->sel != NULL) {
 
					const GRFConfig *src = this->sel;
 
@@ -705,12 +700,7 @@ struct NewGRFWindow : public Window {
 
		}
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget)
 
	{
 
		if (widget == SNGRFS_FILE_LIST) this->OnClick(pt, SNGRFS_SET_PARAMETERS);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case SNGRFS_PRESET_LIST: {
 
@@ -821,6 +811,7 @@ struct NewGRFWindow : public Window {
 
				this->sel = c;
 

	
 
				this->InvalidateData();
 
				if (click_count > 1) this->OnClick(pt, SNGRFS_SET_PARAMETERS, 1);
 
				break;
 
			}
 

	
src/news_gui.cpp
Show inline comments
 
@@ -444,7 +444,7 @@ struct NewsWindow : Window {
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case NTW_CLOSEBOX:
 
@@ -988,7 +988,7 @@ struct MessageHistoryWindow : Window {
 
		this->vscroll.SetCount(_total_news);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget == MHW_BACKGROUND) {
 
			NewsItem *ni = _latest_news;
 
@@ -1163,7 +1163,7 @@ struct MessageOptionsWindow : Window {
 
		this->SetWidgetLoweredState(WIDGET_NEWSOPT_SOUNDTICKER, _news_ticker_sound);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case WIDGET_NEWSOPT_DROP_SUMMARY: // Dropdown menu for all settings
src/order_gui.cpp
Show inline comments
 
@@ -985,7 +985,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case ORDER_WIDGET_ORDER_LIST: {
src/osk_gui.cpp
Show inline comments
 
@@ -142,7 +142,7 @@ struct OskWindow : public Window {
 
		this->qs->DrawEditBox(this, OSK_WIDGET_TEXT);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		/* clicked a letter */
 
		if (widget >= OSK_WIDGET_LETTERS) {
 
@@ -207,7 +207,7 @@ struct OskWindow : public Window {
 
				if (this->qs->orig == NULL || strcmp(this->qs->text.buf, this->qs->orig) != 0) {
 
					/* pass information by simulating a button press on parent window */
 
					if (this->ok_btn != 0) {
 
						this->parent->OnClick(pt, this->ok_btn);
 
						this->parent->OnClick(pt, this->ok_btn, 1);
 
						/* Window gets deleted when the parent window removes itself. */
 
						return;
 
					}
 
@@ -217,7 +217,7 @@ struct OskWindow : public Window {
 

	
 
			case OSK_WIDGET_CANCEL:
 
				if (this->cancel_btn != 0) { // pass a cancel event to the parent window
 
					this->parent->OnClick(pt, this->cancel_btn);
 
					this->parent->OnClick(pt, this->cancel_btn, 1);
 
					/* Window gets deleted when the parent window removes itself. */
 
					return;
 
				} else { // or reset to original string
src/rail_gui.cpp
Show inline comments
 
@@ -694,7 +694,7 @@ struct BuildRailToolbarWindow : Window {
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget >= RTW_BUILD_NS) {
 
			_remove_button_clicked = false;
 
@@ -1165,7 +1165,7 @@ public:
 
		if (widget == BRSW_NEWST_DROPDOWN) SetDParam(0, GetStationClassName(_railstation.station_class));
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BRSW_PLATFORM_DIR_X:
 
@@ -1587,7 +1587,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BSW_SEMAPHORE_NORM:
 
@@ -1723,7 +1723,7 @@ struct BuildRailDepotWindow : public Pic
 
		DrawTrainDepotSprite(r.left - 1, r.top, widget - BRDW_DEPOT_NE + DIAGDIR_NE, _cur_railtype);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BRDW_DEPOT_NE:
 
@@ -1826,7 +1826,7 @@ struct BuildRailWaypointWindow : PickerW
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BRWW_WAYPOINT_1:
src/road_gui.cpp
Show inline comments
 
@@ -483,7 +483,7 @@ struct BuildRoadToolbarWindow : Window {
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget >= RTW_ROAD_X) {
 
			_remove_button_clicked = false;
 
@@ -787,7 +787,7 @@ struct BuildRoadDepotWindow : public Pic
 
		DrawRoadDepotSprite(r.left - 1, r.top, (DiagDirection)(widget - BRDW_DEPOT_NE + DIAGDIR_NE), _cur_roadtype);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BRDW_DEPOT_NW:
 
@@ -929,7 +929,7 @@ struct BuildRoadStationWindow : public P
 
		StationPickerDrawSprite(r.left + TILE_PIXELS, r.bottom - TILE_PIXELS, st, INVALID_RAILTYPE, widget < BRSW_STATION_X ? ROADTYPE_ROAD : _cur_roadtype, widget - BRSW_STATION_NE);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BRSW_STATION_NE:
src/settings_gui.cpp
Show inline comments
 
@@ -277,7 +277,7 @@ struct GameOptionsWindow : Window {
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case GOW_CURRENCY_DROPDOWN: // Setup currencies dropdown
 
@@ -625,7 +625,7 @@ public:
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget >= GDW_OPTIONS_START) {
 
			widget -= GDW_OPTIONS_START;
 
@@ -1539,7 +1539,7 @@ struct GameSettingsWindow : Window {
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget != SETTINGSEL_OPTIONSPANEL) return;
 

	
 
@@ -1826,7 +1826,7 @@ struct CustomCurrencyWindow : Window {
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		int line = 0;
 
		int len = 0;
src/signs_gui.cpp
Show inline comments
 
@@ -143,7 +143,7 @@ struct SignListWindow : Window, SignList
 
		if (widget == SLW_CAPTION) SetDParam(0, this->vscroll.GetCount());
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget == SLW_LIST) {
 
			uint id_v = (pt.y - this->GetWidget<NWidgetBase>(SLW_LIST)->pos_y - WD_FRAMERECT_TOP) / this->resize.step_height;
 
@@ -328,7 +328,7 @@ struct SignWindow : QueryStringBaseWindo
 
		if (!this->IsShaded()) this->DrawEditBox(QUERY_EDIT_SIGN_WIDGET_TEXT);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case QUERY_EDIT_SIGN_WIDGET_PREVIOUS:
src/smallmap_gui.cpp
Show inline comments
 
@@ -898,7 +898,7 @@ public:
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case SM_WIDGET_MAP: { // Map window
src/station_gui.cpp
Show inline comments
 
@@ -532,7 +532,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case SLW_LIST: {
 
@@ -1136,7 +1136,7 @@ struct StationViewWindow : public Window
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case SVW_WAITING:
 
@@ -1421,7 +1421,7 @@ struct SelectStationWindow : Window {
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget != JSW_PANEL) return;
 

	
src/statusbar_gui.cpp
Show inline comments
 
@@ -200,7 +200,7 @@ struct StatusBarWindow : Window {
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case SBW_MIDDLE: ShowLastNewsMessage(); break;
src/subsidy_gui.cpp
Show inline comments
 
@@ -37,7 +37,7 @@ struct SubsidyListWindow : Window {
 
		this->OnInvalidateData(0);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget != SLW_PANEL) return;
 

	
src/terraform_gui.cpp
Show inline comments
 
@@ -241,7 +241,7 @@ struct TerraformToolbarWindow : Window {
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget >= TTW_BUTTONS_START) _terraform_button_proc[widget - TTW_BUTTONS_START](this);
 
	}
 
@@ -673,7 +673,7 @@ struct ScenarioEditorLandscapeGeneration
 
		return ES_NOT_HANDLED;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (IsInsideMM(widget, ETTW_BUTTONS_START, ETTW_BUTTONS_END)) {
 
			_editor_terraform_button_proc[widget - ETTW_BUTTONS_START](this);
src/timetable_gui.cpp
Show inline comments
 
@@ -497,7 +497,7 @@ struct TimetableWindow : Window {
 
		return v->index | (order_number << 16) | (is_journey << 24);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		const Vehicle *v = this->vehicle;
 

	
src/toolbar_gui.cpp
Show inline comments
 
@@ -1233,7 +1233,7 @@ struct MainToolbarWindow : Window {
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (_game_mode != GM_MENU && !this->IsWidgetDisabled(widget)) _toolbar_button_procs[widget](this);
 
	}
 
@@ -1470,7 +1470,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (_game_mode == GM_MENU) return;
 
		_scen_toolbar_button_procs[widget](this);
src/town_gui.cpp
Show inline comments
 
@@ -251,10 +251,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget) { HandleClick(pt, widget, true); }
 
	virtual void OnClick(Point pt, int widget) { HandleClick(pt, widget, false); }
 

	
 
	void HandleClick(Point pt, int widget, bool double_click)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case TWA_COMMAND_LIST: {
 
@@ -268,7 +265,7 @@ public:
 
					this->SetDirty();
 
				}
 
				/* Fall through to clicking in case we are double-clicked */
 
				if (!double_click || y < 0) break;
 
				if (click_count == 1 || y < 0) break;
 
			}
 

	
 
			case TWA_EXECUTE:
 
@@ -435,7 +432,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case TVW_CENTERVIEW: // scroll to location
 
@@ -797,7 +794,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case TDW_SORTNAME: // Sort by Name ascending/descending
 
@@ -1073,7 +1070,7 @@ public:
 
		if (!this->IsShaded()) this->DrawEditBox(TSEW_TOWNNAME_EDITBOX);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case TSEW_NEWTOWN:
src/transparency_gui.cpp
Show inline comments
 
@@ -82,7 +82,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget >= TTW_WIDGET_BEGIN && widget < TTW_WIDGET_END) {
 
			if (_ctrl_pressed) {
src/tree_gui.cpp
Show inline comments
 
@@ -96,7 +96,7 @@ public:
 
		DrawSprite(tree_sprites[i].sprite, tree_sprites[i].pal, (r.left + r.right) / 2, r.bottom - 7);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BTW_TYPE_11: case BTW_TYPE_12: case BTW_TYPE_13: case BTW_TYPE_14:
src/vehicle_gui.cpp
Show inline comments
 
@@ -438,12 +438,7 @@ struct RefitWindow : public Window {
 
		}
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget)
 
	{
 
		if (widget == VRW_MATRIX) this->OnClick(pt, VRW_REFITBUTTON);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case VRW_MATRIX: { // listbox
 
@@ -452,9 +447,10 @@ struct RefitWindow : public Window {
 
					this->sel = (y / (int)this->resize.step_height) + this->vscroll.GetPosition();
 
					this->SetDirty();
 
				}
 
				break;
 
				/* FIXME We need to call some InvalidateData to make this->cargo valid */
 
				if (click_count == 1) break;
 
			}
 

	
 
			/* FALL THROUGH */
 
			case VRW_REFITBUTTON: // refit button
 
				if (this->cargo != NULL) {
 
					const Vehicle *v = Vehicle::Get(this->window_number);
 
@@ -1116,7 +1112,7 @@ public:
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case VLW_WIDGET_SORT_ORDER: // Flip sorting method ascending/descending
 
@@ -1611,7 +1607,7 @@ struct VehicleDetailsWindow : Window {
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case VLD_WIDGET_RENAME_VEHICLE: { // rename
 
@@ -2041,7 +2037,7 @@ public:
 
		DrawString(r.left + WD_FRAMERECT_LEFT + 6, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, str, TC_FROMSTRING, SA_CENTER);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		const Vehicle *v = Vehicle::Get(this->window_number);
 

	
src/viewport_gui.cpp
Show inline comments
 
@@ -101,7 +101,7 @@ public:
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case EVW_ZOOMIN: DoZoomInOutWindow(ZOOM_IN,  this); break;
src/waypoint_gui.cpp
Show inline comments
 
@@ -75,7 +75,7 @@ public:
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case WAYPVW_CENTERVIEW: // scroll to location
src/widgets/dropdown.cpp
Show inline comments
 
@@ -247,7 +247,7 @@ struct DropdownWindow : Window {
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget != DDM_ITEMS) return;
 
		int item;
src/window.cpp
Show inline comments
 
@@ -253,9 +253,9 @@ static void StartWindowSizing(Window *w,
 
 * @param w Window to dispatch event in
 
 * @param x X coordinate of the click
 
 * @param y Y coordinate of the click
 
 * @param double_click Was it a double click?
 
 * @param click_count Number of fast consecutive clicks at same position
 
 */
 
static void DispatchLeftClickEvent(Window *w, int x, int y, bool double_click)
 
static void DispatchLeftClickEvent(Window *w, int x, int y, int click_count)
 
{
 
	const NWidgetCore *nw = w->nested_root->GetWidgetFromPos(x, y);
 
	WidgetType widget_type = (nw != NULL) ? nw->type : WWT_EMPTY;
 
@@ -283,96 +283,88 @@ static void DispatchLeftClickEvent(Windo
 

	
 
	int widget_index = nw->index; ///< Index of the widget
 

	
 
	/* Process special buttons (only single clicks) */
 
	if (!double_click) {
 
		/* Clicked on a widget that is not disabled.
 
		 * So unless the clicked widget is the caption bar, change focus to this widget */
 
		if (widget_type != WWT_CAPTION) {
 
			/* Close the OSK window if a edit box loses focus */
 
			if (w->nested_focus != NULL &&  w->nested_focus->type == WWT_EDITBOX && w->nested_focus != nw && w->window_class != WC_OSK) {
 
				DeleteWindowById(WC_OSK, 0);
 
			}
 

	
 
			/* focused_widget_changed is 'now' only true if the window this widget
 
			 * is in gained focus. In that case it must remain true, also if the
 
			 * local widget focus did not change. As such it's the logical-or of
 
			 * both changed states.
 
			 *
 
			 * If this is not preserved, then the OSK window would be opened when
 
			 * a user has the edit box focused and then click on another window and
 
			 * then back again on the edit box (to type some text).
 
			 */
 
			focused_widget_changed |= w->SetFocusedWidget(widget_index);
 
	/* Clicked on a widget that is not disabled.
 
	 * So unless the clicked widget is the caption bar, change focus to this widget */
 
	if (widget_type != WWT_CAPTION) {
 
		/* Close the OSK window if a edit box loses focus */
 
		if (w->nested_focus != NULL &&  w->nested_focus->type == WWT_EDITBOX && w->nested_focus != nw && w->window_class != WC_OSK) {
 
			DeleteWindowById(WC_OSK, 0);
 
		}
 

	
 
		/* Close any child drop down menus. If the button pressed was the drop down
 
		 * list's own button, then we should not process the click any further. */
 
		if (HideDropDownMenu(w) == widget_index && widget_index >= 0) return;
 

	
 
		switch (widget_type) {
 
			/* special widget handling for buttons*/
 
			case WWT_PANEL   | WWB_PUSHBUTTON: // WWT_PUSHBTN
 
			case WWT_IMGBTN  | WWB_PUSHBUTTON: // WWT_PUSHIMGBTN
 
			case WWT_TEXTBTN | WWB_PUSHBUTTON: // WWT_PUSHTXTBTN
 
				w->HandleButtonClick(widget_index);
 
				break;
 
		/* focused_widget_changed is 'now' only true if the window this widget
 
		 * is in gained focus. In that case it must remain true, also if the
 
		 * local widget focus did not change. As such it's the logical-or of
 
		 * both changed states.
 
		 *
 
		 * If this is not preserved, then the OSK window would be opened when
 
		 * a user has the edit box focused and then click on another window and
 
		 * then back again on the edit box (to type some text).
 
		 */
 
		focused_widget_changed |= w->SetFocusedWidget(widget_index);
 
	}
 

	
 
			case WWT_SCROLLBAR:
 
			case WWT_SCROLL2BAR:
 
			case WWT_HSCROLLBAR:
 
				ScrollbarClickHandler(w, nw, x, y);
 
				break;
 
	/* Close any child drop down menus. If the button pressed was the drop down
 
	 * list's own button, then we should not process the click any further. */
 
	if (HideDropDownMenu(w) == widget_index && widget_index >= 0) return;
 

	
 
			case WWT_EDITBOX:
 
				if (!focused_widget_changed) { // Only open the OSK window if clicking on an already focused edit box
 
					/* Open the OSK window if clicked on an edit box */
 
					QueryStringBaseWindow *qs = dynamic_cast<QueryStringBaseWindow *>(w);
 
					if (qs != NULL) {
 
						qs->OnOpenOSKWindow(widget_index);
 
					}
 
				}
 
				break;
 
	switch (widget_type) {
 
		/* special widget handling for buttons*/
 
		case WWT_PANEL   | WWB_PUSHBUTTON: // WWT_PUSHBTN
 
		case WWT_IMGBTN  | WWB_PUSHBUTTON: // WWT_PUSHIMGBTN
 
		case WWT_TEXTBTN | WWB_PUSHBUTTON: // WWT_PUSHTXTBTN
 
			w->HandleButtonClick(widget_index);
 
			break;
 

	
 
		case WWT_SCROLLBAR:
 
		case WWT_SCROLL2BAR:
 
		case WWT_HSCROLLBAR:
 
			ScrollbarClickHandler(w, nw, x, y);
 
			break;
 

	
 
			case WWT_CLOSEBOX: // 'X'
 
				delete w;
 
				return;
 
		case WWT_EDITBOX:
 
			if (!focused_widget_changed) { // Only open the OSK window if clicking on an already focused edit box
 
				/* Open the OSK window if clicked on an edit box */
 
				QueryStringBaseWindow *qs = dynamic_cast<QueryStringBaseWindow *>(w);
 
				if (qs != NULL) {
 
					qs->OnOpenOSKWindow(widget_index);
 
				}
 
			}
 
			break;
 

	
 
			case WWT_CAPTION: // 'Title bar'
 
				StartWindowDrag(w);
 
				return;
 
		case WWT_CLOSEBOX: // 'X'
 
			delete w;
 
			return;
 

	
 
		case WWT_CAPTION: // 'Title bar'
 
			StartWindowDrag(w);
 
			return;
 

	
 
			case WWT_RESIZEBOX:
 
				/* When the resize widget is on the left size of the window
 
				 * we assume that that button is used to resize to the left. */
 
				StartWindowSizing(w, (int)nw->pos_x < (w->width / 2));
 
				nw->SetDirty(w);
 
				return;
 
		case WWT_RESIZEBOX:
 
			/* When the resize widget is on the left size of the window
 
			 * we assume that that button is used to resize to the left. */
 
			StartWindowSizing(w, (int)nw->pos_x < (w->width / 2));
 
			nw->SetDirty(w);
 
			return;
 

	
 
			case WWT_SHADEBOX:
 
				nw->SetDirty(w);
 
				w->SetShaded(!w->IsShaded());
 
				return;
 
		case WWT_SHADEBOX:
 
			nw->SetDirty(w);
 
			w->SetShaded(!w->IsShaded());
 
			return;
 

	
 
			case WWT_STICKYBOX:
 
				w->flags4 ^= WF_STICKY;
 
				nw->SetDirty(w);
 
				return;
 
		case WWT_STICKYBOX:
 
			w->flags4 ^= WF_STICKY;
 
			nw->SetDirty(w);
 
			return;
 

	
 
			default:
 
				break;
 
		}
 
		default:
 
			break;
 
	}
 

	
 
	/* Widget has no index, so the window is not interested in it. */
 
	if (widget_index < 0) return;
 

	
 
	Point pt = { x, y };
 

	
 
	if (double_click) {
 
		w->OnDoubleClick(pt, widget_index);
 
	} else {
 
		w->OnClick(pt, widget_index);
 
	}
 
	w->OnClick(pt, widget_index, click_count);
 
}
 

	
 
/**
 
@@ -2127,11 +2119,7 @@ static void MouseLoop(MouseClick click, 
 
		switch (click) {
 
			case MC_LEFT:
 
			case MC_DOUBLE_LEFT:
 
				DispatchLeftClickEvent(w, x - w->left, y - w->top, false);
 
				if (click == MC_DOUBLE_LEFT && _mouseover_last_w != NULL) {
 
					/* Issue the doubleclick, if the window was not removed */
 
					DispatchLeftClickEvent(w, x - w->left, y - w->top, true);
 
				}
 
				DispatchLeftClickEvent(w, x - w->left, y - w->top, click == MC_DOUBLE_LEFT ? 2 : 1);
 
				break;
 

	
 
			default:
src/window_gui.h
Show inline comments
 
@@ -638,15 +638,9 @@ public:
 
	 * A click with the left mouse button has been made on the window.
 
	 * @param pt     the point inside the window that has been clicked.
 
	 * @param widget the clicked widget.
 
	 * @param click_count Number of fast consecutive clicks at same position
 
	 */
 
	virtual void OnClick(Point pt, int widget) {}
 

	
 
	/**
 
	 * A double click with the left mouse button has been made on the window.
 
	 * @param pt     the point inside the window that has been clicked.
 
	 * @param widget the clicked widget.
 
	 */
 
	virtual void OnDoubleClick(Point pt, int widget) {}
 
	virtual void OnClick(Point pt, int widget, int click_count) {}
 

	
 
	/**
 
	 * A click with the right mouse button has been made on the window.
0 comments (0 inline, 0 general)