* fix a refresh bug introduced lately
[open-ps2-loader.git] / include / themes.h
blob2e9a5c5f8e544e331f3be6ca656bbaf32edfadf9
1 #ifndef __THEMES_H
2 #define __THEMES_H
4 #include "include/textures.h"
5 #include "include/texcache.h"
6 #include "include/menusys.h"
8 #define THM_MAX_FILES 64
9 #define THM_MAX_FONTS 16
11 typedef struct {
12 // optional, only for overlays
13 int upperLeft_x;
14 int upperLeft_y;
15 int upperRight_x;
16 int upperRight_y;
17 int lowerLeft_x;
18 int lowerLeft_y;
19 int lowerRight_x;
20 int lowerRight_y;
22 // basic texture information
23 char* name;
24 GSTEXTURE source;
25 } image_texture_t;
27 typedef struct {
28 // Attributes for: AttributeImage
29 int currentUid;
30 int currentItemId;
31 char* currentValue;
33 // Attributes for: AttributeImage & GameImage
34 image_cache_t* cache;
35 int cacheLinked;
37 // Attributes for: AttributeImage & GameImage & StaticImage
38 image_texture_t* defaultTexture;
39 int defaultTextureLinked;
41 image_texture_t* overlayTexture;
42 int overlayTextureLinked;
43 } mutable_image_t;
45 typedef struct {
46 // Attributes for: AttributeText & StaticText
47 char* value;
48 int sizingMode;
50 // Attributes for: AttributeText
51 char* alias;
52 int displayMode;
54 int currentItemId;
55 char* currentValue;
56 } mutable_text_t;
58 typedef struct {
59 int displayedItems;
61 char* decorator;
62 mutable_image_t* decoratorImage;
63 } items_list_t;
65 typedef struct theme_element {
66 int type;
67 int posX;
68 int posY;
69 short aligned;
70 int width;
71 int height;
72 short scaled;
73 u64 color;
74 int font;
76 void* extended;
78 void (*drawElem)(struct menu_list* menu, struct submenu_list* item, config_set_t* config, struct theme_element* elem);
79 void (*endElem)(struct theme_element* elem);
81 struct theme_element* next;
82 } theme_element_t;
84 typedef struct {
85 theme_element_t* first;
86 theme_element_t* last;
87 } theme_elems_t;
89 typedef struct {
90 char* filePath;
91 char* name;
92 } theme_file_t;
94 typedef struct theme {
95 int useDefault;
96 int usedHeight;
98 unsigned char bgColor[3];
99 u64 textColor;
100 u64 uiTextColor;
101 u64 selTextColor;
103 theme_elems_t mainElems;
104 theme_elems_t infoElems;
106 int gameCacheCount;
108 theme_element_t* itemsList;
109 theme_element_t* loadingIcon;
110 int loadingIconCount;
112 GSTEXTURE textures[TEXTURES_COUNT];
113 int fonts[THM_MAX_FONTS]; //!< Storage of font handles for removal once not needed
114 } theme_t;
116 theme_t* gTheme;
118 void thmInit();
119 void thmReloadScreenExtents();
120 void thmAddElements(char* path, char* separator, int mode);
121 char* thmGetValue();
122 GSTEXTURE* thmGetTexture(unsigned int id);
123 void thmEnd();
125 // Indices are shifted in GUI, as we add the internal default theme at 0
126 int thmSetGuiValue(int themeGuiId, int reload);
127 int thmGetGuiValue();
128 int thmFindGuiID(char* theme);
129 char **thmGetGuiList();
131 #endif