3 typedef struct menu_s menu_t
;
5 typedef struct menu_def_st menu_def_t
;
10 struct MPContext
*ctx
;
11 void (*draw
)(menu_t
* menu
,mp_image_t
* mpi
);
12 void (*read_cmd
)(menu_t
* menu
,int cmd
);
13 void (*read_key
)(menu_t
* menu
,int cmd
);
14 void (*close
)(menu_t
* menu
);
15 struct m_struct_st
* priv_st
;
16 struct menu_priv_s
* priv
;
17 int show
; // Draw it ?
18 int cl
; // Close request (user sent a close cmd or
23 typedef struct menu_info_s
{
28 struct m_struct_st priv_st
; // Config struct definition
29 // cfg is a config struct as defined in cfg_st, it may be used as a priv struct
30 // cfg is filled from the attributs found in the cfg file
31 // the args param hold the content of the balise in the cfg file (if any)
32 int (*open
)(menu_t
* menu
, char* args
);
37 #define MENU_CMD_DOWN 1
39 #define MENU_CMD_CANCEL 3
40 #define MENU_CMD_LEFT 4
41 #define MENU_CMD_RIGHT 5
42 #define MENU_CMD_ACTION 6
43 #define MENU_CMD_HOME 7
44 #define MENU_CMD_END 8
45 #define MENU_CMD_PAGE_UP 9
46 #define MENU_CMD_PAGE_DOWN 10
48 /// Global init/uninit
49 int menu_init(struct MPContext
*mpctx
, char* cfg_file
);
50 void menu_uninit(void);
52 /// Open a menu defined in the config file
53 menu_t
* menu_open(char *name
);
55 void menu_draw(menu_t
* menu
,mp_image_t
* mpi
);
56 void menu_read_cmd(menu_t
* menu
,int cmd
);
57 void menu_close(menu_t
* menu
);
58 void menu_read_key(menu_t
* menu
,int cmd
);
60 //// Default implementation
61 int menu_dflt_read_key(menu_t
* menu
,int cmd
);
65 #define MENU_TEXT_TOP (1<<0)
66 #define MENU_TEXT_VCENTER (1<<1)
67 #define MENU_TEXT_BOT (1<<2)
68 #define MENU_TEXT_VMASK (MENU_TEXT_TOP|MENU_TEXT_VCENTER|MENU_TEXT_BOT)
69 #define MENU_TEXT_LEFT (1<<3)
70 #define MENU_TEXT_HCENTER (1<<4)
71 #define MENU_TEXT_RIGHT (1<<5)
72 #define MENU_TEXT_HMASK (MENU_TEXT_LEFT|MENU_TEXT_HCENTER|MENU_TEXT_RIGHT)
73 #define MENU_TEXT_CENTER (MENU_TEXT_VCENTER|MENU_TEXT_HCENTER)
75 void menu_draw_text(mp_image_t
* mpi
, char* txt
, int x
, int y
);
76 int menu_text_length(char* txt
);
77 int menu_text_num_lines(char* txt
, int max_width
);
79 void menu_text_size(char* txt
,int max_width
,
83 void menu_draw_text_full(mp_image_t
* mpi
,char* txt
,
84 int x
, int y
,int w
, int h
,
85 int vspace
, int warp
, int align
, int anchor
);
87 void menu_draw_box(mp_image_t
* mpi
, unsigned char grey
, unsigned char alpha
, int x
, int y
, int w
, int h
);