From 9237d0193187249b8169b660ae5b7cfaa167f04e Mon Sep 17 00:00:00 2001 From: alberth Date: Sun, 31 May 2009 19:51:49 +0000 Subject: (svn r16486) -Codechange [FS#2939]: Added widget numbers to the airport toolbar (based on work by erikjanp) --- src/airport_gui.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 7298ac5e7..539ade2ff 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -43,10 +43,13 @@ static void PlaceAirport(TileIndex tile) ShowSelectStationIfNeeded(cmdcont, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE); } - +/** Widget number of the airport build window. */ enum { - ATW_AIRPORT = 3, - ATW_DEMOLISH = 4 + ATW_CLOSEBOX, + ATW_CAPTION, + ATW_STICKYBOX, + ATW_AIRPORT, + ATW_DEMOLISH }; @@ -86,8 +89,8 @@ struct BuildAirToolbarWindow : Window { virtual void OnClick(Point pt, int widget) { - if (widget - 3 >= 0) { - _build_air_button_proc[widget - 3](this); + if (widget - ATW_AIRPORT >= 0) { + _build_air_button_proc[widget - ATW_AIRPORT](this); } } @@ -139,13 +142,13 @@ static const Widget _air_toolbar_widgets[] = { static const NWidgetPart _nested_air_toolbar_widgets[] = { NWidget(NWID_HORIZONTAL), - NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN, 0), - NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, 1), SetMinimalSize(41, 14), SetDataTip(STR_TOOLBAR_AIRCRAFT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), - NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN, 2), + NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN, ATW_CLOSEBOX), + NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, ATW_CAPTION), SetMinimalSize(41, 14), SetDataTip(STR_TOOLBAR_AIRCRAFT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN, ATW_STICKYBOX), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, 3), SetMinimalSize(42, 22), SetDataTip(SPR_IMG_AIRPORT, STR_TOOLBAR_AIRCRAFT_BUILD_AIRPORT_TOOLTIP), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, 4), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ATW_AIRPORT), SetMinimalSize(42, 22), SetDataTip(SPR_IMG_AIRPORT, STR_TOOLBAR_AIRCRAFT_BUILD_AIRPORT_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ATW_DEMOLISH), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), EndContainer(), }; -- cgit v1.2.3-70-g09d2