diff --git a/projects/openttd_vs100.vcxproj b/projects/openttd_vs100.vcxproj
--- a/projects/openttd_vs100.vcxproj
+++ b/projects/openttd_vs100.vcxproj
@@ -687,9 +687,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/projects/openttd_vs100.vcxproj.filters b/projects/openttd_vs100.vcxproj.filters
--- a/projects/openttd_vs100.vcxproj.filters
+++ b/projects/openttd_vs100.vcxproj.filters
@@ -1284,6 +1284,42 @@
GUI Source Code
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
Widgets
@@ -1293,6 +1329,123 @@
Widgets
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
+
+ Widgets
+
Command handlers
diff --git a/projects/openttd_vs80.vcproj b/projects/openttd_vs80.vcproj
--- a/projects/openttd_vs80.vcproj
+++ b/projects/openttd_vs80.vcproj
@@ -2035,6 +2035,54 @@
Name="Widgets"
>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2046,6 +2094,162 @@
RelativePath=".\..\src\widgets\dropdown_type.h"
>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2043,6 +2091,162 @@
RelativePath=".\..\src\widgets\dropdown_type.h"
>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-/** Enum referring to the widgets of the AI list window */
-enum AIListWindowWidgets {
- AIL_WIDGET_LIST, ///< The matrix with all available AIs
- AIL_WIDGET_SCROLLBAR, ///< Scrollbar next to the AI list
- AIL_WIDGET_INFO_BG, ///< Panel to draw some AI information on
- AIL_WIDGET_ACCEPT, ///< Accept button
- AIL_WIDGET_CANCEL, ///< Cancel button
-};
-
/**
* Window that let you choose an available AI.
*/
@@ -254,14 +247,6 @@ static void ShowAIListWindow(CompanyID s
new AIListWindow(&_ai_list_desc, slot);
}
-/** Enum referring to the widgets of the AI settings window */
-enum AISettingsWindowWidgets {
- AIS_WIDGET_BACKGROUND, ///< Panel to draw the settings on
- AIS_WIDGET_SCROLLBAR, ///< Scrollbar to scroll through all settings
- AIS_WIDGET_ACCEPT, ///< Accept button
- AIS_WIDGET_RESET, ///< Reset button
-};
-
/**
* Window for settings the parameters of an AI.
*/
@@ -541,22 +526,6 @@ static void ShowAISettingsWindow(Company
new AISettingsWindow(&_ai_settings_desc, slot);
}
-/** Enum referring to the widgets of the AI config window */
-enum AIConfigWindowWidgets {
- AIC_WIDGET_BACKGROUND, ///< Window background
- AIC_WIDGET_DECREASE, ///< Decrease the number of AIs
- AIC_WIDGET_INCREASE, ///< Increase the number of AIs
- AIC_WIDGET_NUMBER, ///< Number of AIs
- AIC_WIDGET_LIST, ///< List with currently selected AIs
- AIC_WIDGET_SCROLLBAR, ///< Scrollbar to scroll through the selected AIs
- AIC_WIDGET_MOVE_UP, ///< Move up button
- AIC_WIDGET_MOVE_DOWN, ///< Move down button
- AIC_WIDGET_CHANGE, ///< Select another AI button
- AIC_WIDGET_CONFIGURE, ///< Change AI settings button
- AIC_WIDGET_CLOSE, ///< Close window button
- AIC_WIDGET_CONTENT_DOWNLOAD, ///< Download content button
-};
-
/** Widgets for the configure AI window. */
static const NWidgetPart _nested_ai_config_widgets[] = {
NWidget(NWID_HORIZONTAL),
@@ -781,23 +750,6 @@ void ShowAIConfigWindow()
new AIConfigWindow();
}
-/** Enum referring to the widgets of the AI debug window */
-enum AIDebugWindowWidgets {
- AID_WIDGET_VIEW,
- AID_WIDGET_NAME_TEXT,
- AID_WIDGET_SETTINGS,
- AID_WIDGET_RELOAD_TOGGLE,
- AID_WIDGET_LOG_PANEL,
- AID_WIDGET_SCROLLBAR,
- AID_WIDGET_COMPANY_BUTTON_START,
- AID_WIDGET_COMPANY_BUTTON_END = AID_WIDGET_COMPANY_BUTTON_START + MAX_COMPANIES - 1,
- AID_BREAK_STRING_WIDGETS,
- AID_WIDGET_BREAK_STR_ON_OFF_BTN,
- AID_WIDGET_BREAK_STR_EDIT_BOX,
- AID_WIDGET_MATCH_CASE_BTN,
- AID_WIDGET_CONTINUE_BTN,
-};
-
/**
* Window with everything an AI prints via ScriptLog.
*/
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -29,6 +29,8 @@
#include "vehicle_func.h"
#include "sprite.h"
+#include "widgets/airport_widget.h"
+
#include "table/strings.h"
static AirportClassID _selected_airport_class; ///< the currently visible airport class
@@ -63,13 +65,6 @@ static void PlaceAirport(TileIndex tile)
ShowSelectStationIfNeeded(cmdcont, TileArea(tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE));
}
-/** Widget number of the airport build window. */
-enum AirportToolbarWidgets {
- ATW_AIRPORT,
- ATW_DEMOLISH,
-};
-
-
/** Airport build toolbar window handler. */
struct BuildAirToolbarWindow : Window {
int last_user_action; // Last started user action.
@@ -204,22 +199,6 @@ EventState AirportToolbarGlobalHotkeys(u
return w->OnKeyPress(key, keycode);
}
-/** Airport widgets in the airport picker window. */
-enum AirportPickerWidgets {
- BAIRW_CLASS_DROPDOWN,
- BAIRW_AIRPORT_LIST,
- BAIRW_SCROLLBAR,
- BAIRW_LAYOUT_NUM,
- BAIRW_LAYOUT_DECREASE,
- BAIRW_LAYOUT_INCREASE,
- BAIRW_AIRPORT_SPRITE,
- BAIRW_EXTRA_TEXT,
- BAIRW_BOTTOMPANEL,
- BAIRW_COVERAGE_LABEL,
- BAIRW_BTN_DONTHILIGHT,
- BAIRW_BTN_DOHILIGHT,
-};
-
class BuildAirportWindow : public PickerWindowBase {
SpriteID preview_sprite; ///< Cached airport preview sprite.
int line_height;
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -26,36 +26,13 @@
#include "core/geometry_func.hpp"
#include "rail_gui.h"
+#include "widgets/autoreplace_widget.h"
+
#include "table/strings.h"
uint GetEngineListHeight(VehicleType type);
void DrawEngineList(VehicleType type, int x, int r, int y, const GUIEngineList *eng_list, uint16 min, uint16 max, EngineID selected_id, bool show_count, GroupID selected_group);
-/** Widget numbers of the autoreplace GUI. */
-enum ReplaceVehicleWindowWidgets {
- RVW_WIDGET_CAPTION,
-
- /* Left and right matrix + details. */
- RVW_WIDGET_LEFT_MATRIX,
- RVW_WIDGET_LEFT_SCROLLBAR,
- RVW_WIDGET_RIGHT_MATRIX,
- RVW_WIDGET_RIGHT_SCROLLBAR,
- RVW_WIDGET_LEFT_DETAILS,
- RVW_WIDGET_RIGHT_DETAILS,
-
- /* Button row. */
- RVW_WIDGET_START_REPLACE,
- RVW_WIDGET_INFO_TAB,
- RVW_WIDGET_STOP_REPLACE,
-
- /* Train only widgets. */
- RVW_WIDGET_TRAIN_ENGINEWAGON_TOGGLE,
- RVW_WIDGET_TRAIN_FLUFF_LEFT,
- RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN,
- RVW_WIDGET_TRAIN_FLUFF_RIGHT,
- RVW_WIDGET_TRAIN_WAGONREMOVE_TOGGLE,
-};
-
static int CDECL EngineNumberSorter(const EngineID *a, const EngineID *b)
{
int r = ListPositionOfEngine(*a) - ListPositionOfEngine(*b);
diff --git a/src/bootstrap_gui.cpp b/src/bootstrap_gui.cpp
--- a/src/bootstrap_gui.cpp
+++ b/src/bootstrap_gui.cpp
@@ -27,6 +27,8 @@
#include "window_func.h"
#include "window_gui.h"
+#include "widgets/bootstrap_widget.h"
+
#include "table/strings.h"
/** Widgets for the background window to prevent smearing. */
@@ -100,13 +102,6 @@ public:
}
};
-/** Widgets in the query window. */
-enum BootstrapAskForDownloadWidgets {
- BAFDW_QUESTION, ///< The question whether to download.
- BAFDW_YES, ///< An affirmative answer to the question.
- BAFDW_NO, ///< An negative answer to the question.
-};
-
/** The widgets for the query. It has no close box as that sprite does not exist yet. */
static const NWidgetPart _bootstrap_query_widgets[] = {
NWidget(NWID_HORIZONTAL),
diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp
--- a/src/bridge_gui.cpp
+++ b/src/bridge_gui.cpp
@@ -25,6 +25,8 @@
#include "tunnelbridge_map.h"
#include "road_gui.h"
+#include "widgets/bridge_widget.h"
+
#include "table/strings.h"
/** The type of the last built rail bridge */
@@ -70,15 +72,6 @@ void CcBuildBridge(const CommandCost &re
}
}
-/** Names of the widgets of the build-bridge selection window. */
-enum BuildBridgeSelectionWidgets {
- BBSW_CAPTION,
- BBSW_DROPDOWN_ORDER,
- BBSW_DROPDOWN_CRITERIA,
- BBSW_BRIDGE_LIST,
- BBSW_SCROLLBAR,
-};
-
/** Window class for handling the bridge-build GUI. */
class BuildBridgeWindow : public Window {
private:
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -31,6 +31,8 @@
#include "cargotype.h"
#include "core/geometry_func.hpp"
+#include "widgets/build_vehicle_widget.h"
+
#include "table/strings.h"
/**
@@ -43,20 +45,6 @@ uint GetEngineListHeight(VehicleType typ
return max(FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM, GetVehicleHeight(type));
}
-enum BuildVehicleWidgets {
- BUILD_VEHICLE_WIDGET_CAPTION,
- BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING,
- BUILD_VEHICLE_WIDGET_SORT_DROPDOWN,
- BUILD_VEHICLE_WIDGET_CARGO_FILTER_DROPDOWN,
- BUILD_VEHICLE_WIDGET_LIST,
- BUILD_VEHICLE_WIDGET_SCROLLBAR,
- BUILD_VEHICLE_WIDGET_PANEL,
- BUILD_VEHICLE_WIDGET_BUILD,
- BUILD_VEHICLE_WIDGET_BUILD_SEL,
- BUILD_VEHICLE_WIDGET_RENAME,
- BUILD_VEHICLE_WIDGET_END
-};
-
static const NWidgetPart _nested_build_vehicle_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp
--- a/src/cheat_gui.cpp
+++ b/src/cheat_gui.cpp
@@ -27,6 +27,8 @@
#include "company_gui.h"
#include "gamelog.h"
+#include "widgets/cheat_widget.h"
+
#include "table/strings.h"
#include "table/sprites.h"
@@ -177,11 +179,6 @@ static const CheatEntry _cheats_ui[] = {
assert_compile(CHT_NUM_CHEATS == lengthof(_cheats_ui));
-/** Names of the cheat window widgets. */
-enum CheatWidgets {
- CW_PANEL,
-};
-
/** Widget definitions of the cheat GUI. */
static const NWidgetPart _nested_cheat_widgets[] = {
NWidget(NWID_HORIZONTAL),
diff --git a/src/company_gui.cpp b/src/company_gui.cpp
--- a/src/company_gui.cpp
+++ b/src/company_gui.cpp
@@ -39,6 +39,8 @@
#include "water.h"
#include "station_func.h"
+#include "widgets/company_widget.h"
+
#include "table/strings.h"
/** Company GUI constants. */
@@ -126,29 +128,6 @@ static const ExpensesList _expenses_list
ExpensesList(_expenses_list_2, lengthof(_expenses_list_2), 3),
};
-/** Widgets of the company finances windows. */
-enum CompanyFinancesWindowWidgets {
- CFW_CAPTION, ///< Caption of the window
- CFW_TOGGLE_SIZE, ///< Toggle windows size
- CFW_SEL_PANEL, ///< Select panel or nothing
- CFW_EXPS_CATEGORY, ///< Column for expenses category strings
- CFW_EXPS_PRICE1, ///< Column for year Y-2 expenses
- CFW_EXPS_PRICE2, ///< Column for year Y-1 expenses
- CFW_EXPS_PRICE3, ///< Column for year Y expenses
- CFW_TOTAL_PANEL, ///< Panel for totals
- CFW_SEL_MAXLOAN, ///< Selection of maxloan column
- CFW_BALANCE_VALUE, ///< Bank balance value
- CFW_LOAN_VALUE, ///< Loan
- CFW_LOAN_LINE, ///< Line for summing bank balance and loan
- CFW_TOTAL_VALUE, ///< Total
- CFW_MAXLOAN_GAP, ///< Gap above max loan widget
- CFW_MAXLOAN_VALUE, ///< Max loan widget
- CFW_SEL_BUTTONS, ///< Selection of buttons
- CFW_INCREASE_LOAN, ///< Increase loan
- CFW_REPAY_LOAN, ///< Decrease loan
- CFW_INFRASTRUCTURE,///< View company infrastructure
-};
-
/**
* Draw the expenses categories.
* @param r Available space for drawing.
@@ -567,20 +546,6 @@ public:
}
};
-/** Widgets of the select company livery window. */
-enum SelectCompanyLiveryWindowWidgets {
- SCLW_WIDGET_CAPTION,
- SCLW_WIDGET_CLASS_GENERAL,
- SCLW_WIDGET_CLASS_RAIL,
- SCLW_WIDGET_CLASS_ROAD,
- SCLW_WIDGET_CLASS_SHIP,
- SCLW_WIDGET_CLASS_AIRCRAFT,
- SCLW_WIDGET_SPACER_DROPDOWN,
- SCLW_WIDGET_PRI_COL_DROPDOWN,
- SCLW_WIDGET_SEC_COL_DROPDOWN,
- SCLW_WIDGET_MATRIX,
-};
-
/** Company livery colour scheme window. */
struct SelectCompanyLiveryWindow : public Window {
private:
@@ -930,78 +895,6 @@ void DrawCompanyManagerFace(CompanyManag
}
}
-/**
- * Names of the widgets. Keep them in the same order as in the widget array.
- * Do not change the order of the widgets from SCMFW_WIDGET_HAS_MOUSTACHE_EARRING to SCMFW_WIDGET_GLASSES_R,
- * this order is needed for the WE_CLICK event of DrawFaceStringLabel().
- */
-enum SelectCompanyManagerFaceWidgets {
- SCMFW_WIDGET_CAPTION,
- SCMFW_WIDGET_TOGGLE_LARGE_SMALL,
- SCMFW_WIDGET_SELECT_FACE,
- SCMFW_WIDGET_CANCEL,
- SCMFW_WIDGET_ACCEPT,
- SCMFW_WIDGET_MALE, ///< Male button in the simple view.
- SCMFW_WIDGET_FEMALE, ///< Female button in the simple view.
- SCMFW_WIDGET_MALE2, ///< Male button in the advanced view.
- SCMFW_WIDGET_FEMALE2, ///< Female button in the advanced view.
- SCMFW_WIDGET_SEL_LOADSAVE, ///< Selection to display the load/save/number buttons in the advanced view.
- SCMFW_WIDGET_SEL_MALEFEMALE, ///< Selection to display the male/female buttons in the simple view.
- SCMFW_WIDGET_SEL_PARTS, ///< Selection to display the buttons for setting each part of the face in the advanced view.
- SCMFW_WIDGET_RANDOM_NEW_FACE,
- SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON,
- SCMFM_WIDGET_FACE,
- SCMFW_WIDGET_LOAD,
- SCMFW_WIDGET_FACECODE,
- SCMFW_WIDGET_SAVE,
- SCMFW_WIDGET_HAS_MOUSTACHE_EARRING_TEXT,
- SCMFW_WIDGET_TIE_EARRING_TEXT,
- SCMFW_WIDGET_LIPS_MOUSTACHE_TEXT,
- SCMFW_WIDGET_HAS_GLASSES_TEXT,
- SCMFW_WIDGET_HAIR_TEXT,
- SCMFW_WIDGET_EYEBROWS_TEXT,
- SCMFW_WIDGET_EYECOLOUR_TEXT,
- SCMFW_WIDGET_GLASSES_TEXT,
- SCMFW_WIDGET_NOSE_TEXT,
- SCMFW_WIDGET_CHIN_TEXT,
- SCMFW_WIDGET_JACKET_TEXT,
- SCMFW_WIDGET_COLLAR_TEXT,
- SCMFW_WIDGET_ETHNICITY_EUR,
- SCMFW_WIDGET_ETHNICITY_AFR,
- SCMFW_WIDGET_HAS_MOUSTACHE_EARRING,
- SCMFW_WIDGET_HAS_GLASSES,
- SCMFW_WIDGET_EYECOLOUR_L,
- SCMFW_WIDGET_EYECOLOUR,
- SCMFW_WIDGET_EYECOLOUR_R,
- SCMFW_WIDGET_CHIN_L,
- SCMFW_WIDGET_CHIN,
- SCMFW_WIDGET_CHIN_R,
- SCMFW_WIDGET_EYEBROWS_L,
- SCMFW_WIDGET_EYEBROWS,
- SCMFW_WIDGET_EYEBROWS_R,
- SCMFW_WIDGET_LIPS_MOUSTACHE_L,
- SCMFW_WIDGET_LIPS_MOUSTACHE,
- SCMFW_WIDGET_LIPS_MOUSTACHE_R,
- SCMFW_WIDGET_NOSE_L,
- SCMFW_WIDGET_NOSE,
- SCMFW_WIDGET_NOSE_R,
- SCMFW_WIDGET_HAIR_L,
- SCMFW_WIDGET_HAIR,
- SCMFW_WIDGET_HAIR_R,
- SCMFW_WIDGET_JACKET_L,
- SCMFW_WIDGET_JACKET,
- SCMFW_WIDGET_JACKET_R,
- SCMFW_WIDGET_COLLAR_L,
- SCMFW_WIDGET_COLLAR,
- SCMFW_WIDGET_COLLAR_R,
- SCMFW_WIDGET_TIE_EARRING_L,
- SCMFW_WIDGET_TIE_EARRING,
- SCMFW_WIDGET_TIE_EARRING_R,
- SCMFW_WIDGET_GLASSES_L,
- SCMFW_WIDGET_GLASSES,
- SCMFW_WIDGET_GLASSES_R,
-};
-
/** Nested widget description for the company manager face selection dialog */
static const NWidgetPart _nested_select_company_manager_face_widgets[] = {
NWidget(NWID_HORIZONTAL),
@@ -1616,22 +1509,6 @@ static void DoSelectCompanyManagerFace(W
new SelectCompanyManagerFaceWindow(&_select_company_manager_face_desc, parent);
}
-
-/** Names of the widgets of the #CompanyInfrastructureWindow. */
-enum CompanyInfrastructureWindowWidgets {
- CIW_WIDGET_CAPTION,
- CIW_WIDGET_RAIL_DESC,
- CIW_WIDGET_RAIL_COUNT,
- CIW_WIDGET_ROAD_DESC,
- CIW_WIDGET_ROAD_COUNT,
- CIW_WIDGET_WATER_DESC,
- CIW_WIDGET_WATER_COUNT,
- CIW_WIDGET_STATION_DESC,
- CIW_WIDGET_STATION_COUNT,
- CIW_WIDGET_TOTAL_DESC,
- CIW_WIDGET_TOTAL,
-};
-
static const NWidgetPart _nested_company_infrastructure_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
@@ -1976,49 +1853,6 @@ static void ShowCompanyInfrastructure(Co
AllocateWindowDescFront(&_company_infrastructure_desc, company);
}
-
-/** Names of the widgets of the #CompanyWindow. Keep them in the same order as in the widget array */
-enum CompanyWindowWidgets {
- CW_WIDGET_CAPTION,
-
- CW_WIDGET_FACE,
- CW_WIDGET_FACE_TITLE,
-
- CW_WIDGET_DESC_INAUGURATION,
- CW_WIDGET_DESC_COLOUR_SCHEME,
- CW_WIDGET_DESC_COLOUR_SCHEME_EXAMPLE,
- CW_WIDGET_DESC_VEHICLE,
- CW_WIDGET_DESC_VEHICLE_COUNTS,
- CW_WIDGET_DESC_COMPANY_VALUE,
- CW_WIDGET_DESC_INFRASTRUCTURE,
- CW_WIDGET_DESC_INFRASTRUCTURE_COUNTS,
-
- CW_WIDGET_SELECT_DESC_OWNERS,
- CW_WIDGET_DESC_OWNERS,
-
- CW_WIDGET_SELECT_BUTTONS, ///< Selection widget for the button bar.
- CW_WIDGET_NEW_FACE,
- CW_WIDGET_COLOUR_SCHEME,
- CW_WIDGET_PRESIDENT_NAME,
- CW_WIDGET_COMPANY_NAME,
- CW_WIDGET_BUY_SHARE,
- CW_WIDGET_SELL_SHARE,
-
- CW_WIDGET_SELECT_VIEW_BUILD_HQ,
- CW_WIDGET_VIEW_HQ,
- CW_WIDGET_BUILD_HQ,
-
- CW_WIDGET_SELECT_RELOCATE, ///< View/hide the 'Relocate HQ' button.
- CW_WIDGET_RELOCATE_HQ,
-
- CW_WIDGET_VIEW_INFRASTRUCTURE,
-
- CW_WIDGET_HAS_PASSWORD, ///< Draw a lock when the company has a password
- CW_WIDGET_SELECT_MULTIPLAYER, ///< Multiplayer selection panel.
- CW_WIDGET_COMPANY_PASSWORD,
- CW_WIDGET_COMPANY_JOIN,
-};
-
static const NWidgetPart _nested_company_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
@@ -2595,16 +2429,6 @@ void DirtyCompanyInfrastructureWindows(C
SetWindowDirty(WC_COMPANY_INFRASTRUCTURE, company);
}
-
-/** widget numbers of the #BuyCompanyWindow. */
-enum BuyCompanyWidgets {
- BCW_CAPTION,
- BCW_FACE,
- BCW_QUESTION,
- BCW_NO,
- BCW_YES,
-};
-
struct BuyCompanyWindow : Window {
BuyCompanyWindow(const WindowDesc *desc, WindowNumber window_number) : Window()
{
diff --git a/src/console_gui.cpp b/src/console_gui.cpp
--- a/src/console_gui.cpp
+++ b/src/console_gui.cpp
@@ -22,6 +22,8 @@
#include "console_func.h"
#include "rev.h"
+#include "widgets/console_widget.h"
+
#include "table/strings.h"
static const uint ICON_HISTORY_SIZE = 20;
@@ -152,11 +154,6 @@ static inline void IConsoleResetHistoryP
static const char *IConsoleHistoryAdd(const char *cmd);
static void IConsoleHistoryNavigate(int direction);
-/** Widgets of the console window. */
-enum ConsoleWidgets {
- CW_BACKGROUND, ///< Background of the console
-};
-
static const struct NWidgetPart _nested_console_window_widgets[] = {
NWidget(WWT_EMPTY, INVALID_COLOUR, CW_BACKGROUND), SetResize(1, 1),
};
diff --git a/src/date_gui.cpp b/src/date_gui.cpp
--- a/src/date_gui.cpp
+++ b/src/date_gui.cpp
@@ -18,17 +18,10 @@
#include "core/geometry_func.hpp"
#include "widgets/dropdown_type.h"
+#include "widgets/date_widget.h"
#include "table/strings.h"
-/** Widgets used by the date window */
-enum SetDateWidgets {
- SDW_DAY, ///< Dropdown for the day
- SDW_MONTH, ///< Dropdown for the month
- SDW_YEAR, ///< Dropdown for the year
- SDW_SET_DATE, ///< Actually set the date
-};
-
/** Window to select a date graphically by using dropdowns */
struct SetDateWindow : Window {
SetDateCallback *callback; ///< Callback to call when a date has been selected
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -30,6 +30,8 @@
#include "order_backup.h"
#include "zoom_func.h"
+#include "widgets/depot_widget.h"
+
#include "table/strings.h"
/*
@@ -38,28 +40,6 @@
* How long they should be moved and for what window types are controlled in ShowDepotWindow()
*/
-/* Names of the widgets. Keep them in the same order as in the widget array */
-enum DepotWindowWidgets {
- DEPOT_WIDGET_CAPTION,
- DEPOT_WIDGET_SELL,
- DEPOT_WIDGET_SHOW_SELL_CHAIN,
- DEPOT_WIDGET_SELL_CHAIN,
- DEPOT_WIDGET_SELL_ALL,
- DEPOT_WIDGET_AUTOREPLACE,
- DEPOT_WIDGET_MATRIX,
- DEPOT_WIDGET_V_SCROLL, ///< Vertical scrollbar
- DEPOT_WIDGET_SHOW_H_SCROLL,
- DEPOT_WIDGET_H_SCROLL, ///< Horizontal scrollbar
- DEPOT_WIDGET_BUILD,
- DEPOT_WIDGET_CLONE,
- DEPOT_WIDGET_LOCATION,
- DEPOT_WIDGET_SHOW_RENAME,
- DEPOT_WIDGET_RENAME,
- DEPOT_WIDGET_VEHICLE_LIST,
- DEPOT_WIDGET_STOP_ALL,
- DEPOT_WIDGET_START_ALL,
-};
-
/** Nested widget definition for train depots. */
static const NWidgetPart _nested_train_depot_widgets[] = {
NWidget(NWID_HORIZONTAL),
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -29,6 +29,8 @@
#include "hotkeys.h"
#include "bridge.h"
+#include "widgets/dock_widget.h"
+
#include "table/sprites.h"
#include "table/strings.h"
@@ -88,20 +90,6 @@ static TileIndex GetOtherAqueductEnd(Til
return endtile;
}
-/** Enum referring to the widgets of the build dock toolbar */
-enum DockToolbarWidgets {
- DTW_BUTTONS_BEGIN, ///< Begin of clickable buttons (except seperating panel)
- DTW_CANAL = DTW_BUTTONS_BEGIN, ///< Build canal button
- DTW_LOCK, ///< Build lock button
- DTW_DEMOLISH, ///< Demolish aka dynamite button
- DTW_DEPOT, ///< Build depot button
- DTW_STATION, ///< Build station button
- DTW_BUOY, ///< Build buoy button
- DTW_RIVER, ///< Build river button (in scenario editor)
- DTW_BUILD_AQUEDUCT, ///< Build aqueduct button
- DTW_END, ///< End of toolbar widgets
-};
-
/** Toolbar window for constructing water infra structure. */
struct BuildDocksToolbarWindow : Window {
DockToolbarWidgets last_clicked_widget; ///< Contains the last widget that has been clicked on this toolbar.
diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp
--- a/src/engine_gui.cpp
+++ b/src/engine_gui.cpp
@@ -22,6 +22,8 @@
#include "rail.h"
#include "settings_type.h"
+#include "widgets/engine_widget.h"
+
#include "table/strings.h"
/**
@@ -42,13 +44,6 @@ StringID GetEngineCategoryName(EngineID
}
}
-/** Widgets used for the engine preview window */
-enum EnginePreviewWidgets {
- EPW_QUESTION, ///< The container for the question
- EPW_NO, ///< No button
- EPW_YES, ///< Yes button
-};
-
static const NWidgetPart _nested_engine_preview_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE),
diff --git a/src/error_gui.cpp b/src/error_gui.cpp
--- a/src/error_gui.cpp
+++ b/src/error_gui.cpp
@@ -24,16 +24,11 @@
#include "console_func.h"
#include "window_gui.h"
+#include "widgets/error_widget.h"
+
#include "table/strings.h"
#include
-/** Widgets of the error message windows */
-enum ErrorMessageWidgets {
- EMW_CAPTION,
- EMW_FACE,
- EMW_MESSAGE,
-};
-
static const NWidgetPart _nested_errmsg_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_RED),
diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp
--- a/src/fios_gui.cpp
+++ b/src/fios_gui.cpp
@@ -28,6 +28,8 @@
#include "date_func.h"
#include "core/geometry_func.hpp"
+#include "widgets/fios_widget.h"
+
#include "table/sprites.h"
#include "table/strings.h"
@@ -65,27 +67,6 @@ void LoadCheckData::Clear()
ClearGRFConfigList(&this->grfconfig);
}
-
-enum SaveLoadWindowWidgets {
- SLWW_WINDOWTITLE,
- SLWW_SORT_BYNAME,
- SLWW_SORT_BYDATE,
- SLWW_BACKGROUND,
- SLWW_FILE_BACKGROUND,
- SLWW_HOME_BUTTON,
- SLWW_DRIVES_DIRECTORIES_LIST,
- SLWW_SCROLLBAR,
- SLWW_CONTENT_DOWNLOAD, ///< only available for play scenario/heightmap (content download)
- SLWW_SAVE_OSK_TITLE, ///< only available for save operations
- SLWW_DELETE_SELECTION, ///< same in here
- SLWW_SAVE_GAME, ///< not to mention in here too
- SLWW_CONTENT_DOWNLOAD_SEL, ///< Selection 'stack' to 'hide' the content download
- SLWW_DETAILS, ///< Panel with game details
- SLWW_NEWGRF_INFO, ///< Button to open NewGgrf configuration
- SLWW_LOAD_BUTTON, ///< Button to load game/scenario
- SLWW_MISSING_NEWGRFS, ///< Button to find missing NewGRFs online
-};
-
/** Load game/scenario with optional content download */
static const NWidgetPart _nested_load_dialog_widgets[] = {
NWidget(NWID_HORIZONTAL),
diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp
--- a/src/genworld_gui.cpp
+++ b/src/genworld_gui.cpp
@@ -31,18 +31,11 @@
#include "progress.h"
#include "error.h"
+#include "widgets/genworld_widget.h"
+
#include "table/strings.h"
#include "table/sprites.h"
-/**
- * In what 'mode' the GenerateLandscapeWindowProc is.
- */
-enum GenenerateLandscapeWindowMode {
- GLWM_GENERATE, ///< Generate new game
- GLWM_HEIGHTMAP, ///< Load from heightmap
- GLWM_SCENARIO, ///< Generate flat land
-};
-
extern void MakeNewgameSettingsLive();
/**
@@ -56,52 +49,6 @@ void SetNewLandscapeType(byte landscape)
InvalidateWindowClassesData(WC_GENERATE_LANDSCAPE);
}
-/** Widgets of GenerateLandscapeWindow */
-enum GenerateLandscapeWindowWidgets {
- GLAND_TEMPERATE, ///< Button with icon "Temperate"
- GLAND_ARCTIC, ///< Button with icon "Arctic"
- GLAND_TROPICAL, ///< Button with icon "Tropical"
- GLAND_TOYLAND, ///< Button with icon "Toyland"
-
- GLAND_MAPSIZE_X_PULLDOWN, ///< Dropdown 'map X size'
- GLAND_MAPSIZE_Y_PULLDOWN, ///< Dropdown 'map Y size'
-
- GLAND_TOWN_PULLDOWN, ///< Dropdown 'No. of towns'
- GLAND_INDUSTRY_PULLDOWN, ///< Dropdown 'No. of industries'
-
- GLAND_RANDOM_EDITBOX, ///< 'Random seed' editbox
- GLAND_RANDOM_BUTTON, ///< 'Randomise' button
-
- GLAND_GENERATE_BUTTON, ///< 'Generate' button
-
- GLAND_START_DATE_DOWN, ///< Decrease start year
- GLAND_START_DATE_TEXT, ///< Start year
- GLAND_START_DATE_UP, ///< Increase start year
-
- GLAND_SNOW_LEVEL_DOWN, ///< Decrease snow level
- GLAND_SNOW_LEVEL_TEXT, ///< Snow level
- GLAND_SNOW_LEVEL_UP, ///< Increase snow level
-
- GLAND_TREE_PULLDOWN, ///< Dropdown 'Tree algorithm'
- GLAND_LANDSCAPE_PULLDOWN, ///< Dropdown 'Land generator'
-
- GLAND_HEIGHTMAP_NAME_TEXT, ///< Heightmap name
- GLAND_HEIGHTMAP_SIZE_TEXT, ///< Size of heightmap
- GLAND_HEIGHTMAP_ROTATION_PULLDOWN, ///< Dropdown 'Heightmap rotation'
-
- GLAND_TERRAIN_PULLDOWN, ///< Dropdown 'Terrain type'
- GLAND_WATER_PULLDOWN, ///< Dropdown 'Sea level'
- GLAND_RIVER_PULLDOWN, ///< Dropdown 'Rivers'
- GLAND_SMOOTHNESS_PULLDOWN, ///< Dropdown 'Smoothness'
- GLAND_VARIETY_PULLDOWN, ///< Dropdown 'Variety distribution'
-
- GLAND_BORDERS_RANDOM, ///< 'Random'/'Manual' borders
- GLAND_WATER_NW, ///< NW 'Water'/'Freeform'
- GLAND_WATER_NE, ///< NE 'Water'/'Freeform'
- GLAND_WATER_SE, ///< SE 'Water'/'Freeform'
- GLAND_WATER_SW, ///< SW 'Water'/'Freeform'
-};
-
/** Widgets of GenerateLandscapeWindow when generating world */
static const NWidgetPart _nested_generate_landscape_widgets[] = {
NWidget(NWID_HORIZONTAL),
@@ -928,25 +875,6 @@ void StartNewGameWithoutGUI(uint seed)
StartGeneratingLandscape(GLWM_GENERATE);
}
-/** Widget numbers of the create scenario window. */
-enum CreateScenarioWindowWidgets {
- CSCEN_TEMPERATE, ///< Select temperate landscape style.
- CSCEN_ARCTIC, ///< Select arctic landscape style.
- CSCEN_TROPICAL, ///< Select tropical landscape style.
- CSCEN_TOYLAND, ///< Select toy-land landscape style.
- CSCEN_EMPTY_WORLD, ///< Generate an empty flat world.
- CSCEN_RANDOM_WORLD, ///< Generate random land button
- CSCEN_MAPSIZE_X_PULLDOWN, ///< Pull-down arrow for x map size.
- CSCEN_MAPSIZE_Y_PULLDOWN, ///< Pull-down arrow for y map size.
- CSCEN_START_DATE_DOWN, ///< Decrease start year (start earlier).
- CSCEN_START_DATE_TEXT, ///< Clickable start date value.
- CSCEN_START_DATE_UP, ///< Increase start year (start later).
- CSCEN_FLAT_LAND_HEIGHT_DOWN, ///< Decrease flat land height.
- CSCEN_FLAT_LAND_HEIGHT_TEXT, ///< Clickable flat land height value.
- CSCEN_FLAT_LAND_HEIGHT_UP ///< Increase flat land height.
-};
-
-
struct CreateScenarioWindow : public Window
{
uint widget_id;
@@ -1192,12 +1120,6 @@ void ShowCreateScenario()
new CreateScenarioWindow(&_create_scenario_desc, GLWM_SCENARIO);
}
-enum GenerationProgressWindowWidgets {
- GPWW_PROGRESS_BAR,
- GPWW_PROGRESS_TEXT,
- GPWW_ABORT,
-};
-
static const NWidgetPart _nested_generate_progress_widgets[] = {
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GENERATION_WORLD, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_PANEL, COLOUR_GREY),
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -25,6 +25,8 @@
#include "math.h"
#include "currency.h"
+#include "widgets/graph_widget.h"
+
#include "table/strings.h"
#include "table/sprites.h"
@@ -40,14 +42,6 @@ static const uint INVALID_DATAPOINT_POS
/* GRAPH LEGEND */
/****************/
-/** Widget numbers of the graph legend window. */
-enum GraphLegendWidgetNumbers {
- GLW_BACKGROUND,
-
- GLW_FIRST_COMPANY,
- GLW_LAST_COMPANY = GLW_FIRST_COMPANY + MAX_COMPANIES - 1,
-};
-
struct GraphLegendWindow : Window {
GraphLegendWindow(const WindowDesc *desc, WindowNumber window_number) : Window()
{
@@ -168,14 +162,6 @@ struct ValuesInterval {
/* BASE OF GRAPHS */
/*****************/
-/** Widget numbers of a base graph window. */
-enum CompanyValueWidgets {
- BGW_KEY_BUTTON,
- BGW_BACKGROUND,
- BGW_GRAPH,
- BGW_RESIZE,
-};
-
struct BaseGraphWindow : Window {
protected:
static const int GRAPH_MAX_DATASETS = 32;
@@ -706,7 +692,6 @@ static const NWidgetPart _nested_income_
EndContainer(),
};
-
static const WindowDesc _income_graph_desc(
WDP_AUTO, 0, 0,
WC_INCOME_GRAPH, WC_NONE,
@@ -771,15 +756,6 @@ void ShowDeliveredCargoGraph()
/* PERFORMANCE HISTORY */
/***********************/
-/** Widget numbers of the performance history window. */
-enum PerformanceHistoryGraphWidgets {
- PHW_KEY,
- PHW_DETAILED_PERFORMANCE,
- PHW_BACKGROUND,
- PHW_GRAPH,
- PHW_RESIZE,
-};
-
struct PerformanceHistoryGraphWindow : BaseGraphWindow {
PerformanceHistoryGraphWindow(const WindowDesc *desc, WindowNumber window_number) :
BaseGraphWindow(PHW_GRAPH, STR_JUST_COMMA)
@@ -883,18 +859,6 @@ void ShowCompanyValueGraph()
/* PAYMENT RATES */
/*****************/
-/** Widget numbers of the cargo payment rates. */
-enum CargoPaymentRatesWidgets {
- CPW_BACKGROUND,
- CPW_HEADER,
- CPW_GRAPH,
- CPW_RESIZE,
- CPW_FOOTER,
- CPW_ENABLE_CARGOES,
- CPW_DISABLE_CARGOES,
- CPW_CARGO_FIRST,
-};
-
struct PaymentRatesGraphWindow : BaseGraphWindow {
bool first_init; ///< This value is true until the first initialization of the window has finished.
PaymentRatesGraphWindow(const WindowDesc *desc, WindowNumber window_number) :
@@ -1126,11 +1090,6 @@ void ShowCargoPaymentRates()
/* COMPANY LEAGUE TABLE */
/************************/
-/** Widget numbers for the company league window. */
-enum CompanyLeagueWidgets {
- CLW_BACKGROUND,
-};
-
static const StringID _performance_titles[] = {
STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_ENGINEER,
STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_ENGINEER,
@@ -1319,15 +1278,6 @@ void ShowCompanyLeagueTable()
/* PERFORMANCE RATING DETAIL */
/*****************************/
-/** Widget numbers of the performance rating details window. */
-enum PerformanceRatingDetailsWidgets {
- PRW_SCORE_FIRST,
- PRW_SCORE_LAST = PRW_SCORE_FIRST + (SCORE_END - SCORE_BEGIN) - 1,
-
- PRW_COMPANY_FIRST,
- PRW_COMPANY_LAST = PRW_COMPANY_FIRST + MAX_COMPANIES - 1,
-};
-
struct PerformanceRatingDetailWindow : Window {
static CompanyID company;
int timeout;
diff --git a/src/group_gui.cpp b/src/group_gui.cpp
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -27,32 +27,13 @@
#include "core/geometry_func.hpp"
#include "company_base.h"
+#include "widgets/group_widget.h"
+
#include "table/strings.h"
#include "table/sprites.h"
typedef GUIList GUIGroupList;
-enum GroupListWidgets {
- GRP_WIDGET_CAPTION,
- GRP_WIDGET_SORT_BY_ORDER,
- GRP_WIDGET_SORT_BY_DROPDOWN,
- GRP_WIDGET_LIST_VEHICLE,
- GRP_WIDGET_LIST_VEHICLE_SCROLLBAR,
- GRP_WIDGET_AVAILABLE_VEHICLES,
- GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN,
- GRP_WIDGET_STOP_ALL,
- GRP_WIDGET_START_ALL,
-
- GRP_WIDGET_ALL_VEHICLES,
- GRP_WIDGET_DEFAULT_VEHICLES,
- GRP_WIDGET_LIST_GROUP,
- GRP_WIDGET_LIST_GROUP_SCROLLBAR,
- GRP_WIDGET_CREATE_GROUP,
- GRP_WIDGET_DELETE_GROUP,
- GRP_WIDGET_RENAME_GROUP,
- GRP_WIDGET_REPLACE_PROTECTION,
-};
-
static const NWidgetPart _nested_group_widgets[] = {
NWidget(NWID_HORIZONTAL), // Window header
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
diff --git a/src/highscore_gui.cpp b/src/highscore_gui.cpp
--- a/src/highscore_gui.cpp
+++ b/src/highscore_gui.cpp
@@ -23,9 +23,7 @@
#include "strings_func.h"
#include "hotkeys.h"
-enum HighscoreWidgets {
- HSW_BACKGROUND,
-};
+#include "widgets/highscore_widget.h"
struct EndGameHighScoreBaseWindow : Window {
uint32 background_img;
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -37,6 +37,8 @@
#include "genworld.h"
#include "smallmap_gui.h"
+#include "widgets/industry_widget.h"
+
#include "table/strings.h"
#include "table/sprites.h"
@@ -164,15 +166,6 @@ void CcBuildIndustry(const CommandCost &
}
}
-/** Names of the widgets of the dynamic place industries gui */
-enum DynamicPlaceIndustriesWidgets {
- DPIW_MATRIX_WIDGET,
- DPIW_SCROLLBAR,
- DPIW_INFOPANEL,
- DPIW_DISPLAY_WIDGET,
- DPIW_FUND_WIDGET,
-};
-
static const NWidgetPart _nested_build_industry_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
@@ -637,15 +630,6 @@ static inline bool IsProductionAlterable
(is->production_rate[0] != 0 || is->production_rate[1] != 0 || is->IsRawIndustry()));
}
-/** Names of the widgets of the view industry gui */
-enum IndustryViewWidgets {
- IVW_CAPTION,
- IVW_VIEWPORT,
- IVW_INFO,
- IVW_GOTO,
- IVW_DISPLAY,
-};
-
class IndustryViewWindow : public Window
{
/** Modes for changing production */
@@ -1041,14 +1025,6 @@ void ShowIndustryViewWindow(int industry
AllocateWindowDescFront(&_industry_view_desc, industry);
}
-/** Names of the widgets of the industry directory gui */
-enum IndustryDirectoryWidgets {
- IDW_DROPDOWN_ORDER,
- IDW_DROPDOWN_CRITERIA,
- IDW_INDUSTRY_LIST,
- IDW_SCROLLBAR,
-};
-
/** Widget definition of the industry directory gui */
static const NWidgetPart _nested_industry_directory_widgets[] = {
NWidget(NWID_HORIZONTAL),
@@ -1420,14 +1396,6 @@ void ShowIndustryDirectory()
AllocateWindowDescFront(&_industry_directory_desc, 0);
}
-/** Widget numbers of the industry cargoes window, */
-enum IndustryCargoesWidgets {
- ICW_CAPTION,
- ICW_NOTIFY,
- ICW_PANEL,
- ICW_SCROLLBAR,
-};
-
/** Widgets of the industry cargoes window. */
static const NWidgetPart _nested_industry_cargoes_widgets[] = {
NWidget(NWID_HORIZONTAL),
diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp
--- a/src/intro_gui.cpp
+++ b/src/intro_gui.cpp
@@ -27,31 +27,11 @@
#include "language.h"
#include "rev.h"
+#include "widgets/intro_widget.h"
+
#include "table/strings.h"
#include "table/sprites.h"
-enum SelectGameIntroWidgets {
- SGI_GENERATE_GAME,
- SGI_LOAD_GAME,
- SGI_PLAY_SCENARIO,
- SGI_PLAY_HEIGHTMAP,
- SGI_EDIT_SCENARIO,
- SGI_PLAY_NETWORK,
- SGI_TEMPERATE_LANDSCAPE,
- SGI_ARCTIC_LANDSCAPE,
- SGI_TROPIC_LANDSCAPE,
- SGI_TOYLAND_LANDSCAPE,
- SGI_TRANSLATION_SELECTION,
- SGI_TRANSLATION,
- SGI_OPTIONS,
- SGI_DIFFICULTIES,
- SGI_SETTINGS_OPTIONS,
- SGI_GRF_SETTINGS,
- SGI_CONTENT_DOWNLOAD,
- SGI_AI_SETTINGS,
- SGI_EXIT,
-};
-
struct SelectGameWindow : public Window {
SelectGameWindow(const WindowDesc *desc) : Window()
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -34,6 +34,8 @@
#include "saveload/saveload.h"
+#include "widgets/main_widget.h"
+
#include "network/network.h"
#include "network/network_func.h"
#include "network/network_gui.h"
@@ -199,11 +201,6 @@ void ZoomInOrOutToCursorWindow(bool in,
}
}
-/** Widgets of the main window. */
-enum MainWindowWidgets {
- MW_VIEWPORT, ///< Main window viewport.
-};
-
static const struct NWidgetPart _nested_main_window_widgets[] = {
NWidget(NWID_VIEWPORT, INVALID_COLOUR, MW_VIEWPORT), SetResize(1, 1),
};
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -28,6 +28,8 @@
#include "core/geometry_func.hpp"
#include "newgrf_debug.h"
+#include "widgets/misc_widget.h"
+
#include "table/strings.h"
/**
@@ -40,12 +42,6 @@ bool GetClipboardContents(char *buffer,
int _caret_timer;
-
-/** Widgets for the land info window. */
-enum LandInfoWidgets {
- LIW_BACKGROUND, ///< Background to draw on
-};
-
static const NWidgetPart _nested_land_info_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
@@ -356,12 +352,6 @@ void ShowLandInfo(TileIndex tile)
new LandInfoWindow(tile);
}
-/** Widgets for the land info window. */
-enum AboutWidgets {
- AW_SCROLLING_TEXT, ///< The actually scrolling text
- AW_WEBSITE, ///< URL of OpenTTD website
-};
-
static const NWidgetPart _nested_about_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
@@ -613,7 +603,7 @@ void HideFillingPercent(TextEffectID *te
}
static const NWidgetPart _nested_tooltips_widgets[] = {
- NWidget(WWT_PANEL, COLOUR_GREY, 0), SetMinimalSize(200, 32), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_GREY, TTW_BACKGROUND), SetMinimalSize(200, 32), EndContainer(),
};
static const WindowDesc _tool_tips_desc(
@@ -1100,15 +1090,6 @@ void QueryStringBaseWindow::OnOpenOSKWin
ShowOnScreenKeyboard(this, wid, 0, 0);
}
-/** Widget of the string query window. */
-enum QueryStringWidgets {
- QUERY_STR_WIDGET_CAPTION,
- QUERY_STR_WIDGET_TEXT,
- QUERY_STR_WIDGET_DEFAULT,
- QUERY_STR_WIDGET_CANCEL,
- QUERY_STR_WIDGET_OK
-};
-
/** Class for the string query window. */
struct QueryStringWindow : public QueryStringBaseWindow
{
@@ -1268,14 +1249,6 @@ void ShowQueryString(StringID str, Strin
new QueryStringWindow(str, caption, ((flags & QSF_LEN_IN_CHARS) ? MAX_CHAR_LENGTH : 1) * maxsize, maxsize, &_query_string_desc, parent, afilter, flags);
}
-
-enum QueryWidgets {
- QUERY_WIDGET_CAPTION,
- QUERY_WIDGET_TEXT,
- QUERY_WIDGET_NO,
- QUERY_WIDGET_YES
-};
-
/**
* Window used for asking the user a YES/NO question.
*/
diff --git a/src/music_gui.cpp b/src/music_gui.cpp
--- a/src/music_gui.cpp
+++ b/src/music_gui.cpp
@@ -24,6 +24,8 @@
#include "string_func.h"
#include "settings_type.h"
+#include "widgets/music_widget.h"
+
#include "table/strings.h"
#include "table/sprites.h"
@@ -287,19 +289,6 @@ static void SelectPlaylist(byte list)
InvalidateWindowData(WC_MUSIC_WINDOW, 0);
}
-enum MusicTrackSelectionWidgets {
- MTSW_LIST_LEFT,
- MTSW_PLAYLIST,
- MTSW_LIST_RIGHT,
- MTSW_ALL,
- MTSW_OLD,
- MTSW_NEW,
- MTSW_EZY,
- MTSW_CUSTOM1,
- MTSW_CUSTOM2,
- MTSW_CLEAR,
-};
-
struct MusicTrackSelectionWindow : public Window {
MusicTrackSelectionWindow(const WindowDesc *desc, WindowNumber number) : Window()
{
@@ -518,29 +507,6 @@ static void ShowMusicTrackSelection()
AllocateWindowDescFront(&_music_track_selection_desc, 0);
}
-enum MusicWidgets {
- MW_PREV,
- MW_NEXT,
- MW_STOP,
- MW_PLAY,
- MW_SLIDERS,
- MW_MUSIC_VOL,
- MW_EFFECT_VOL,
- MW_BACKGROUND,
- MW_TRACK,
- MW_TRACK_NR,
- MW_TRACK_TITLE,
- MW_TRACK_NAME,
- MW_SHUFFLE,
- MW_PROGRAMME,
- MW_ALL,
- MW_OLD,
- MW_NEW,
- MW_EZY,
- MW_CUSTOM1,
- MW_CUSTOM2,
-};
-
struct MusicWindow : public Window {
static const int slider_width = 3;
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp
--- 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, De
}
}
-/** 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
--- 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
--- 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
--- 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 unsele
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 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 ci
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 cli
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;
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(NetworkPass
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))
{
diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp
--- a/src/newgrf_debug_gui.cpp
+++ b/src/newgrf_debug_gui.cpp
@@ -33,6 +33,8 @@
#include "newgrf_station.h"
#include "newgrf_town.h"
+#include "widgets/newgrf_debug_widget.h"
+
#include "table/strings.h"
/** The sprite picker. */
@@ -274,15 +276,6 @@ static inline const NIHelper *GetFeature
return GetFeature(window_number)->helper;
}
-
-/** Widget numbers of settings window */
-enum NewGRFInspectWidgets {
- NIW_CAPTION, ///< The caption bar ofcourse
- NIW_PARENT, ///< Inspect the parent
- NIW_MAINPANEL, ///< Panel widget containing the actual data
- NIW_SCROLLBAR, ///< Scrollbar
-};
-
/** Window used for inspecting NewGRFs. */
struct NewGRFInspectWindow : Window {
static const int LEFT_OFFSET = 5; ///< Position of left edge
@@ -643,23 +636,6 @@ GrfSpecFeature GetGrfSpecFeature(Vehicle
/**** Sprite Aligner ****/
-/** Widgets we want (some) influence over. */
-enum SpriteAlignerWidgets {
- SAW_CAPTION, ///< Caption of the window
- SAW_PREVIOUS, ///< Skip to the previous sprite
- SAW_GOTO, ///< Go to a given sprite
- SAW_NEXT, ///< Skip to the next sprite
- SAW_UP, ///< Move the sprite up
- SAW_LEFT, ///< Move the sprite to the left
- SAW_RIGHT, ///< Move the sprite to the right
- SAW_DOWN, ///< Move the sprite down
- SAW_SPRITE, ///< The actual sprite
- SAW_OFFSETS, ///< The sprite offsets
- SAW_PICKER, ///< Sprite picker
- SAW_LIST, ///< Queried sprite list
- SAW_SCROLLBAR,///< Scrollbar for sprite list
-};
-
/** Window used for aligning sprites. */
struct SpriteAlignerWindow : Window {
SpriteID current_sprite; ///< The currently shown sprite
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -28,6 +28,8 @@
#include "fileio_func.h"
#include "fontcache.h"
+#include "widgets/newgrf_widget.h"
+
#include "table/strings.h"
#include "table/sprites.h"
@@ -137,22 +139,6 @@ static void ShowNewGRFInfo(const GRFConf
}
}
-
-/** Enum referring to the widgets of the NewGRF parameters window */
-enum ShowNewGRFParametersWidgets {
- GRFPAR_WIDGET_SHOW_NUMPAR, ///< #NWID_SELECTION to optionally display #GRFPAR_WIDGET_NUMPAR
- GRFPAR_WIDGET_NUMPAR_DEC, ///< Button to decrease number of parameters
- GRFPAR_WIDGET_NUMPAR_INC, ///< Button to increase number of parameters
- GRFPAR_WIDGET_NUMPAR, ///< Optional number of parameters
- GRFPAR_WIDGET_NUMPAR_TEXT, ///< Text description
- GRFPAR_WIDGET_BACKGROUND, ///< Panel to draw the settings on
- GRFPAR_WIDGET_SCROLLBAR, ///< Scrollbar to scroll through all settings
- GRFPAR_WIDGET_ACCEPT, ///< Accept button
- GRFPAR_WIDGET_RESET, ///< Reset button
- GRFPAR_WIDGET_SHOW_DESCRIPTION, ///< #NWID_SELECTION to optionally display parameter descriptions
- GRFPAR_WIDGET_DESCRIPTION, ///< Multi-line description of a parameter
-};
-
/**
* Window for setting the parameters of a NewGRF.
*/
@@ -466,14 +452,6 @@ void OpenGRFParameterWindow(GRFConfig *c
new NewGRFParametersWindow(&_newgrf_parameters_desc, c);
}
-/** Widgets of the #NewGRFTextfileWindow. */
-enum ShowNewGRFTextfileWidgets {
- GTW_WIDGET_CAPTION, ///< The caption of the window.
- GTW_WIDGET_BACKGROUND, ///< Panel to draw the textfile on.
- GTW_WIDGET_VSCROLLBAR, ///< Vertical scrollbar to scroll through the textfile up-and-down.
- GTW_WIDGET_HSCROLLBAR, ///< Horizontal scrollbar to scroll through the textfile left-to-right.
-};
-
/** Window for displaying the textfile of a NewGRF. */
struct NewGRFTextfileWindow : public Window, MissingGlyphSearcher {
const GRFConfig *grf_config; ///< View the textfile of this GRFConfig.
@@ -699,35 +677,6 @@ public:
static void NewGRFConfirmationCallback(Window *w, bool confirmed);
-/** Names of the manage newgrfs window widgets. */
-enum ShowNewGRFStateWidgets {
- SNGRFS_PRESET_LIST,
- SNGRFS_PRESET_SAVE,
- SNGRFS_PRESET_DELETE,
- SNGRFS_ADD,
- SNGRFS_REMOVE,
- SNGRFS_MOVE_UP,
- SNGRFS_MOVE_DOWN,
- SNGRFS_FILTER,
- SNGRFS_FILE_LIST,
- SNGRFS_SCROLLBAR,
- SNGRFS_AVAIL_LIST,
- SNGRFS_SCROLL2BAR,
- SNGRFS_NEWGRF_INFO_TITLE,
- SNGRFS_NEWGRF_INFO,
- SNGRFS_OPEN_URL,
- SNGRFS_NEWGRF_TEXTFILE,
- SNGRFS_SET_PARAMETERS = SNGRFS_NEWGRF_TEXTFILE + TFT_END,
- SNGRFS_TOGGLE_PALETTE,
- SNGRFS_APPLY_CHANGES,
- SNGRFS_RESCAN_FILES,
- SNGRFS_RESCAN_FILES2,
- SNGRFS_CONTENT_DOWNLOAD,
- SNGRFS_CONTENT_DOWNLOAD2,
- SNGRFS_SHOW_REMOVE, ///< Select active list buttons (0 = normal, 1 = simple layout).
- SNGRFS_SHOW_APPLY, ///< Select display of the buttons below the 'details'.
-};
-
/**
* Window for showing NewGRF files
*/
@@ -1961,12 +1910,6 @@ void ShowNewGRFSettings(bool editable, b
new NewGRFWindow(&_newgrf_desc, editable, show_params, exec_changes, config);
}
-/** The widgets for the scan progress. */
-enum ScanProgressWindowWidgets {
- SPWW_PROGRESS_BAR, ///< Simple progress bar.
- GPWW_PROGRESS_TEXT, ///< Text explaining what is happening.
-};
-
/** Widgets for the progress window. */
static const NWidgetPart _nested_scan_progress_widgets[] = {
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_NEWGRF_SCAN_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
diff --git a/src/news_gui.cpp b/src/news_gui.cpp
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -32,6 +32,8 @@
#include "engine_gui.h"
#include "core/geometry_func.hpp"
+#include "widgets/news_widget.h"
+
#include "table/strings.h"
const NewsItem *_statusbar_news_item = NULL;
@@ -71,27 +73,6 @@ static TileIndex GetReferenceTile(NewsRe
}
}
-/** Widget numbers of the news display windows. */
-enum NewsTypeWidgets {
- NTW_PANEL, ///< The news item background panel.
- NTW_TITLE, ///< Title of the company news.
- NTW_HEADLINE, ///< The news headline.
- NTW_CLOSEBOX, ///< Close the window.
- NTW_DATE, ///< Date of the news item.
- NTW_CAPTION, ///< Title bar of the window. Only used in small news items.
- NTW_INSET, ///< Inset around the viewport in the window. Only used in small news items.
- NTW_VIEWPORT, ///< Viewport in the window.
- NTW_COMPANY_MSG, ///< Message in company news items.
- NTW_MESSAGE, ///< Space for displaying the message. Only used in small news items.
- NTW_MGR_FACE, ///< Face of the manager.
- NTW_MGR_NAME, ///< Name of the manager.
- NTW_VEH_TITLE, ///< Vehicle new title.
- NTW_VEH_BKGND, ///< Dark background of new vehicle news.
- NTW_VEH_NAME, ///< Name of the new vehicle.
- NTW_VEH_SPR, ///< Graphical display of the new vehicle.
- NTW_VEH_INFO, ///< Some technical data of the new vehicle.
-};
-
/* Normal news items. */
static const NWidgetPart _nested_normal_news_widgets[] = {
NWidget(WWT_PANEL, COLOUR_WHITE, NTW_PANEL),
@@ -967,13 +948,6 @@ static void DrawNewsString(uint left, ui
DrawString(left, right, y, buffer2, colour);
}
-/** Widget numbers of the message history window. */
-enum MessageHistoryWidgets {
- MHW_STICKYBOX,
- MHW_BACKGROUND,
- MHW_SCROLLBAR,
-};
-
struct MessageHistoryWindow : Window {
static const int top_spacing; ///< Additional spacing at the top of the #MHW_BACKGROUND widget.
static const int bottom_spacing; ///< Additional spacing at the bottom of the #MHW_BACKGROUND widget.
@@ -1108,32 +1082,6 @@ void ShowMessageHistory()
new MessageHistoryWindow(&_message_history_desc);
}
-/** Constants in the message options window. */
-enum MessageOptionsSpace {
- MOS_WIDG_PER_SETTING = 4, ///< Number of widgets needed for each news category, starting at widget #WIDGET_NEWSOPT_START_OPTION.
-
- MOS_LEFT_EDGE = 6, ///< Number of pixels between left edge of the window and the options buttons column.
- MOS_COLUMN_SPACING = 4, ///< Number of pixels between the buttons and the description columns.
- MOS_RIGHT_EDGE = 6, ///< Number of pixels between right edge of the window and the options descriptions column.
- MOS_BUTTON_SPACE = 10, ///< Additional space in the button with the option value (for better looks).
-
- MOS_ABOVE_GLOBAL_SETTINGS = 6, ///< Number of vertical pixels between the categories and the global options.
- MOS_BOTTOM_EDGE = 6, ///< Number of pixels between bottom edge of the window and bottom of the global options.
-};
-
-/** Message options widget numbers. */
-enum MessageOptionWidgets {
- WIDGET_NEWSOPT_BACKGROUND, ///< Background widget.
- WIDGET_NEWSOPT_LABEL, ///< Top label.
- WIDGET_NEWSOPT_DROP_SUMMARY, ///< Dropdown that adjusts at once the level for all settings.
- WIDGET_NEWSOPT_LABEL_SUMMARY, ///< Label of the summary drop down.
- WIDGET_NEWSOPT_SOUNDTICKER, ///< Button for (de)activating sound on events.
- WIDGET_NEWSOPT_SOUNDTICKER_LABEL, ///< Label of the soundticker button,
-
- WIDGET_NEWSOPT_START_OPTION, ///< First widget that is part of a group [<][label][>] [description]
- WIDGET_NEWSOPT_END_OPTION = WIDGET_NEWSOPT_START_OPTION + NT_END * MOS_WIDG_PER_SETTING, ///< First widget after the groups.
-};
-
struct MessageOptionsWindow : Window {
static const StringID message_opt[]; ///< Message report options, 'off', 'summary', or 'full'.
int state; ///< Option value for setting all categories at once.
diff --git a/src/object_gui.cpp b/src/object_gui.cpp
--- a/src/object_gui.cpp
+++ b/src/object_gui.cpp
@@ -19,26 +19,14 @@
#include "viewport_func.h"
#include "window_gui.h"
+#include "widgets/object_widget.h"
+
#include "table/strings.h"
static ObjectClassID _selected_object_class; ///< the currently visible object class
static int _selected_object_index; ///< the index of the selected object in the current class or -1
static uint8 _selected_object_view; ///< the view of the selected object
-/** Object widgets in the object picker window. */
-enum BuildObjectWidgets {
- BOW_CLASS_LIST, ///< The list with classes.
- BOW_SCROLLBAR, ///< The scrollbar associated with the list.
- BOW_OBJECT_MATRIX, ///< The matrix with preview sprites.
- BOW_OBJECT_SPRITE, ///< A preview sprite of the object.
- BOW_OBJECT_SIZE, ///< The size of an object.
- BOW_INFO, ///< Other information about the object (from the NewGRF).
-
- BOW_SELECT_MATRIX, ///< Selection preview matrix of objects of a given class.
- BOW_SELECT_IMAGE, ///< Preview image in the #BOW_SELECT_MATRIX.
- BOW_SELECT_SCROLL, ///< Scrollbar next to the #BOW_SELECT_MATRIX.
-};
-
/** The window used for building objects. */
class BuildObjectWindow : public PickerWindowBase {
static const int OBJECT_MARGIN = 4; ///< The margin (in pixels) around an object.
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -31,36 +31,9 @@
#include "hotkeys.h"
#include "aircraft.h"
-#include "table/strings.h"
+#include "widgets/order_widget.h"
-/** Widget numbers of the order window. */
-enum OrderWindowWidgets {
- ORDER_WIDGET_CAPTION,
- ORDER_WIDGET_TIMETABLE_VIEW,
- ORDER_WIDGET_ORDER_LIST,
- ORDER_WIDGET_SCROLLBAR,
- ORDER_WIDGET_SKIP,
- ORDER_WIDGET_DELETE,
- ORDER_WIDGET_STOP_SHARING,
- ORDER_WIDGET_NON_STOP,
- ORDER_WIDGET_GOTO,
- ORDER_WIDGET_FULL_LOAD,
- ORDER_WIDGET_UNLOAD,
- ORDER_WIDGET_REFIT,
- ORDER_WIDGET_SERVICE,
- ORDER_WIDGET_EMPTY,
- ORDER_WIDGET_REFIT_DROPDOWN,
- ORDER_WIDGET_COND_VARIABLE,
- ORDER_WIDGET_COND_COMPARATOR,
- ORDER_WIDGET_COND_VALUE,
- ORDER_WIDGET_SEL_TOP_LEFT, ///< #NWID_SELECTION widget for left part of the top row of the 'your train' order window.
- ORDER_WIDGET_SEL_TOP_MIDDLE, ///< #NWID_SELECTION widget for middle part of the top row of the 'your train' order window.
- ORDER_WIDGET_SEL_TOP_RIGHT, ///< #NWID_SELECTION widget for right part of the top row of the 'your train' order window.
- ORDER_WIDGET_SEL_TOP_ROW_GROUNDVEHICLE, ///< #NWID_SELECTION widget for the top row of the 'your train' order window.
- ORDER_WIDGET_SEL_TOP_ROW, ///< #NWID_SELECTION widget for the top row of the 'your non-trains' order window.
- ORDER_WIDGET_SEL_BOTTOM_MIDDLE, ///< #NWID_SELECTION widget for the middle part of the bottom row of the 'your train' order window.
- ORDER_WIDGET_SHARED_ORDER_LIST,
-};
+#include "table/strings.h"
/** Order load types that could be given to station orders. */
static const StringID _station_load_types[][5][5] = {
diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp
--- a/src/osk_gui.cpp
+++ b/src/osk_gui.cpp
@@ -17,37 +17,11 @@
#include "gfx_func.h"
#include "querystring_gui.h"
+#include "widgets/osk_widget.h"
+
#include "table/sprites.h"
#include "table/strings.h"
-/** Widget numbers of the on-screen keyboard (OSK) window. */
-enum OskWidgets {
- OSK_WIDGET_CAPTION, ///< Title bar.
- OSK_WIDGET_TEXT, ///< Edit box.
- OSK_WIDGET_CANCEL, ///< Cancel key.
- OSK_WIDGET_OK, ///< Ok key.
- OSK_WIDGET_BACKSPACE, ///< Backspace key.
- OSK_WIDGET_SPECIAL, ///< Special key (at keyborads often used for tab key).
- OSK_WIDGET_CAPS, ///< Capslock key.
- OSK_WIDGET_SHIFT, ///< Shift(lock) key.
- OSK_WIDGET_SPACE, ///< Space bar.
- OSK_WIDGET_LEFT, ///< Cursor left key.
- OSK_WIDGET_RIGHT, ///< Cursor right key.
- OSK_WIDGET_LETTERS, ///< First widget of the 'normal' keys.
-
- OSK_WIDGET_NUMBERS_FIRST = OSK_WIDGET_LETTERS, ///< First widget of the numbers row.
- OSK_WIDGET_NUMBERS_LAST = OSK_WIDGET_NUMBERS_FIRST + 13, ///< Last widget of the numbers row.
-
- OSK_WIDGET_QWERTY_FIRST, ///< First widget of the qwerty row.
- OSK_WIDGET_QWERTY_LAST = OSK_WIDGET_QWERTY_FIRST + 11, ///< Last widget of the qwerty row.
-
- OSK_WIDGET_ASDFG_FIRST, ///< First widget of the asdfg row.
- OSK_WIDGET_ASDFG_LAST = OSK_WIDGET_ASDFG_FIRST + 11, ///< Last widget of the asdfg row.
-
- OSK_WIDGET_ZXCVB_FIRST, ///< First widget of the zxcvb row.
- OSK_WIDGET_ZXCVB_LAST = OSK_WIDGET_ZXCVB_FIRST + 11, ///< Last widget of the zxcvb row.
-};
-
char _keyboard_opt[2][OSK_KEYBOARD_ENTRIES * 4 + 1];
static WChar _keyboard[2][OSK_KEYBOARD_ENTRIES];
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -37,6 +37,8 @@
#include "station_map.h"
#include "tunnelbridge_map.h"
+#include "widgets/rail_widget.h"
+
#include "table/strings.h"
static RailType _cur_railtype; ///< Rail type of the current build-rail toolbar.
@@ -277,27 +279,6 @@ void CcBuildRailTunnel(const CommandCost
}
}
-
-/** Enum referring to the widgets of the build rail toolbar */
-enum RailToolbarWidgets {
- RTW_CAPTION,
- RTW_BUILD_NS,
- RTW_BUILD_X,
- RTW_BUILD_EW,
- RTW_BUILD_Y,
- RTW_AUTORAIL,
- RTW_DEMOLISH,
- RTW_BUILD_DEPOT,
- RTW_BUILD_WAYPOINT,
- RTW_BUILD_STATION,
- RTW_BUILD_SIGNALS,
- RTW_BUILD_BRIDGE,
- RTW_BUILD_TUNNEL,
- RTW_REMOVE,
- RTW_CONVERT_RAIL,
-};
-
-
/**
* Toggles state of the Remove button of Build rail toolbar
* @param w window the button belongs to
@@ -892,48 +873,6 @@ static void HandleStationPlacement(TileI
ShowSelectStationIfNeeded(cmdcont, ta);
}
-/** Enum referring to the widgets of the rail stations window */
-enum BuildRailStationWidgets {
- BRSW_PLATFORM_DIR_X, ///< Button to select '/' view.
- BRSW_PLATFORM_DIR_Y, ///< Button to select '\' view.
-
- BRSW_PLATFORM_NUM_1, ///< Button to select stations with a single platform.
- BRSW_PLATFORM_NUM_2, ///< Button to select stations with 2 platforms.
- BRSW_PLATFORM_NUM_3, ///< Button to select stations with 3 platforms.
- BRSW_PLATFORM_NUM_4, ///< Button to select stations with 4 platforms.
- BRSW_PLATFORM_NUM_5, ///< Button to select stations with 5 platforms.
- BRSW_PLATFORM_NUM_6, ///< Button to select stations with 6 platforms.
- BRSW_PLATFORM_NUM_7, ///< Button to select stations with 7 platforms.
-
- BRSW_PLATFORM_LEN_1, ///< Button to select single tile length station platforms.
- BRSW_PLATFORM_LEN_2, ///< Button to select 2 tiles length station platforms.
- BRSW_PLATFORM_LEN_3, ///< Button to select 3 tiles length station platforms.
- BRSW_PLATFORM_LEN_4, ///< Button to select 4 tiles length station platforms.
- BRSW_PLATFORM_LEN_5, ///< Button to select 5 tiles length station platforms.
- BRSW_PLATFORM_LEN_6, ///< Button to select 6 tiles length station platforms.
- BRSW_PLATFORM_LEN_7, ///< Button to select 7 tiles length station platforms.
-
- BRSW_PLATFORM_DRAG_N_DROP, ///< Button to enable drag and drop type station placement.
-
- BRSW_HIGHLIGHT_OFF, ///< Button for turning coverage highlighting off.
- BRSW_HIGHLIGHT_ON, ///< Button for turning coverage highlighting on.
- BRSW_COVERAGE_TEXTS, ///< Empty space for the coverage texts.
-
- BRSW_MATRIX, ///< Matrix widget displaying the available stations.
- BRSW_IMAGE, ///< Panel used at each cell of the matrix.
- BRSW_MATRIX_SCROLL, ///< Scrollbar of the matrix widget.
-
- BRSW_SHOW_NEWST_ADDITIONS, ///< Selection for newstation class selection list.
- BRSW_SHOW_NEWST_MATRIX, ///< Selection for newstation image matrix.
- BRSW_SHOW_NEWST_RESIZE, ///< Selection for panel and resize at bottom right for newstation.
- BRSW_SHOW_NEWST_TYPE, ///< Display of selected station type.
- BRSW_NEWST_LIST, ///< List with available newstation classes.
- BRSW_NEWST_SCROLL, ///< Scrollbar of the #BRSW_NEWST_LIST.
-
- BRSW_PLATFORM_NUM_BEGIN = BRSW_PLATFORM_NUM_1 - 1,
- BRSW_PLATFORM_LEN_BEGIN = BRSW_PLATFORM_LEN_1 - 1,
-};
-
struct BuildRailStationWindow : public PickerWindowBase {
private:
uint line_height; ///< Height of a single line in the newstation selection matrix (#BRSW_NEWST_LIST widget).
@@ -1498,27 +1437,6 @@ static void ShowStationBuilder(Window *p
new BuildRailStationWindow(&_station_builder_desc, parent, newstations);
}
-/** Enum referring to the widgets of the signal window */
-enum BuildSignalWidgets {
- BSW_SEMAPHORE_NORM,
- BSW_SEMAPHORE_ENTRY,
- BSW_SEMAPHORE_EXIT,
- BSW_SEMAPHORE_COMBO,
- BSW_SEMAPHORE_PBS,
- BSW_SEMAPHORE_PBS_OWAY,
- BSW_ELECTRIC_NORM,
- BSW_ELECTRIC_ENTRY,
- BSW_ELECTRIC_EXIT,
- BSW_ELECTRIC_COMBO,
- BSW_ELECTRIC_PBS,
- BSW_ELECTRIC_PBS_OWAY,
- BSW_CONVERT,
- BSW_DRAG_SIGNALS_DENSITY,
- BSW_DRAG_SIGNALS_DENSITY_LABEL,
- BSW_DRAG_SIGNALS_DENSITY_DECREASE,
- BSW_DRAG_SIGNALS_DENSITY_INCREASE,
-};
-
struct BuildSignalWindow : public PickerWindowBase {
private:
/**
@@ -1702,14 +1620,6 @@ static void ShowSignalBuilder(Window *pa
new BuildSignalWindow(&_signal_builder_desc, parent);
}
-/** Enum referring to the widgets of the build rail depot window */
-enum BuildRailDepotWidgets {
- BRDW_DEPOT_NE,
- BRDW_DEPOT_SE,
- BRDW_DEPOT_SW,
- BRDW_DEPOT_NW,
-};
-
struct BuildRailDepotWindow : public PickerWindowBase {
BuildRailDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(parent)
{
@@ -1784,13 +1694,6 @@ static void ShowBuildTrainDepotPicker(Wi
new BuildRailDepotWindow(&_build_depot_desc, parent);
}
-/** Enum referring to the widgets of the build NewGRF rail waypoint window */
-enum BuildRailWaypointWidgets {
- BRWW_WAYPOINT_MATRIX,
- BRWW_WAYPOINT,
- BRWW_SCROLL,
-};
-
struct BuildRailWaypointWindow : PickerWindowBase {
BuildRailWaypointWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(parent)
{
diff --git a/src/road_gui.cpp b/src/road_gui.cpp
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -29,6 +29,8 @@
#include "hotkeys.h"
#include "road_gui.h"
+#include "widgets/road_widget.h"
+
#include "table/strings.h"
static void ShowRVStationPicker(Window *parent, RoadStopType rs);
@@ -268,24 +270,8 @@ static void PlaceRoad_TruckStation(TileI
}
}
-/** Enum referring to the widgets of the build road toolbar */
-enum RoadToolbarWidgets {
- RTW_ROAD_X,
- RTW_ROAD_Y,
- RTW_AUTOROAD,
- RTW_DEMOLISH,
- RTW_DEPOT,
- RTW_BUS_STATION,
- RTW_TRUCK_STATION,
- RTW_ONE_WAY,
- RTW_BUILD_BRIDGE,
- RTW_BUILD_TUNNEL,
- RTW_REMOVE,
-};
-
typedef void OnButtonClick(Window *w);
-
/**
* Toogles state of the Remove button of Build road toolbar
* @param w window the button belongs to
@@ -852,15 +838,6 @@ EventState RoadToolbarEditorGlobalHotkey
return w->OnKeyPress(key, keycode);
}
-/** Enum referring to the widgets of the build road depot window */
-enum BuildRoadDepotWidgets {
- BRDW_CAPTION,
- BRDW_DEPOT_NE,
- BRDW_DEPOT_SE,
- BRDW_DEPOT_SW,
- BRDW_DEPOT_NW,
-};
-
struct BuildRoadDepotWindow : public PickerWindowBase {
BuildRoadDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(parent)
{
@@ -944,21 +921,6 @@ static void ShowRoadDepotPicker(Window *
new BuildRoadDepotWindow(&_build_road_depot_desc, parent);
}
-/** Enum referring to the widgets of the build road station window */
-enum BuildRoadStationWidgets {
- BRSW_CAPTION,
- BRSW_BACKGROUND,
- BRSW_STATION_NE,
- BRSW_STATION_SE,
- BRSW_STATION_SW,
- BRSW_STATION_NW,
- BRSW_STATION_X,
- BRSW_STATION_Y,
- BRSW_LT_OFF,
- BRSW_LT_ON,
- BRSW_INFO,
-};
-
struct BuildRoadStationWindow : public PickerWindowBase {
BuildRoadStationWindow(const WindowDesc *desc, Window *parent, RoadStopType rs) : PickerWindowBase(parent)
{
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -34,6 +34,8 @@
#include "ai/ai.hpp"
#include "language.h"
+#include "widgets/settings_widget.h"
+
#include "table/sprites.h"
#include "table/strings.h"
#include