Add MENU_ENTRIES_CTL_SHOW_BACK

This commit is contained in:
twinaphex 2015-12-11 21:34:27 +01:00
parent 352836a595
commit fde4826754
5 changed files with 10 additions and 12 deletions

View File

@ -827,7 +827,7 @@ static void mui_frame(void *data)
title_margin = mui->margin; title_margin = mui->margin;
if (menu_entries_show_back()) if (menu_entries_ctl(MENU_ENTRIES_CTL_SHOW_BACK, NULL))
{ {
title_margin = mui->icon_size; title_margin = mui->icon_size;
mui_draw_icon(mui, mui->textures.list[MUI_TEXTURE_BACK].id, mui_draw_icon(mui, mui->textures.list[MUI_TEXTURE_BACK].id,

View File

@ -519,7 +519,7 @@ static void rgui_render(void *data)
hover_color = HOVER_COLOR(settings); hover_color = HOVER_COLOR(settings);
normal_color = NORMAL_COLOR(settings); normal_color = NORMAL_COLOR(settings);
if (menu_entries_show_back()) if (menu_entries_ctl(MENU_ENTRIES_CTL_SHOW_BACK, NULL))
blit_line(fb_data, fb_pitch, blit_line(fb_data, fb_pitch,
RGUI_TERM_START_X(fb_width), RGUI_TERM_START_X(fb_width),
RGUI_TERM_START_X(fb_width), RGUI_TERM_START_X(fb_width),

View File

@ -447,12 +447,6 @@ int menu_entries_get_title(char *s, size_t len)
return 0; return 0;
} }
/* Returns true if a Back button should be shown (i.e. we are at least
* one level deep in the menu hierarchy). */
bool menu_entries_show_back(void)
{
return (menu_entries_get_stack_size(0) > 1);
}
/* Sets 's' to the name of the current core /* Sets 's' to the name of the current core
* (shown at the top of the UI). */ * (shown at the top of the UI). */
@ -729,6 +723,11 @@ bool menu_entries_ctl(enum menu_entries_ctl_state state, void *data)
{ {
switch (state) switch (state)
{ {
/* Returns true if a Back button should be shown
* (i.e. we are at least
* one level deep in the menu hierarchy). */
case MENU_ENTRIES_CTL_SHOW_BACK:
return (menu_entries_get_stack_size(0) > 1);
case MENU_ENTRIES_CTL_NONE: case MENU_ENTRIES_CTL_NONE:
default: default:
break; break;

View File

@ -103,7 +103,8 @@ typedef struct menu_file_list_cbs
enum menu_entries_ctl_state enum menu_entries_ctl_state
{ {
MENU_ENTRIES_CTL_NONE = 0 MENU_ENTRIES_CTL_NONE = 0,
MENU_ENTRIES_CTL_SHOW_BACK
}; };
typedef struct menu_list menu_list_t; typedef struct menu_list menu_list_t;
@ -118,8 +119,6 @@ void menu_entries_get(size_t i, menu_entry_t *entry);
int menu_entries_get_title(char *title, size_t title_len); int menu_entries_get_title(char *title, size_t title_len);
bool menu_entries_show_back(void);
int menu_entries_get_core_title(char *title_msg, size_t title_msg_len); int menu_entries_get_core_title(char *title_msg, size_t title_msg_len);
rarch_setting_t *menu_setting_get_ptr(void); rarch_setting_t *menu_setting_get_ptr(void);

View File

@ -672,7 +672,7 @@ didSelectRowAtIndexPath:(NSIndexPath *)indexPath
[self.sections addObject:everything]; [self.sections addObject:everything];
weakSelf = self; weakSelf = self;
if (menu_entries_show_back()) if (menu_entries_ctl(MENU_ENTRIES_CTL_SHOW_BACK, NULL))
[self set_leftbutton:BOXSTRING("Back") [self set_leftbutton:BOXSTRING("Back")
target:weakSelf target:weakSelf
action:@selector(menuBack)]; action:@selector(menuBack)];