summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_chat_gui.cpp11
-rw-r--r--src/network/network_content_gui.cpp28
-rw-r--r--src/network/network_content_gui.h7
-rw-r--r--src/network/network_gui.cpp113
4 files changed, 8 insertions, 151 deletions
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp
index 245d15ea5..d6c0319f4 100644
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -28,6 +28,8 @@
#include "network_client.h"
#include "network_base.h"
+#include "../widgets/network_chat_widget.h"
+
#include "table/strings.h"
/** The draw buffer must be able to contain the chat message, client name and the "[All]" message,
@@ -283,15 +285,6 @@ static void SendChat(const char *buf, DestType type, int dest)
}
}
-/** Widget numbers of the chat window. */
-enum NetWorkChatWidgets {
- NWCW_CLOSE,
- NWCW_BACKGROUND,
- NWCW_DESTINATION,
- NWCW_TEXTBOX,
- NWCW_SENDBUTTON,
-};
-
/** Window to enter the chat message in. */
struct NetworkChatWindow : public QueryStringBaseWindow {
DestType dtype; ///< The type of destination.
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp
index fd6b72b37..1a31e0904 100644
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -22,6 +22,8 @@
#include "../core/geometry_func.hpp"
#include "network_content_gui.h"
+#include "../widgets/network_content_widget.h"
+
#include "table/strings.h"
#include "../table/sprites.h"
@@ -220,32 +222,6 @@ public:
}
};
-/** Widgets of the content list window. */
-enum NetworkContentListWindowWidgets {
- NCLWW_BACKGROUND, ///< Resize button
-
- NCLWW_FILTER_CAPT, ///< Caption for the filter editbox
- NCLWW_FILTER, ///< Filter editbox
-
- NCLWW_CHECKBOX, ///< Button above checkboxes
- NCLWW_TYPE, ///< 'Type' button
- NCLWW_NAME, ///< 'Name' button
-
- NCLWW_MATRIX, ///< Panel with list of content
- NCLWW_SCROLLBAR, ///< Scrollbar of matrix
-
- NCLWW_DETAILS, ///< Panel with content details
-
- NCLWW_SELECT_ALL, ///< 'Select all' button
- NCLWW_SELECT_UPDATE, ///< 'Select updates' button
- NCLWW_UNSELECT, ///< 'Unselect all' button
- NCLWW_OPEN_URL, ///< 'Open url' button
- NCLWW_CANCEL, ///< 'Cancel' button
- NCLWW_DOWNLOAD, ///< 'Download' button
-
- NCLWW_SEL_ALL_UPDATE, ///< #NWID_SELECTION widget for select all/update buttons.
-};
-
/** Window that lists the content that's at the content server */
class NetworkContentListWindow : public QueryStringBaseWindow, ContentCallback {
/** List with content infos. */
diff --git a/src/network/network_content_gui.h b/src/network/network_content_gui.h
index 5707c6cf4..6650eb14a 100644
--- a/src/network/network_content_gui.h
+++ b/src/network/network_content_gui.h
@@ -14,12 +14,7 @@
#include "network_content.h"
#include "../window_gui.h"
-
-/** Widgets used by this window */
-enum NetworkContentDownloadStatusWindowWidgets {
- NCDSWW_BACKGROUND, ///< Background
- NCDSWW_CANCELOK, ///< (Optional) Cancel/OK button
-};
+#include "../widgets/network_content_widget.h"
/** Base window for showing the download status of content */
class BaseNetworkContentDownloadStatusWindow : public Window, ContentCallback {
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index f860d3a79..0924596b8 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -32,6 +32,8 @@
#include "../newgrf_text.h"
#include "../genworld.h"
+#include "../widgets/network_widget.h"
+
#include "table/strings.h"
#include "../table/sprites.h"
@@ -75,45 +77,6 @@ void UpdateNetworkGameWindow(bool unselect)
InvalidateWindowData(WC_NETWORK_WINDOW, 0, unselect ? 1 : 0);
}
-/** Enum for NetworkGameWindow, referring to _network_game_window_widgets */
-enum NetworkGameWindowWidgets {
- NGWW_MAIN, ///< Main panel
-
- NGWW_CONNECTION, ///< Label in front of connection droplist
- NGWW_CONN_BTN, ///< 'Connection' droplist button
- NGWW_CLIENT_LABEL, ///< Label in front of client name edit box
- NGWW_CLIENT, ///< Panel with editbox to set client name
-
- NGWW_HEADER, ///< Header container of the matrix
- NGWW_NAME, ///< 'Name' button
- NGWW_CLIENTS, ///< 'Clients' button
- NGWW_MAPSIZE, ///< 'Map size' button
- NGWW_DATE, ///< 'Date' button
- NGWW_YEARS, ///< 'Years' button
- NGWW_INFO, ///< Third button in the game list panel
-
- NGWW_MATRIX, ///< Panel with list of games
- NGWW_SCROLLBAR, ///< Scrollbar of matrix
-
- NGWW_LASTJOINED_LABEL, ///< Label "Last joined server:"
- NGWW_LASTJOINED, ///< Info about the last joined server
- NGWW_LASTJOINED_SPACER, ///< Spacer after last joined server panel
-
- NGWW_DETAILS, ///< Panel with game details
- NGWW_DETAILS_SPACER, ///< Spacer for game actual details
- NGWW_JOIN, ///< 'Join game' button
- NGWW_REFRESH, ///< 'Refresh server' button
- NGWW_NEWGRF, ///< 'NewGRF Settings' button
- NGWW_NEWGRF_SEL, ///< Selection 'widget' to hide the NewGRF settings
- NGWW_NEWGRF_MISSING, ///< 'Find missing NewGRF online' button
- NGWW_NEWGRF_MISSING_SEL, ///< Selection widget for the above button
-
- NGWW_FIND, ///< 'Find server' button
- NGWW_ADD, ///< 'Add server' button
- NGWW_START, ///< 'Start server' button
- NGWW_CANCEL, ///< 'Cancel' button
-};
-
typedef GUIList<NetworkGameList*> GUIGameServerList;
typedef uint16 ServerListPosition;
static const ServerListPosition SLP_INVALID = 0xFFFF;
@@ -1031,38 +994,6 @@ void ShowNetworkGameWindow()
new NetworkGameWindow(&_network_game_window_desc);
}
-/** Enum for NetworkStartServerWindow, referring to _network_start_server_window_widgets */
-enum NetworkStartServerWidgets {
- NSSW_BACKGROUND,
- NSSW_GAMENAME_LABEL,
- NSSW_GAMENAME, ///< Background for editbox to set game name
- NSSW_SETPWD, ///< 'Set password' button
- NSSW_CONNTYPE_LABEL,
- NSSW_CONNTYPE_BTN, ///< 'Connection type' droplist button
- NSSW_CLIENTS_LABEL,
- NSSW_CLIENTS_BTND, ///< 'Max clients' downarrow
- NSSW_CLIENTS_TXT, ///< 'Max clients' text
- NSSW_CLIENTS_BTNU, ///< 'Max clients' uparrow
- NSSW_COMPANIES_LABEL,
- NSSW_COMPANIES_BTND, ///< 'Max companies' downarrow
- NSSW_COMPANIES_TXT, ///< 'Max companies' text
- NSSW_COMPANIES_BTNU, ///< 'Max companies' uparrow
- NSSW_SPECTATORS_LABEL,
- NSSW_SPECTATORS_BTND, ///< 'Max spectators' downarrow
- NSSW_SPECTATORS_TXT, ///< 'Max spectators' text
- NSSW_SPECTATORS_BTNU, ///< 'Max spectators' uparrow
-
- NSSW_LANGUAGE_LABEL,
- NSSW_LANGUAGE_BTN, ///< 'Language spoken' droplist button
-
- NSSW_GENERATE_GAME, ///< New game button
- NSSW_LOAD_GAME, ///< Load game button
- NSSW_PLAY_SCENARIO, ///< Play scenario button
- NSSW_PLAY_HEIGHTMAP, ///< Play heightmap button
-
- NSSW_CANCEL, ///< 'Cancel' button
-};
-
struct NetworkStartServerWindow : public QueryStringBaseWindow {
byte field; ///< Selected text-field
byte widget_id; ///< The widget that has the pop-up input menu
@@ -1390,21 +1321,6 @@ static void ShowNetworkStartServerWindow()
new NetworkStartServerWindow(&_network_start_server_window_desc);
}
-/** Enum for NetworkLobbyWindow, referring to _network_lobby_window_widgets */
-enum NetworkLobbyWindowWidgets {
- NLWW_BACKGROUND, ///< Background panel
- NLWW_TEXT, ///< Heading text
- NLWW_HEADER, ///< Header above list of companies
- NLWW_MATRIX, ///< List of companies
- NLWW_SCROLLBAR, ///< Scroll bar
- NLWW_DETAILS, ///< Company details
- NLWW_JOIN, ///< 'Join company' button
- NLWW_NEW, ///< 'New company' button
- NLWW_SPECTATE, ///< 'Spectate game' button
- NLWW_REFRESH, ///< 'Refresh server' button
- NLWW_CANCEL, ///< 'Cancel' button
-};
-
struct NetworkLobbyWindow : public Window {
CompanyID company; ///< Select company
NetworkGameList *server; ///< Selected server
@@ -1724,7 +1640,7 @@ extern void DrawCompanyIcon(CompanyID cid, int x, int y);
typedef void ClientList_Action_Proc(const NetworkClientInfo *ci);
static const NWidgetPart _nested_client_list_popup_widgets[] = {
- NWidget(WWT_PANEL, COLOUR_GREY, 0), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_GREY, CLPW_PANEL), EndContainer(),
};
static const WindowDesc _client_list_popup_desc(
@@ -1894,12 +1810,6 @@ static void PopupClientList(ClientID client_id, int x, int y)
new NetworkClientListPopupWindow(&_client_list_popup_desc, x, y, client_id);
}
-
-/** Widget numbers of the client list window. */
-enum ClientListWidgets {
- CLW_PANEL,
-};
-
static const NWidgetPart _nested_client_list_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
@@ -2075,12 +1985,6 @@ uint8 _network_join_waiting; ///< The number of clients waiting in fr
uint32 _network_join_bytes; ///< The number of bytes we already downloaded.
uint32 _network_join_bytes_total; ///< The total number of bytes to download.
-/** Widgets used for the join status window. */
-enum NetworkJoinStatusWidgets {
- NJSW_BACKGROUND, ///< Background
- NJSW_CANCELOK, ///< Cancel/OK button
-};
-
struct NetworkJoinStatusWindow : Window {
NetworkPasswordType password_type;
@@ -2215,17 +2119,6 @@ void ShowNetworkNeedPassword(NetworkPasswordType npt)
ShowQueryString(STR_EMPTY, caption, NETWORK_PASSWORD_LENGTH, w, CS_ALPHANUMERAL, QSF_NONE);
}
-
-/** Enum for NetworkGameWindow, referring to _network_game_window_widgets */
-enum NetworkCompanyPasswordWindowWidgets {
- NCPWW_BACKGROUND, ///< The background of the interface
- NCPWW_LABEL, ///< Label in front of the password field
- NCPWW_PASSWORD, ///< Input field for the password
- NCPWW_SAVE_AS_DEFAULT_PASSWORD, ///< Toggle 'button' for saving the current password as default password
- NCPWW_CANCEL, ///< Close the window without changing anything
- NCPWW_OK, ///< Safe the password etc.
-};
-
struct NetworkCompanyPasswordWindow : public QueryStringBaseWindow {
NetworkCompanyPasswordWindow(const WindowDesc *desc, Window *parent) : QueryStringBaseWindow(lengthof(_settings_client.network.default_company_pass))
{