diff options
author | bjarni <bjarni@openttd.org> | 2006-09-28 23:05:03 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2006-09-28 23:05:03 +0000 |
commit | 4ccdb0686f3b401199efc975e8ce9f75bbcde0d7 (patch) | |
tree | b9c5f2fcf23245015608eafaccdf02f62b94eda6 /misc_gui.c | |
parent | 1ae8aa4b809c3ddff032e2f3de7317490efa5235 (diff) | |
download | openttd-4ccdb0686f3b401199efc975e8ce9f75bbcde0d7.tar.xz |
(svn r6562) -Codechange: merged the vehicle list window widget arrays
It made no sense to maintain 8 nearly identically arrays when a single one can do the job
Also made the two buttons always use half of the bottom width each, even when resizing
Diffstat (limited to 'misc_gui.c')
-rw-r--r-- | misc_gui.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/misc_gui.c b/misc_gui.c index 3654e6fc2..315bab533 100644 --- a/misc_gui.c +++ b/misc_gui.c @@ -30,6 +30,7 @@ #include "tgp.h" #include "settings.h" #include "date.h" +#include "resize_window_widgets.h" #include "fios.h" /* Variables to display file lists */ @@ -1867,3 +1868,22 @@ void ShowCheatWindow(void) if (w != NULL) SetWindowDirty(w); } + +/** Resize the widgets in a window + * @param *w Window to resize in + * @param *resizearray Bytearray of the same length as the window contains widgets. Each byte tells how to move the widget of the same index using the flags in resize_window_widgets.h + * @param length Length of the bytearray + * @param horizontal Tells how far to the right the widgets should be moved (note: negative moves left) + * @param vertical Tells how far down the widgets should be moved (note: negative moves up) +*/ +void ResizeWindowWidgets(Window *w, const byte *resizearray, byte length, byte horizontal, byte vertical) +{ + byte i; + + for (i = 0; i < length; i++) { + if (resizearray[i] & WIDGET_DEFINE_MOVE_LEFT) w->widget[i].left += horizontal; + if (resizearray[i] & WIDGET_DEFINE_MOVE_RIGHT) w->widget[i].right += horizontal; + if (resizearray[i] & WIDGET_DEFINE_MOVE_TOP) w->widget[i].top += vertical; + if (resizearray[i] & WIDGET_DEFINE_MOVE_BOTTOM) w->widget[i].bottom += vertical; + } +} |