diff options
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/network_chat_gui.cpp | 2 | ||||
-rw-r--r-- | src/network/network_content_gui.cpp | 15 | ||||
-rw-r--r-- | src/network/network_gui.cpp | 37 |
3 files changed, 19 insertions, 35 deletions
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp index f10d51a2b..e9f92b784 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -480,7 +480,7 @@ struct NetworkChatWindow : public QueryStringBaseWindow { 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 */ diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index e4209d0e5..bb77aea6d 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -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(); } diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index d8c8dd390..d14657b5a 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -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: |