Mercurial > mplayer.hg
annotate libmenu/menu.h @ 20459:231f139a324d
Partial sync with en/mplayer.1 (2)
zh/mplayer.1 is mainly updated with section of
"DEMUXER/STREAM OPTIONS"
patch by Sheldon Jin (jinsh2 yahoo com)
author | kraymer |
---|---|
date | Fri, 27 Oct 2006 23:13:46 +0000 |
parents | f57977ac0394 |
children | 83366c8e1928 |
rev | line source |
---|---|
8197 | 1 |
2 struct menu_priv_s; | |
3 typedef struct menu_s menu_t; | |
4 | |
5 struct menu_s { | |
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); | |
10 m_struct_t* priv_st; | |
11 struct menu_priv_s* priv; | |
12 int show; // Draw it ? | |
13 int cl; // Close request (user sent a close cmd or | |
14 menu_t* parent; | |
15 }; | |
16 | |
17 typedef struct menu_info_s { | |
18 const char *info; | |
19 const char *name; | |
20 const char *author; | |
21 const char *comment; | |
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); | |
27 } menu_info_t; | |
28 | |
29 | |
30 #define MENU_CMD_UP 0 | |
31 #define MENU_CMD_DOWN 1 | |
32 #define MENU_CMD_OK 2 | |
33 #define MENU_CMD_CANCEL 3 | |
17945
98f4e3704a76
Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents:
8197
diff
changeset
|
34 #define MENU_CMD_LEFT 4 |
98f4e3704a76
Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents:
8197
diff
changeset
|
35 #define MENU_CMD_RIGHT 5 |
19490
f57977ac0394
support multiple actions in menu's file browser using key bindings
ben
parents:
18193
diff
changeset
|
36 #define MENU_CMD_ACTION 6 |
8197 | 37 |
38 /// Global init/uninit | |
39 int menu_init(char* cfg_file); | |
40 void menu_unint(void); | |
41 | |
42 /// Open a menu defined in the config file | |
43 menu_t* menu_open(char *name); | |
44 | |
45 void menu_draw(menu_t* menu,mp_image_t* mpi); | |
46 void menu_read_cmd(menu_t* menu,int cmd); | |
47 void menu_close(menu_t* menu); | |
48 void menu_read_key(menu_t* menu,int cmd); | |
49 | |
50 //// Default implementation | |
51 void menu_dflt_read_key(menu_t* menu,int cmd); | |
52 | |
53 /////////// Helpers | |
54 | |
55 #define MENU_TEXT_TOP (1<<0) | |
56 #define MENU_TEXT_VCENTER (1<<1) | |
57 #define MENU_TEXT_BOT (1<<2) | |
58 #define MENU_TEXT_VMASK (MENU_TEXT_TOP|MENU_TEXT_VCENTER|MENU_TEXT_BOT) | |
59 #define MENU_TEXT_LEFT (1<<3) | |
60 #define MENU_TEXT_HCENTER (1<<4) | |
61 #define MENU_TEXT_RIGHT (1<<5) | |
62 #define MENU_TEXT_HMASK (MENU_TEXT_LEFT|MENU_TEXT_HCENTER|MENU_TEXT_RIGHT) | |
63 #define MENU_TEXT_CENTER (MENU_TEXT_VCENTER|MENU_TEXT_HCENTER) | |
64 | |
65 void menu_draw_text(mp_image_t* mpi, char* txt, int x, int y); | |
66 int menu_text_length(char* txt); | |
67 int menu_text_num_lines(char* txt, int max_width); | |
68 | |
69 void menu_text_size(char* txt,int max_width, | |
70 int vspace, int warp, | |
71 int* _w, int* _h); | |
72 | |
73 void menu_draw_text_full(mp_image_t* mpi,char* txt, | |
74 int x, int y,int w, int h, | |
75 int vspace, int warp, int align, int anchor); | |
17993
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
76 |
18193 | 77 void menu_draw_box(mp_image_t* mpi, unsigned char grey, unsigned char alpha, int x, int y, int w, int h); |