(svn r12558) -Feature: subsidy window can now be resized.

This commit is contained in:
belugas 2008-04-04 02:24:44 +00:00
parent 110584808d
commit 2675db8d70
1 changed files with 14 additions and 9 deletions

View File

@ -92,7 +92,7 @@ static void DrawSubsidiesWindow(const Window *w)
ConvertDateToYMD(_date, &ymd);
int width = w->width - 2;
int width = w->width - 13; // scroll bar = 11 + pixel each side
y = 15;
x = 1;
DrawStringTruncated(x, y, STR_2026_SUBSIDIES_ON_OFFER_FOR, TC_FROMSTRING, width);
@ -133,8 +133,10 @@ static void DrawSubsidiesWindow(const Window *w)
xt = DrawStringTruncated(x + 2, y, STR_202C_FROM_TO, TC_FROMSTRING, width - 2);
SetDParam(0, _date - ymd.day + 768 - s->age * 32);
DrawStringTruncated(xt, y, STR_202D_UNTIL, TC_FROMSTRING, width - xt);
if ((xt > 3) && (width - xt) > 9 ) { // do not draw if it will get on the scrollbar or if last drawing did nothing
SetDParam(0, _date - ymd.day + 768 - s->age * 32);
DrawStringTruncated(xt, y, STR_202D_UNTIL, TC_FROMSTRING, width - xt);
}
y += 10;
num++;
}
@ -159,17 +161,20 @@ static void SubsidiesListWndProc(Window *w, WindowEvent *e)
}
static const Widget _subsidies_list_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
{ WWT_CAPTION, RESIZE_RIGHT, 13, 11, 307, 0, 13, STR_2025_SUBSIDIES, STR_018C_WINDOW_TITLE_DRAG_THIS},
{ WWT_STICKYBOX, RESIZE_LR, 13, 308, 319, 0, 13, STR_NULL, STR_STICKY_BUTTON},
{ WWT_PANEL, RESIZE_RIGHT, 13, 0, 319, 14, 126, 0x0, STR_01FD_CLICK_ON_SERVICE_TO_CENTER},
{ WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
{ WWT_CAPTION, RESIZE_RIGHT, 13, 11, 307, 0, 13, STR_2025_SUBSIDIES, STR_018C_WINDOW_TITLE_DRAG_THIS},
{ WWT_STICKYBOX, RESIZE_LR, 13, 308, 319, 0, 13, STR_NULL, STR_STICKY_BUTTON},
{ WWT_PANEL, RESIZE_RB, 13, 0, 307, 14, 126, 0x0, STR_01FD_CLICK_ON_SERVICE_TO_CENTER},
{ WWT_SCROLLBAR, RESIZE_LRB, 13, 308, 319, 14, 114, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // IDW_SCROLLBAR
{ WWT_RESIZEBOX, RESIZE_LRTB, 13, 308, 319, 115, 126, 0x0, STR_RESIZE_BUTTON}, // IDW_RESIZE
{ WIDGETS_END},
};
static const WindowDesc _subsidies_list_desc = {
WDP_AUTO, WDP_AUTO, 320, 127, 630, 127,
WDP_AUTO, WDP_AUTO, 320, 127, 320, 127,
WC_SUBSIDIES_LIST, WC_NONE,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE,
_subsidies_list_widgets,
SubsidiesListWndProc
};