summaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2006-10-06 01:33:27 +0000
committerbelugas <belugas@openttd.org>2006-10-06 01:33:27 +0000
commit3b6bb44eef64345011180418d12d02ac4b082c33 (patch)
tree430f2b9127a57a13c4df1dae3ed1a35f0bf2c76c /window.c
parentb46ea965125d95d3d7f8a82f79f6b3884078631d (diff)
downloadopenttd-3b6bb44eef64345011180418d12d02ac4b082c33.tar.xz
(svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
The functions required to do so are to be found in window.h. Rather then use the old deprecated disabled_state, hidden_state and click_state uint32 variables, we now need to use accessors like SetWindowWidgetDisabledState, SetWindowWidgetHiddenState or SetWindowWidgetLoweredState. This is the final commit for the merge of XTDwidget branch.
Diffstat (limited to 'window.c')
-rw-r--r--window.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/window.c b/window.c
index c4348c907..ce80facb0 100644
--- a/window.c
+++ b/window.c
@@ -57,7 +57,7 @@ static void DispatchLeftClickEvent(Window *w, int x, int y)
wi = &w->widget[e.we.click.widget];
/* don't allow any interaction if the button has been disabled */
- if (HASBIT(w->disabled_state, e.we.click.widget)) return;
+ if (IsWidgetDisabled(wi)) return;
if (wi->type & 0xE0) {
/* special widget handling for buttons*/
@@ -1068,22 +1068,25 @@ static bool HandleWindowDragging(void)
bool resize_width = false;
while (wi->type != WWT_LAST) {
- if (wi->resize_flag != RESIZE_NONE) {
+ /* Isolate the resizing flags */
+ byte rsizeflag = GB(wi->display_flags, 0, 4);
+
+ if (rsizeflag != RESIZE_NONE) {
/* Resize this widget */
- if (wi->resize_flag & RESIZE_LEFT) {
+ if (rsizeflag & RESIZE_LEFT) {
wi->left += x;
resize_width = true;
}
- if (wi->resize_flag & RESIZE_RIGHT) {
+ if (rsizeflag & RESIZE_RIGHT) {
wi->right += x;
resize_width = true;
}
- if (wi->resize_flag & RESIZE_TOP) {
+ if (rsizeflag & RESIZE_TOP) {
wi->top += y;
resize_height = true;
}
- if (wi->resize_flag & RESIZE_BOTTOM) {
+ if (rsizeflag & RESIZE_BOTTOM) {
wi->bottom += y;
resize_height = true;
}
@@ -1538,7 +1541,7 @@ void InvalidateWidget(const Window *w, byte widget_index)
const Widget *wi = &w->widget[widget_index];
/* Don't redraw the window if the widget is invisible or of no-type */
- if (wi->type == WWT_EMPTY || HASBIT(w->hidden_state, widget_index)) return;
+ if (wi->type == WWT_EMPTY || IsWidgetHidden(wi)) return;
SetDirtyBlocks(w->left + wi->left, w->top + wi->top, w->left + wi->right + 1, w->top + wi->bottom + 1);
}