summaryrefslogtreecommitdiff
path: root/widget.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
commit67b88e7ed931a66f73d347ddaed840aee92eb72c (patch)
tree430f2b9127a57a13c4df1dae3ed1a35f0bf2c76c /widget.c
parent9d24f3df0a7bddaa951eae6bd92be96dd6f13efc (diff)
downloadopenttd-67b88e7ed931a66f73d347ddaed840aee92eb72c.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 'widget.c')
-rw-r--r--widget.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/widget.c b/widget.c
index 5aab291aa..cb7847c9b 100644
--- a/widget.c
+++ b/widget.c
@@ -141,7 +141,7 @@ int GetWidgetFromPos(const Window *w, int x, int y)
if (wi->type == WWT_EMPTY || wi->type == WWT_FRAME) continue;
if (x >= wi->left && x <= wi->right && y >= wi->top && y <= wi->bottom &&
- !HASBIT(w->hidden_state,index)) {
+ !IsWidgetHidden(wi)) {
found_index = index;
}
}
@@ -187,15 +187,10 @@ void DrawWindowWidgets(const Window *w)
const Widget *wi;
const DrawPixelInfo* dpi = _cur_dpi;
Rect r;
- uint32 cur_click, cur_disabled, cur_hidden;
int i = 0;
wi = w->widget;
- cur_click = w->click_state;
- cur_disabled = w->disabled_state;
- cur_hidden = w->hidden_state;
-
do {
bool clicked = IsWindowWidgetLowered((Window*)w, i);
@@ -203,7 +198,7 @@ void DrawWindowWidgets(const Window *w)
dpi->left + dpi->width <= (r.left=wi->left/* + w->left*/) ||
dpi->top > (r.bottom=/*w->top +*/ wi->bottom) ||
dpi->top + dpi->height <= (r.top = /*w->top +*/ wi->top) ||
- cur_hidden & 1) {
+ IsWidgetHidden(wi)) {
continue;
}
@@ -460,12 +455,12 @@ void DrawWindowWidgets(const Window *w)
DrawStringCentered( (r.left+r.right+1)>>1, r.top+2, wi->data, 0x84);
draw_default:;
- if (cur_disabled & 1) {
+ if (IsWidgetDisabled(wi)) {
GfxFillRect(r.left+1, r.top+1, r.right-1, r.bottom-1, _colour_gradient[wi->color&0xF][2] | PALETTE_MODIFIER_GREYOUT);
}
}
}
- } while (i++, cur_click>>=1, cur_disabled>>=1, cur_hidden >>= 1, (++wi)->type != WWT_LAST);
+ } while (i++, (++wi)->type != WWT_LAST);
if (w->flags4 & WF_WHITE_BORDER_MASK) {