* fix for theme font handling (when switching back to the default theme, the language...
[open-ps2-loader.git] / include / menusys.h
blob8ba3a73fb518816a853c90dfa31dad6621eb0ba8
1 #ifndef __MENUSYS_H
2 #define __MENUSYS_H
4 #include <gsToolkit.h>
5 #include "include/config.h"
7 /// a single submenu item
8 typedef struct submenu_item {
9 /// Icon used for rendering of this item
10 int icon_id;
12 /// item description
13 char *text;
15 /// item description in localized form (used if value is not negative)
16 int text_id;
18 /// item id (MUST BE VALID, we assert it is != -1 to optimize rendering)
19 int id;
21 int* cache_id;
22 int* cache_uid;
23 } submenu_item_t;
25 typedef struct submenu_list {
26 struct submenu_item item;
28 struct submenu_list *prev, *next;
29 } submenu_list_t;
31 typedef struct menu_hint_item {
32 int icon_id;
33 int text_id;
35 struct menu_hint_item *next;
36 } menu_hint_item_t;
38 /// a single menu item. Linked list impl (for the ease of rendering)
39 typedef struct menu_item {
40 /// Icon used for rendering of this item
41 int icon_id;
43 /// item description
44 char *text;
46 /// item description in localised form (used if value is not negative)
47 int text_id;
49 void *userdata;
51 /// submenu, selection and page start (only used in static mode)
52 struct submenu_list *submenu, *current, *pagestart;
54 short remindLast;
56 void (*refresh)(struct menu_item *curMenu);
58 void (*execCross)(struct menu_item *curMenu);
60 void (*execTriangle)(struct menu_item *curMenu);
62 void (*execCircle)(struct menu_item *curMenu);
64 void (*execSquare)(struct menu_item *curMenu);
66 /// hint list
67 struct menu_hint_item *hints;
68 } menu_item_t;
70 typedef struct menu_list {
71 struct menu_item *item;
73 struct menu_list *prev, *next;
74 } menu_list_t;
76 void menuInit();
77 void menuEnd();
79 void menuAppendItem(menu_item_t* item);
81 void submenuRebuildCache(submenu_list_t* submenu);
82 submenu_list_t* submenuAppendItem(submenu_list_t** submenu, int icon_id, char *text, int id, int text_id);
83 void submenuRemoveItem(submenu_list_t** submenu, int id);
84 void submenuDestroy(submenu_list_t** submenu);
85 void submenuSort(submenu_list_t** submenu);
87 char *submenuItemGetText(submenu_item_t* it);
88 char *menuItemGetText(menu_item_t* it);
89 config_set_t* menuLoadConfig();
90 void menuSaveConfig();
92 void menuRenderMain();
93 void menuRenderMenu();
94 void menuRenderInfo();
95 void menuHandleInputMain();
96 void menuHandleInputMenu();
97 void menuHandleInputInfo();
99 // Sets the selected item if it is found in the menu list
100 void menuSetSelectedItem(menu_item_t *item);
102 void menuAddHint(menu_item_t *menu, int text_id, int icon_id);
103 void menuRemoveHints(menu_item_t *menu);
105 #endif