(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().

This commit is contained in:
frosch
2010-01-30 18:34:48 +00:00
parent 2f6fe85f23
commit 88019e64e1
46 changed files with 190 additions and 272 deletions

View File

@@ -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 QueryStringBaseWindow {
}
}
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 Window {
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 Window {
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 Window {
}
}
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 : public QueryStringBaseWindow {
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: