summaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2006-10-03 20:16:20 +0000
committerbelugas <belugas@openttd.org>2006-10-03 20:16:20 +0000
commit688da1d9406cbd6fb359605de0d5c43c77f7a8ea (patch)
tree22b881cad1fc846e1fe14182d37c8f6e6261f820 /window.c
parent0dd2126543cb5613272876114a89fdbcbadeb21c (diff)
downloadopenttd-688da1d9406cbd6fb359605de0d5c43c77f7a8ea.tar.xz
(svn r6631) -Codechange: Use accessors for click_state.
Another step toward merging XTDwidget. The only two files not converted (window.h and widget.c) will be done at the very last commit)
Diffstat (limited to 'window.c')
-rw-r--r--window.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/window.c b/window.c
index 1b438b138..f2d659649 100644
--- a/window.c
+++ b/window.c
@@ -17,9 +17,22 @@
// delta between mouse cursor and upper left corner of dragged window
static Point _drag_delta;
+void RaiseWindowButtons(Window *w)
+{
+ const Widget *wi = w->widget;
+ uint i = 0;
+
+ for (i = 0; wi->type != WWT_LAST; i++, wi++) {
+ if (IsWindowWidgetLowered(w, i)) {
+ RaiseWindowWidget(w, i);
+ InvalidateWidget(w, i);
+ }
+ }
+}
+
void HandleButtonClick(Window *w, byte widget)
{
- w->click_state |= (1 << widget);
+ LowerWindowWidget(w, widget);
w->flags4 |= 5 << WF_TIMEOUT_SHL;
InvalidateWidget(w, widget);
}
@@ -754,7 +767,7 @@ static void DecreaseWindowCounters(void)
if (w->flags4&WF_TIMEOUT_MASK && !(--w->flags4&WF_TIMEOUT_MASK)) {
CallWindowEventNP(w, WE_TIMEOUT);
- if (w->desc_flags & WDF_UNCLICK_BUTTONS) UnclickWindowButtons(w);
+ if (w->desc_flags & WDF_UNCLICK_BUTTONS) RaiseWindowButtons(w);
}
}
}