void menu_input_key_event(bool down, unsigned keycode, uint32_t character, uint16_t mod) { (void)down; (void)keycode; (void)mod; if (character == '/') menu_input_search_start(); }
static int action_iterate_main(const char *label, unsigned action) { int ret = 0; unsigned type_offset = 0; const char *label_offset = NULL; const char *path_offset = NULL; menu_file_list_cbs_t *cbs = NULL; menu_handle_t *menu = menu_driver_get_ptr(); global_t *global = global_get_ptr(); if (!menu) return 0; cbs = (menu_file_list_cbs_t*) menu_list_get_actiondata_at_offset(menu->menu_list->selection_buf, menu->navigation.selection_ptr); menu_list_get_at_offset(menu->menu_list->selection_buf, menu->navigation.selection_ptr, &path_offset, &label_offset, &type_offset); if (!strcmp(label, "help")) return action_iterate_help(label, action); else if (!strcmp(label, "info_screen")) return action_iterate_info(label, action); else if (!strcmp(label, "load_open_zip")) return action_iterate_load_open_zip(label, action); else if (!strcmp(label, "message")) return action_iterate_message(label, action); else if ( !strcmp(label, "custom_viewport_1") || !strcmp(label, "custom_viewport_2") ) return action_iterate_menu_viewport(label, action); else if ( !strcmp(label, "custom_bind") || !strcmp(label, "custom_bind_all") || !strcmp(label, "custom_bind_defaults") ) { if (global->menu.bind_mode_keyboard) return action_iterate_custom_bind_keyboard(label, action); else return action_iterate_custom_bind(label, action); } if (menu->need_refresh && !menu->nonblocking_refresh && action != MENU_ACTION_MESSAGE) action = MENU_ACTION_REFRESH; switch (action) { case MENU_ACTION_UP: case MENU_ACTION_DOWN: if (cbs && cbs->action_up_or_down) ret = cbs->action_up_or_down(type_offset, label_offset, action); break; case MENU_ACTION_SCROLL_UP: menu_navigation_descend_alphabet(&menu->navigation, &menu->navigation.selection_ptr); break; case MENU_ACTION_SCROLL_DOWN: menu_navigation_ascend_alphabet(&menu->navigation, &menu->navigation.selection_ptr); break; case MENU_ACTION_CANCEL: if (cbs && cbs->action_cancel) return cbs->action_cancel(path_offset, label_offset, type_offset, menu->navigation.selection_ptr); break; case MENU_ACTION_OK: if (cbs && cbs->action_ok) return cbs->action_ok(path_offset, label_offset, type_offset, menu->navigation.selection_ptr); break; case MENU_ACTION_START: if (cbs && cbs->action_start) return cbs->action_start(type_offset, label_offset, action); break; case MENU_ACTION_LEFT: case MENU_ACTION_RIGHT: if (cbs && cbs->action_toggle) ret = cbs->action_toggle(type_offset, label_offset, action, false); break; case MENU_ACTION_SELECT: if (cbs && cbs->action_select) ret = cbs->action_select(type_offset, label_offset, action); break; case MENU_ACTION_REFRESH: if (cbs && cbs->action_refresh) ret = cbs->action_refresh(menu->menu_list->selection_buf, menu->menu_list->menu_stack); break; case MENU_ACTION_MESSAGE: menu->msg_force = true; break; case MENU_ACTION_SEARCH: menu_input_search_start(); break; case MENU_ACTION_TEST: #if 0 menu->rdl = database_info_write_rdl_init("/home/twinaphex/roms"); if (!menu->rdl) return -1; #endif break; default: break; } if (ret) return ret; ret = mouse_post_iterate(cbs, path_offset, label_offset, type_offset, action); ret |= pointer_post_iterate(cbs, path_offset, label_offset, type_offset, action); menu_driver_render(); /* Have to defer it so we let settings refresh. */ if (menu->push_start_screen) { menu_list_push_stack(menu->menu_list, "", "help", 0, 0); menu->push_start_screen = false; } return ret; }
int menu_entry_action(menu_entry_t *entry, unsigned i, enum menu_action action) { int ret = 0; menu_navigation_t *nav = menu_navigation_get_ptr(); menu_display_t *disp = menu_display_get_ptr(); menu_list_t *menu_list = menu_list_get_ptr(); menu_file_list_cbs_t *cbs = menu_list_get_actiondata_at_offset(menu_list->selection_buf, i); switch (action) { case MENU_ACTION_UP: if (cbs && cbs->action_up) ret = cbs->action_up(entry->type, entry->label); break; case MENU_ACTION_DOWN: if (cbs && cbs->action_down) ret = cbs->action_down(entry->type, entry->label); break; case MENU_ACTION_SCROLL_UP: menu_navigation_descend_alphabet(nav, &nav->selection_ptr); break; case MENU_ACTION_SCROLL_DOWN: menu_navigation_ascend_alphabet(nav, &nav->selection_ptr); break; case MENU_ACTION_CANCEL: if (cbs && cbs->action_cancel) ret = cbs->action_cancel(entry->path, entry->label, entry->type, i); break; case MENU_ACTION_OK: if (cbs && cbs->action_ok) ret = cbs->action_ok(entry->path, entry->label, entry->type, i, entry->entry_idx); break; case MENU_ACTION_START: if (cbs && cbs->action_start) ret = cbs->action_start(entry->type, entry->label); break; case MENU_ACTION_LEFT: if (cbs && cbs->action_left) ret = cbs->action_left(entry->type, entry->label, false); break; case MENU_ACTION_RIGHT: if (cbs && cbs->action_right) ret = cbs->action_right(entry->type, entry->label, false); break; case MENU_ACTION_INFO: if (cbs && cbs->action_info) ret = cbs->action_info(entry->type, entry->label); break; case MENU_ACTION_SELECT: if (cbs && cbs->action_select) ret = cbs->action_select(entry->path, entry->label, entry->type, i); break; case MENU_ACTION_REFRESH: if (cbs && cbs->action_refresh) { ret = cbs->action_refresh(menu_list->selection_buf, menu_list->menu_stack); menu_entries_unset_refresh(); } break; case MENU_ACTION_MESSAGE: if (disp) disp->msg_force = true; break; case MENU_ACTION_SEARCH: menu_input_search_start(); break; case MENU_ACTION_SCAN: if (cbs && cbs->action_scan) ret = cbs->action_scan(entry->path, entry->label, entry->type, i); break; default: break; } return ret; }
int menu_entry_action(menu_entry_t *entry, unsigned i, enum menu_action action) { int ret = 0; menu_navigation_t *nav = menu_navigation_get_ptr(); menu_handle_t *menu = menu_driver_get_ptr(); menu_list_t *menu_list = menu_list_get_ptr(); menu_file_list_cbs_t *cbs = menu_list_get_actiondata_at_offset(menu_list->selection_buf, i); switch (action) { case MENU_ACTION_UP: if (cbs && cbs->action_up) ret = cbs->action_up(entry->type, entry->label); break; case MENU_ACTION_DOWN: if (cbs && cbs->action_down) ret = cbs->action_down(entry->type, entry->label); break; case MENU_ACTION_SCROLL_UP: menu_navigation_descend_alphabet(nav, &nav->selection_ptr); break; case MENU_ACTION_SCROLL_DOWN: menu_navigation_ascend_alphabet(nav, &nav->selection_ptr); break; case MENU_ACTION_CANCEL: if (cbs && cbs->action_cancel) ret = cbs->action_cancel(entry->path, entry->label, entry->type, i); break; case MENU_ACTION_OK: if (cbs && cbs->action_ok) ret = cbs->action_ok(entry->path, entry->label, entry->type, i); break; case MENU_ACTION_START: if (cbs && cbs->action_start) ret = cbs->action_start(entry->type, entry->label); break; case MENU_ACTION_LEFT: if (cbs && cbs->action_left) ret = cbs->action_left(entry->type, entry->label, false); break; case MENU_ACTION_RIGHT: if (cbs && cbs->action_right) ret = cbs->action_right(entry->type, entry->label, false); break; case MENU_ACTION_SELECT: if (cbs && cbs->action_select) ret = cbs->action_select(entry->type, entry->label); break; case MENU_ACTION_REFRESH: if (cbs && cbs->action_refresh) { ret = cbs->action_refresh(menu_list->selection_buf, menu_list->menu_stack); menu_unset_refresh(); } break; case MENU_ACTION_MESSAGE: menu->msg_force = true; break; case MENU_ACTION_SEARCH: menu_input_search_start(); break; case MENU_ACTION_TEST: #if 0 menu->db = database_info_init("/home/squarepusher/roms", DATABASE_TYPE_RDL_WRITE); if (!menu->db) ret = -1; #endif break; default: break; } return ret; }