/***************************************************************************

	usrintrf.c

	PSP user interface draw functions.

***************************************************************************/

#ifndef PSP_USRINTRF_H
#define PSP_USRINTRF_H

#define FONT_WHITE			0x7fff
#define FONT_BLACK			0x0000

#define ICON_L_CONFIG   	0
#define ICON_L_KEYCONFIG	1
#define ICON_L_FOLDER	  	2
#define ICON_L_RETURN	 	3
#define ICON_L_RESET	 	4
#define ICON_L_EXIT		  	5

#define ICON_S_CONFIG   	0
#define ICON_S_KEYCONFIG	1
#define ICON_S_FOLDER   	2
#define ICON_S_UPPERDIR 	3
#define ICON_S_MEMSTICK 	4
#define ICON_S_ZIPFILE  	5
#define ICON_S_BATTERY1  	6
#define ICON_S_BATTERY2  	7
#define ICON_S_BATTERY3  	8
#define ICON_S_BATTERY4  	9

#define PAL(palette)		((palette.b << 10) | (palette.g << 5) | (palette.r << 0))

#define LOGO_COL			PAL(logo_pal)
#define TITLE_COL			PAL(title_pal)
#define INFOBAR_COL 		PAL(infobar_pal)
#define SELECT_COL			PAL(select_pal)
#define NORMAL_COL			PAL(normal_pal)
#define BG1_COL				PAL(bg1_pal)
#define BG2_COL				PAL(bg2_pal)
#define BG3_COL				PAL(bg3_pal)
#define FILESEL1_COL		PAL(filesel1_pal)
#define FILESEL2_COL		PAL(filesel2_pal)

typedef struct psppal_t
{
	int r;
	int g;
	int b;
} UI_PALETTE;

extern UI_PALETTE logo_pal;
extern UI_PALETTE title_pal;
extern UI_PALETTE infobar_pal;
extern UI_PALETTE select_pal;
extern UI_PALETTE normal_pal;
extern UI_PALETTE bg1_pal;			// logo background and infomation bar
extern UI_PALETTE bg2_pal;			// title bar
extern UI_PALETTE bg3_pal;			// menu and file list area
extern UI_PALETTE filesel1_pal;
extern UI_PALETTE filesel2_pal;
extern int bg_brightness;

int font_get_string_width(const char *s);
void font_print(int sx, int sy, u16 color, const char *s);
void font_print_center(int sy, u16 color, const char *s);
void font_print_shadow(int sx, int sy, u16 color, const char *s, int level);
void font_print_shadow_center(int sy, u16 color, const char *s, int level);

void small_font_print(int sx, int sy, u16 color, const char *s, int bg);
void small_font_print_center(int sy, u16 color, const char *s, int bg);

void large_icon(int sx, int sy, u16 color, int no);
void large_icon_shadow(int sx, int sy, int no, int level);
void large_icon_lightshadow(int sx, int sy, int no, int level);

void small_icon(int sx, int sy, u16 color, int no);
void small_icon_shadow(int sx, int sy, int no, int level);
void small_icon_lightshadow(int sx, int sy, int no, int level);

void hline(int sx, int ex, int y, u16 color);
void hline_brightness(int sx, int ex, int y, int brightness);
void hline_alpha(int sx, int ex, int y, u16 color, int alpha);
void hline_gradation(int sx, int ex, int y, u16 scolor, u16 ecolor, int alpha);

void vline(int x, int sy, int ey, u16 color);
void vline_brightness(int x, int sy, int ey, int brightness);
void vline_alpha(int x, int sy, int ey, u16 color, int alpha);
void vline_gradation(int x, int sy, int ey, u16 scolor, u16 ecolor, int alpha);

void box(int sx, int sy, int ex, int ey, u16 color);

void boxfill(int sx, int sy, int ex, int ey, u16 color);
void boxfill_alpha(int sx, int sy, int ex, int ey, u16 color, int alpha);
void boxfill_gradation(int sx, int sy, int ex, int ey, u16 scolor, u16 ecolor, int alpha);

void draw_dialog(int sx, int sy, int ex, int ey);
void draw_scrollbar(int sx, int sy, int ex, int ey, int line_height, int total_lines, int current_line);

void draw_logo(int sx, int sy, u16 color);

void get_ui_color(UI_PALETTE *pal, int *r, int *g, int *b);
void set_ui_color(UI_PALETTE *pal, int r, int g, int b);

#endif /* PSP_USRINTRF_H */
