|
@@ -456,49 +456,49 @@ static int GetDropdownItem(const Window
|
|
|
|
|
|
if (GetWidgetFromPos(w, _cursor.pos.x - w->left, _cursor.pos.y - w->top) < 0)
|
|
|
return -1;
|
|
|
|
|
|
y = _cursor.pos.y - w->top - 2;
|
|
|
|
|
|
if (y < 0)
|
|
|
return - 1;
|
|
|
|
|
|
item = y / 10;
|
|
|
if (item >= WP(w,dropdown_d).num_items || (HASBIT(WP(w,dropdown_d).disabled_state, item) && !HASBIT(WP(w,dropdown_d).hidden_state, item)) || WP(w,dropdown_d).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(WP(w,dropdown_d).hidden_state, counter)) item++;
|
|
|
|
|
|
return item;
|
|
|
}
|
|
|
|
|
|
static void DropdownMenuWndProc(Window *w, WindowEvent *e)
|
|
|
{
|
|
|
int item;
|
|
|
|
|
|
switch(e->event) {
|
|
|
switch (e->event) {
|
|
|
case WE_PAINT: {
|
|
|
int x,y,i,sel;
|
|
|
|
|
|
DrawWindowWidgets(w);
|
|
|
|
|
|
x = 1;
|
|
|
y = 2;
|
|
|
sel = WP(w,dropdown_d).selected_index;
|
|
|
|
|
|
for (i = 0; WP(w,dropdown_d).items[i] != INVALID_STRING_ID; i++) {
|
|
|
if (HASBIT(WP(w,dropdown_d).hidden_state, i)) {
|
|
|
sel--;
|
|
|
continue;
|
|
|
}
|
|
|
if (WP(w,dropdown_d).items[i] != 0) {
|
|
|
if (sel == 0) GfxFillRect(x + 1, y, x + w->width - 4, y + 9, 0);
|
|
|
DrawString(x + 2, y, WP(w,dropdown_d).items[i], sel == 0 ? 12 : 16);
|
|
|
|
|
|
if (HASBIT(WP(w,dropdown_d).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
|
|
|
);
|
|
|
}
|
|
|
} else {
|