(svn r8384) -Codechange: [GUI] instead of writing a resize button function for each window, a global ResizeButtons() is added

This commit is contained in:
bjarni
2007-01-24 02:36:55 +00:00
parent 802d1065b2
commit 4dd0d007b1
5 changed files with 68 additions and 31 deletions

View File

@@ -56,14 +56,6 @@ static const Widget _build_vehicle_widgets[] = {
{ WIDGETS_END},
};
static void ResizeButtons(Window *w)
{
/* Make the buttons in the bottom equal in size */
w->widget[BUILD_VEHICLE_WIDGET_RENAME].right = w->widget[BUILD_VEHICLE_WIDGET_RESIZE].left - 1;
w->widget[BUILD_VEHICLE_WIDGET_RENAME].left = w->widget[BUILD_VEHICLE_WIDGET_RENAME].right / 2;
w->widget[BUILD_VEHICLE_WIDGET_BUILD].right = w->widget[BUILD_VEHICLE_WIDGET_RENAME].left - 1;
}
/* Setup widget strings to fit the different types of vehicles */
static void SetupWindowStrings(Window *w, byte type)
{
@@ -922,7 +914,7 @@ static void NewVehicleWndProc(Window *w, WindowEvent *e)
break;
case WE_RESIZE:
if (e->we.sizing.diff.x != 0) ResizeButtons(w);
if (e->we.sizing.diff.x != 0) ResizeButtons(w, BUILD_VEHICLE_WIDGET_BUILD, BUILD_VEHICLE_WIDGET_RESIZE);
if (e->we.sizing.diff.y == 0) break;
w->vscroll.cap += e->we.sizing.diff.y / GetVehicleListHeight(bv->vehicle_type);
@@ -984,7 +976,7 @@ void ShowBuildVehicleWindow(TileIndex tile, byte type)
break;
}
SetupWindowStrings(w, type);
ResizeButtons(w);
ResizeButtons(w, BUILD_VEHICLE_WIDGET_BUILD, BUILD_VEHICLE_WIDGET_RESIZE);
w->resize.width = w->width;
w->resize.height = w->height;