1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-29 01:35:06 +01:00

fix #2363: show default item highlight, refactor

This commit is contained in:
IntelOrca
2016-01-17 23:37:14 +00:00
parent f8507ec93e
commit 1ffee2435a
4 changed files with 78 additions and 41 deletions

View File

@@ -1208,7 +1208,12 @@ void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_wi
window_event_mouse_down_call(w, widgetIndex);
}
if (gInputFlags & INPUT_FLAG_WIDGET_PRESSED) return;
if (gInputFlags & INPUT_FLAG_WIDGET_PRESSED) {
if (gInputState == INPUT_STATE_DROPDOWN_ACTIVE) {
gDropdownHighlightedIndex = gDropdownDefaultIndex;
}
return;
}
gInputFlags |= INPUT_FLAG_WIDGET_PRESSED;
widget_invalidate_by_number(cursor_w_class, cursor_w_number, widgetIndex);
@@ -1257,6 +1262,12 @@ void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_wi
gTooltipWidget.widget_index = cursor_widgetIndex;
gTooltipWidget.window_classification = cursor_w_class;
gTooltipWidget.window_number = cursor_w_number;
if (dropdown_index == -1) {
if (!dropdown_is_disabled(gDropdownDefaultIndex)) {
dropdown_index = gDropdownDefaultIndex;
}
}
window_event_dropdown_call(cursor_w, cursor_widgetIndex, dropdown_index);
}
dropdown_cleanup:
@@ -1300,12 +1311,17 @@ void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_wi
return;
}
if (!w) return;
gDropdownHighlightedIndex = -1;
window_invalidate_by_class(WC_DROPDOWN);
if (w == NULL) {
return;
}
if (w->classification == WC_DROPDOWN){
int dropdown_index = dropdown_index_from_point(x, y, w);
if (dropdown_index == -1) return;
if (dropdown_index == -1) {
return;
}
if (gDropdownIsColour && gDropdownLastColourHover != dropdown_index) {
gDropdownLastColourHover = dropdown_index;