summaryrefslogtreecommitdiff
path: root/src/dock_gui.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-07-20 19:45:12 +0000
committeralberth <alberth@openttd.org>2009-07-20 19:45:12 +0000
commite3752f3ef82278a34fe5cce5515e240589465c77 (patch)
tree0081d2dd08a9e34fe94c480fb30e0c68d79a8454 /src/dock_gui.cpp
parent03abe67e88e2363e7d08336effab0795a417056e (diff)
downloadopenttd-e3752f3ef82278a34fe5cce5515e240589465c77.tar.xz
(svn r16893) -Codechange: Ship depot build window uses nested widget tree.
Diffstat (limited to 'src/dock_gui.cpp')
-rw-r--r--src/dock_gui.cpp23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index 0fba14285..e952bbe8a 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -453,21 +453,21 @@ private:
}
public:
- BuildDocksDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
+ BuildDocksDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(parent)
{
+ this->InitNested(desc);
this->LowerWidget(_ship_depot_direction + BDDW_X);
UpdateDocksDirection();
- this->FindWindowPlacementAndResize(desc);
}
virtual void OnPaint()
{
this->DrawWidgets();
- DrawShipDepotSprite(67, 35, 0);
- DrawShipDepotSprite(35, 51, 1);
- DrawShipDepotSprite(135, 35, 2);
- DrawShipDepotSprite(167, 51, 3);
+ DrawShipDepotSprite(this->nested_array[BDDW_X]->pos_x + 64, this->nested_array[BDDW_X]->pos_y + 18, 0);
+ DrawShipDepotSprite(this->nested_array[BDDW_X]->pos_x + 32, this->nested_array[BDDW_X]->pos_y + 34, 1);
+ DrawShipDepotSprite(this->nested_array[BDDW_Y]->pos_x + 32, this->nested_array[BDDW_Y]->pos_y + 18, 2);
+ DrawShipDepotSprite(this->nested_array[BDDW_Y]->pos_x + 64, this->nested_array[BDDW_Y]->pos_y + 34, 3);
}
virtual void OnClick(Point pt, int widget)
@@ -486,15 +486,6 @@ public:
}
};
-static const Widget _build_docks_depot_widgets[] = {
-{ WWT_CLOSEBOX, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW}, // BDDW_CLOSE
-{ WWT_CAPTION, RESIZE_NONE, COLOUR_DARK_GREEN, 11, 203, 0, 13, STR_DEPOT_BUILD_SHIP_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS}, // BDDW_CAPTION
-{ WWT_PANEL, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 203, 14, 85, 0x0, STR_NULL}, // BDDW_BACKGROUND
-{ WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 3, 100, 17, 82, 0x0, STR_DEPOT_BUILD_SHIP_ORIENTATION_TOOLTIP}, // BDDW_X
-{ WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 103, 200, 17, 82, 0x0, STR_DEPOT_BUILD_SHIP_ORIENTATION_TOOLTIP}, // BDDW_Y
-{ WIDGETS_END},
-};
-
static const NWidgetPart _nested_build_docks_depot_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN, BDDW_CLOSE),
@@ -519,7 +510,7 @@ static const WindowDesc _build_docks_depot_desc(
WDP_AUTO, WDP_AUTO, 204, 86, 204, 86,
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION,
- _build_docks_depot_widgets, _nested_build_docks_depot_widgets, lengthof(_nested_build_docks_depot_widgets)
+ NULL, _nested_build_docks_depot_widgets, lengthof(_nested_build_docks_depot_widgets)
);