3 typedef struct menu_s menu_t
;
6 void (*draw
)(menu_t
* menu
,mp_image_t
* mpi
);
7 void (*read_cmd
)(menu_t
* menu
,int cmd
);
8 void (*read_key
)(menu_t
* menu
,int cmd
);
9 void (*close
)(menu_t
* menu
);
11 struct menu_priv_s
* priv
;
12 int show
; // Draw it ?
13 int cl
; // Close request (user sent a close cmd or
17 typedef struct menu_info_s
{
22 m_struct_t priv_st
; // Config struct definition
23 // cfg is a config struct as defined in cfg_st, it may be used as a priv struct
24 // cfg is filled from the attributs found in the cfg file
25 // the args param hold the content of the balise in the cfg file (if any)
26 int (*open
)(menu_t
* menu
, char* args
);
31 #define MENU_CMD_DOWN 1
33 #define MENU_CMD_CANCEL 3
35 /// Global init/uninit
36 int menu_init(char* cfg_file
);
37 void menu_unint(void);
39 /// Open a menu defined in the config file
40 menu_t
* menu_open(char *name
);
42 void menu_draw(menu_t
* menu
,mp_image_t
* mpi
);
43 void menu_read_cmd(menu_t
* menu
,int cmd
);
44 void menu_close(menu_t
* menu
);
45 void menu_read_key(menu_t
* menu
,int cmd
);
47 //// Default implementation
48 void menu_dflt_read_key(menu_t
* menu
,int cmd
);
52 #define MENU_TEXT_TOP (1<<0)
53 #define MENU_TEXT_VCENTER (1<<1)
54 #define MENU_TEXT_BOT (1<<2)
55 #define MENU_TEXT_VMASK (MENU_TEXT_TOP|MENU_TEXT_VCENTER|MENU_TEXT_BOT)
56 #define MENU_TEXT_LEFT (1<<3)
57 #define MENU_TEXT_HCENTER (1<<4)
58 #define MENU_TEXT_RIGHT (1<<5)
59 #define MENU_TEXT_HMASK (MENU_TEXT_LEFT|MENU_TEXT_HCENTER|MENU_TEXT_RIGHT)
60 #define MENU_TEXT_CENTER (MENU_TEXT_VCENTER|MENU_TEXT_HCENTER)
62 void menu_draw_text(mp_image_t
* mpi
, char* txt
, int x
, int y
);
63 int menu_text_length(char* txt
);
64 int menu_text_num_lines(char* txt
, int max_width
);
66 void menu_text_size(char* txt
,int max_width
,
70 void menu_draw_text_full(mp_image_t
* mpi
,char* txt
,
71 int x
, int y
,int w
, int h
,
72 int vspace
, int warp
, int align
, int anchor
);