mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-08 18:36:28 +00:00
Create sublabel callbacks
This commit is contained in:
parent
fa8e59c1ff
commit
c9c7aea184
@ -542,6 +542,7 @@ ifeq ($(HAVE_MENU_COMMON), 1)
|
||||
menu/cbs/menu_cbs_scan.o \
|
||||
menu/cbs/menu_cbs_get_value.o \
|
||||
menu/cbs/menu_cbs_label.o \
|
||||
menu/cbs/menu_cbs_sublabel.o \
|
||||
menu/cbs/menu_cbs_title.o \
|
||||
menu/cbs/menu_cbs_up.o \
|
||||
menu/cbs/menu_cbs_down.o \
|
||||
|
@ -927,6 +927,7 @@ MENU
|
||||
#include "../menu/cbs/menu_cbs_scan.c"
|
||||
#include "../menu/cbs/menu_cbs_get_value.c"
|
||||
#include "../menu/cbs/menu_cbs_label.c"
|
||||
#include "../menu/cbs/menu_cbs_sublabel.c"
|
||||
#include "../menu/cbs/menu_cbs_up.c"
|
||||
#include "../menu/cbs/menu_cbs_down.c"
|
||||
#include "../menu/cbs/menu_cbs_contentlist_switch.c"
|
||||
|
75
menu/cbs/menu_cbs_sublabel.c
Normal file
75
menu/cbs/menu_cbs_sublabel.c
Normal file
@ -0,0 +1,75 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <compat/strl.h>
|
||||
#include <file/file_path.h>
|
||||
|
||||
#include "../menu_driver.h"
|
||||
#include "../menu_cbs.h"
|
||||
#include "../menu_navigation.h"
|
||||
#include "../../file_path_special.h"
|
||||
|
||||
#ifndef BIND_ACTION_SUBLABEL
|
||||
#define BIND_ACTION_SUBLABEL(cbs, name) \
|
||||
cbs->action_sublabel = name; \
|
||||
cbs->action_sublabel_ident = #name;
|
||||
#endif
|
||||
|
||||
static int action_bind_sublabel_generic(
|
||||
file_list_t *list,
|
||||
unsigned type, unsigned i,
|
||||
const char *label, const char *path,
|
||||
char *s, size_t len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int action_bind_sublabel_information(
|
||||
file_list_t *list,
|
||||
unsigned type, unsigned i,
|
||||
const char *label, const char *path,
|
||||
char *s, size_t len)
|
||||
{
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INFORMATION), len);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||
const char *path, const char *label, unsigned type, size_t idx)
|
||||
{
|
||||
if (!cbs)
|
||||
return -1;
|
||||
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_generic);
|
||||
|
||||
if (cbs->enum_idx != MSG_UNKNOWN)
|
||||
{
|
||||
switch (cbs->enum_idx)
|
||||
{
|
||||
#if 0
|
||||
case MENU_ENUM_LABEL_INFORMATION:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_information);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
case MSG_UNKNOWN:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
@ -130,6 +130,10 @@ void menu_cbs_init(void *data,
|
||||
|
||||
menu_cbs_init_log(repr_label, "LABEL", cbs->action_label_ident);
|
||||
|
||||
menu_cbs_init_bind_sublabel(cbs, path, label, type, idx);
|
||||
|
||||
menu_cbs_init_log(repr_label, "SUBLABEL", cbs->action_sublabel_ident);
|
||||
|
||||
bind_info.cbs = cbs;
|
||||
bind_info.path = path;
|
||||
bind_info.label = label;
|
||||
|
@ -160,6 +160,9 @@ int menu_cbs_init_bind_get_string_representation(menu_file_list_cbs_t *cbs,
|
||||
int menu_cbs_init_bind_label(menu_file_list_cbs_t *cbs,
|
||||
const char *path, const char *label, unsigned type, size_t idx);
|
||||
|
||||
int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||
const char *path, const char *label, unsigned type, size_t idx);
|
||||
|
||||
int menu_cbs_init_bind_up(menu_file_list_cbs_t *cbs,
|
||||
const char *path, const char *label, unsigned type, size_t idx);
|
||||
|
||||
|
@ -111,6 +111,12 @@ typedef struct menu_file_list_cbs
|
||||
char *s, size_t len);
|
||||
const char *action_label_ident;
|
||||
|
||||
int (*action_sublabel)(file_list_t *list,
|
||||
unsigned type, unsigned i,
|
||||
const char *label, const char *path,
|
||||
char *s, size_t len);
|
||||
const char *action_sublabel_ident;
|
||||
|
||||
int (*action_down)(unsigned type, const char *label);
|
||||
const char *action_down_ident;
|
||||
|
||||
|
@ -430,6 +430,13 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
|
||||
label, path,
|
||||
entry->rich_label,
|
||||
sizeof(entry->rich_label));
|
||||
|
||||
if (cbs->action_sublabel)
|
||||
cbs->action_sublabel(list,
|
||||
entry->type, i,
|
||||
label, path,
|
||||
entry->sublabel,
|
||||
sizeof(entry->sublabel));
|
||||
}
|
||||
|
||||
entry->idx = i;
|
||||
|
Loading…
x
Reference in New Issue
Block a user