diff options
author | yexo <yexo@openttd.org> | 2009-03-26 21:12:14 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2009-03-26 21:12:14 +0000 |
commit | 84b632d60fca786206f50b76384c53b3833b8e71 (patch) | |
tree | d25575f1474a50f90ca6ece1c3d1824d041e589a /src/rail_gui.cpp | |
parent | d17083e429c5fb70c9ff7f5c7204e31a4c3483e9 (diff) | |
download | openttd-84b632d60fca786206f50b76384c53b3833b8e71.tar.xz |
(svn r15862) -Codechange: New widgets for the road, rail and ship depot guis.
Diffstat (limited to 'src/rail_gui.cpp')
-rw-r--r-- | src/rail_gui.cpp | 64 |
1 files changed, 46 insertions, 18 deletions
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 45376ff09..770f6f955 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -1525,20 +1525,18 @@ static void ShowSignalBuilder(Window *parent) new BuildSignalWindow(&_signal_builder_desc, parent); } -struct BuildRailDepotWindow : public PickerWindowBase { -private: - /** Enum referring to the widgets of the build rail depot window */ - enum BuildRailDepotWidgets { - BRDW_CLOSEBOX = 0, - BRDW_CAPTION, - BRDW_BACKGROUND, - BRDW_DEPOT_NE, - BRDW_DEPOT_SE, - BRDW_DEPOT_SW, - BRDW_DEPOT_NW, - }; +/** Enum referring to the widgets of the build rail depot window */ +enum BuildRailDepotWidgets { + BRDW_CLOSEBOX = 0, + BRDW_CAPTION, + BRDW_BACKGROUND, + BRDW_DEPOT_NE, + BRDW_DEPOT_SE, + BRDW_DEPOT_SW, + BRDW_DEPOT_NW, +}; -public: +struct BuildRailDepotWindow : public PickerWindowBase { BuildRailDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent) { this->LowerWidget(_build_depot_direction + BRDW_DEPOT_NE); @@ -1549,10 +1547,10 @@ public: { this->DrawWidgets(); - DrawTrainDepotSprite(70, 17, DIAGDIR_NE, _cur_railtype); - DrawTrainDepotSprite(70, 69, DIAGDIR_SE, _cur_railtype); - DrawTrainDepotSprite( 2, 69, DIAGDIR_SW, _cur_railtype); - DrawTrainDepotSprite( 2, 17, DIAGDIR_NW, _cur_railtype); + DrawTrainDepotSprite(this->widget[BRDW_DEPOT_NE].left - 1, this->widget[BRDW_DEPOT_NE].top, DIAGDIR_NE, _cur_railtype); + DrawTrainDepotSprite(this->widget[BRDW_DEPOT_SE].left - 1, this->widget[BRDW_DEPOT_SE].top, DIAGDIR_SE, _cur_railtype); + DrawTrainDepotSprite(this->widget[BRDW_DEPOT_SW].left - 1, this->widget[BRDW_DEPOT_SW].top, DIAGDIR_SW, _cur_railtype); + DrawTrainDepotSprite(this->widget[BRDW_DEPOT_NW].left - 1, this->widget[BRDW_DEPOT_NW].top, DIAGDIR_NW, _cur_railtype); } virtual void OnClick(Point pt, int widget) @@ -1584,11 +1582,41 @@ static const Widget _build_depot_widgets[] = { { WIDGETS_END}, }; +static const NWidgetPart _nested_build_depot_widgets[] = { + NWidget(NWID_HORIZONTAL), + NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN, BRDW_CLOSEBOX), + NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, BRDW_CAPTION), SetMinimalSize(129, 14), SetDataTip(STR_1014_TRAIN_DEPOT_ORIENTATION, STR_018C_WINDOW_TITLE_DRAG_THIS), + EndContainer(), + NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BRDW_BACKGROUND), + NWidget(NWID_SPACER), SetMinimalSize(0, 3), + NWidget(NWID_HORIZONTAL_LTR), + NWidget(NWID_SPACER), SetMinimalSize(3, 0), + NWidget(NWID_VERTICAL), + NWidget(WWT_PANEL, COLOUR_GREY, BRDW_DEPOT_NW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0, 2), + NWidget(WWT_PANEL, COLOUR_GREY, BRDW_DEPOT_SW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO), + EndContainer(), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(2, 0), + NWidget(NWID_VERTICAL), + NWidget(WWT_PANEL, COLOUR_GREY, BRDW_DEPOT_NE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0, 2), + NWidget(WWT_PANEL, COLOUR_GREY, BRDW_DEPOT_SE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO), + EndContainer(), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(3, 0), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0, 3), + EndContainer(), +}; + static const WindowDesc _build_depot_desc( WDP_AUTO, WDP_AUTO, 140, 122, 140, 122, WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION, - _build_depot_widgets + _build_depot_widgets, _nested_build_depot_widgets, lengthof(_nested_build_depot_widgets) ); static void ShowBuildTrainDepotPicker(Window *parent) |