void menu_machine_reset( int action ) { int hard_reset = action; const char *message = "Reset?"; if( hard_reset ) message = "Hard reset?"; if( widget_do( WIDGET_TYPE_QUERY, message ) || !widget_query.confirm ) return; widget_end_all( WIDGET_FINISHED_OK ); machine_reset( hard_reset ); }
void menu_file_exit( int action ) { static int menu_exit_open = 0; if( menu_exit_open ) return; menu_exit_open = 1; if( widget_do_query( "Exit Fuse?" ) || !widget_query.confirm ) { menu_exit_open = 0; return; } if( menu_check_media_changed() ) { menu_exit_open = 0; return; } fuse_exiting = 1; menu_exit_open = 0; widget_end_all( WIDGET_FINISHED_OK ); }
static void widget_query_generic_keyhandler( widget_query_entry *query, int num_entries, input_key key ) { int new_highlight_line = 0; int cursor_pressed = 0; widget_query_entry *ptr; int menu_width = widget_calculate_query_width( title, query, message_lines, num_message_lines ); int menu_left_edge_x = DISPLAY_WIDTH_COLS/2-menu_width/2; switch( key ) { #if 0 case INPUT_KEY_Resize: /* Fake keypress used on window resize */ widget_dialog_with_border( 1, 2, 30, 2 + 20 ); widget_general_show_all( &widget_options_settings ); break; #endif case INPUT_KEY_Escape: case INPUT_JOYSTICK_FIRE_2: widget_end_widget( WIDGET_FINISHED_CANCEL ); break; case INPUT_KEY_Up: case INPUT_KEY_7: case INPUT_JOYSTICK_UP: if ( highlight_line ) { new_highlight_line = highlight_line - 1; cursor_pressed = 1; } break; case INPUT_KEY_Down: case INPUT_KEY_6: case INPUT_JOYSTICK_DOWN: if ( highlight_line < num_entries - 2 ) { new_highlight_line = highlight_line + 1; cursor_pressed = 1; } break; case INPUT_KEY_Return: case INPUT_KEY_KP_Enter: case INPUT_JOYSTICK_FIRE_1: query[highlight_line].click(); widget_end_all( WIDGET_FINISHED_OK ); display_refresh_all(); return; default: /* Keep gcc happy */ break; } if( cursor_pressed ) { int old_highlight_line = highlight_line; highlight_line = new_highlight_line; widget_query_line_draw( menu_left_edge_x, menu_width, query + old_highlight_line, query[old_highlight_line].text ); widget_query_line_draw( menu_left_edge_x, menu_width, query + highlight_line, query[highlight_line].text ); return; } for( ptr=query; ptr->text != NULL; ptr++ ) { if( key == ptr->key ) { int old_highlight_line = highlight_line; ptr->click(); highlight_line = ptr->index; widget_query_line_draw( menu_left_edge_x, menu_width, query + old_highlight_line, query[old_highlight_line].text ); widget_query_line_draw( menu_left_edge_x, menu_width, ptr, query[highlight_line].text ); break; } } }
void set_joystick_type( int action ) { *current_settings[ 0 ] = action; widget_end_all( WIDGET_FINISHED_OK ); }