summaryrefslogtreecommitdiff
path: root/widget.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2005-11-12 11:10:12 +0000
committerpeter1138 <peter1138@openttd.org>2005-11-12 11:10:12 +0000
commit59e885c2bff5b1af6d7f5473106e9aa1f562abfd (patch)
tree5c7183b1f1efbfb913ba249225edb917360dfaaa /widget.c
parent422bea5a0be723ea43e025325db8e90ee4d27470 (diff)
downloadopenttd-59e885c2bff5b1af6d7f5473106e9aa1f562abfd.tar.xz
(svn r3171) - Codechange: remove static _dropdown_disabled/_dropdown_hidden variables, as a window already contains this information.
Diffstat (limited to 'widget.c')
-rw-r--r--widget.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/widget.c b/widget.c
index 614d68d13..7861275d8 100644
--- a/widget.c
+++ b/widget.c
@@ -437,8 +437,6 @@ draw_default:;
}
static uint _dropdown_item_count;
-static uint32 _dropdown_disabled;
-static uint32 _dropdown_hidden;
static const StringID *_dropdown_items;
static int _dropdown_selindex;
static byte _dropdown_button;
@@ -466,12 +464,12 @@ static int GetDropdownItem(const Window *w)
return - 1;
item = y / 10;
- if (item >= _dropdown_item_count || (HASBIT(_dropdown_disabled, item) && !HASBIT(_dropdown_hidden, item)) || _dropdown_items[item] == 0)
+ if (item >= _dropdown_item_count || (HASBIT(w->disabled_state, item) && !HASBIT(w->hidden_state, item)) || _dropdown_items[item] == 0)
return - 1;
// Skip hidden items -- +1 for each hidden item before the clicked item.
for (counter = 0; item >= counter; ++counter)
- if (HASBIT(_dropdown_hidden, counter)) item++;
+ if (HASBIT(w->hidden_state, counter)) item++;
return item;
}
@@ -491,7 +489,7 @@ static void DropdownMenuWndProc(Window *w, WindowEvent *e)
sel = _dropdown_selindex;
for(i=0; _dropdown_items[i] != INVALID_STRING_ID; i++) {
- if (HASBIT(_dropdown_hidden, i)) {
+ if (HASBIT(w->hidden_state, i)) {
sel--;
continue;
}
@@ -501,7 +499,7 @@ static void DropdownMenuWndProc(Window *w, WindowEvent *e)
}
DrawString(x+2, y, _dropdown_items[i], sel==0 ? 12 : 16);
- if (HASBIT(_dropdown_disabled, i)) {
+ if (HASBIT(w->disabled_state, i)) {
GfxFillRect(x, y, x+w->width-3, y + 9, PALETTE_MODIFIER_GREYOUT |
_color_list[_dropdown_menu_widgets[0].color].window_color_bga);
}
@@ -579,9 +577,6 @@ void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int butt
Window *w2;
uint32 old_click_state = w->click_state;
- _dropdown_disabled = disabled_mask;
- _dropdown_hidden = hidden_mask;
-
cls = w->window_class;
num = w->window_number;
DeleteWindowById(WC_DROPDOWN_MENU, 0);
@@ -635,4 +630,7 @@ void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int butt
w2->widget[0].bottom = i * 10 + 3;
w2->flags4 &= ~WF_WHITE_BORDER_MASK;
+
+ w2->disabled_state = disabled_mask;
+ w2->hidden_state = hidden_mask;
}