void w_saves::click(int x, int y) { if (x == 0 && y == 0 && active) { // almost certainly a simulated click if (num_items > 0) item_selected(); } else if (x >= trough_rect.x && x < trough_rect.x + trough_rect.w && y >= thumb_y && y <= thumb_y + thumb_height) { thumb_dragging = dirty = true; thumb_drag_y = y - thumb_y; } else { if (x < get_theme_space(LIST_WIDGET, L_SPACE) || x >= rect.w - get_theme_space(LIST_WIDGET, R_SPACE) || y < get_theme_space(LIST_WIDGET, T_SPACE) || y >= rect.h - get_theme_space(LIST_WIDGET, B_SPACE)) return; if ((y - get_theme_space(LIST_WIDGET, T_SPACE)) / item_height() + top_item < min(num_items, top_item + shown_items)) { size_t old_sel = selection; set_selection((y - get_theme_space(LIST_WIDGET, T_SPACE)) / item_height() + top_item); if (selection == old_sel && num_items > 0 && is_item_selectable(selection)) item_selected(); } } }
const abstract_svg_item *item_helpers::get_selectable_item_or_group (const abstract_svg_item *item, selection_type_t type) const { if (!item) return nullptr; while (!is_item_selectable (item, type)) item = item->parent (); return item; }