mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-22 18:51:34 +00:00
Start adding menu_cbs_label.c
This commit is contained in:
parent
c66ada4e90
commit
bcf74d9685
@ -512,6 +512,7 @@ ifeq ($(HAVE_MENU_COMMON), 1)
|
||||
menu/cbs/menu_cbs_deferred_push.o \
|
||||
menu/cbs/menu_cbs_scan.o \
|
||||
menu/cbs/menu_cbs_get_value.o \
|
||||
menu/cbs/menu_cbs_label.o \
|
||||
menu/cbs/menu_cbs_title.o \
|
||||
menu/cbs/menu_cbs_up.o \
|
||||
menu/cbs/menu_cbs_down.o \
|
||||
|
@ -876,6 +876,7 @@ MENU
|
||||
#include "../menu/cbs/menu_cbs_deferred_push.c"
|
||||
#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_up.c"
|
||||
#include "../menu/cbs/menu_cbs_down.c"
|
||||
#include "../menu/cbs/menu_cbs_contentlist_switch.c"
|
||||
|
40
menu/cbs/menu_cbs_label.c
Normal file
40
menu/cbs/menu_cbs_label.c
Normal file
@ -0,0 +1,40 @@
|
||||
/* 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 "../menu_driver.h"
|
||||
#include "../menu_cbs.h"
|
||||
#include "../menu_navigation.h"
|
||||
|
||||
#ifndef BIND_ACTION_LABEL
|
||||
#define BIND_ACTION_LABEL(cbs, name) \
|
||||
cbs->action_label = name; \
|
||||
cbs->action_label_ident = #name;
|
||||
#endif
|
||||
|
||||
static int action_bind_label_generic(char *s, size_t len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int menu_cbs_init_bind_label(menu_file_list_cbs_t *cbs,
|
||||
const char *path, const char *label, unsigned type, size_t idx)
|
||||
{
|
||||
if (!cbs)
|
||||
return -1;
|
||||
|
||||
BIND_ACTION_LABEL(cbs, action_bind_label_generic);
|
||||
|
||||
return -1;
|
||||
}
|
@ -126,6 +126,10 @@ void menu_cbs_init(void *data,
|
||||
|
||||
menu_cbs_init_log(repr_label, "GET TITLE", cbs->action_get_title_ident);
|
||||
|
||||
menu_cbs_init_bind_label(cbs, path, label, type, idx);
|
||||
|
||||
menu_cbs_init_log(repr_label, "LABEL", cbs->action_label_ident);
|
||||
|
||||
bind_info.cbs = cbs;
|
||||
bind_info.path = path;
|
||||
bind_info.label = label;
|
||||
|
@ -148,6 +148,9 @@ int menu_cbs_init_bind_get_string_representation(menu_file_list_cbs_t *cbs,
|
||||
const char *path, const char *label, unsigned type, size_t idx,
|
||||
uint32_t label_hash, uint32_t menu_label_hash);
|
||||
|
||||
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_up(menu_file_list_cbs_t *cbs,
|
||||
const char *path, const char *label, unsigned type, size_t idx);
|
||||
|
||||
|
@ -111,6 +111,9 @@ typedef struct menu_file_list_cbs
|
||||
int (*action_up)(unsigned type, const char *label);
|
||||
const char *action_up_ident;
|
||||
|
||||
int (*action_label)(char *s, size_t len);
|
||||
const char *action_label_ident;
|
||||
|
||||
int (*action_down)(unsigned type, const char *label);
|
||||
const char *action_down_ident;
|
||||
|
||||
|
@ -292,6 +292,10 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
|
||||
entry_label, path,
|
||||
entry->path, sizeof(entry->path));
|
||||
}
|
||||
|
||||
if (cbs && cbs->action_label)
|
||||
cbs->action_label(entry->rich_label,
|
||||
sizeof(entry->rich_label));
|
||||
}
|
||||
|
||||
entry->idx = i;
|
||||
|
@ -45,6 +45,7 @@ typedef struct menu_entry
|
||||
{
|
||||
char path[PATH_MAX_LENGTH];
|
||||
char label[PATH_MAX_LENGTH];
|
||||
char rich_label[PATH_MAX_LENGTH];
|
||||
char value[PATH_MAX_LENGTH];
|
||||
size_t entry_idx;
|
||||
enum msg_hash_enums enum_idx;
|
||||
|
Loading…
x
Reference in New Issue
Block a user