Mercurial > mplayer.hg
annotate libmenu/menu.h @ 25242:371a40dcc1cc
stream_opts arrays should be const
author | reimar |
---|---|
date | Sun, 02 Dec 2007 21:37:08 +0000 |
parents | 1b3dabc8c2b8 |
children | 96d0992c7920 |
rev | line source |
---|---|
8197 | 1 |
2 struct menu_priv_s; | |
3 typedef struct menu_s menu_t; | |
4 | |
25208
1b3dabc8c2b8
Add type info to menu_t, now we can get the menu name and the type name of menu.
ulion
parents:
22284
diff
changeset
|
5 typedef struct menu_def_st menu_def_t; |
1b3dabc8c2b8
Add type info to menu_t, now we can get the menu name and the type name of menu.
ulion
parents:
22284
diff
changeset
|
6 |
8197 | 7 struct menu_s { |
22284 | 8 struct MPContext *ctx; |
8197 | 9 void (*draw)(menu_t* menu,mp_image_t* mpi); |
10 void (*read_cmd)(menu_t* menu,int cmd); | |
11 void (*read_key)(menu_t* menu,int cmd); | |
12 void (*close)(menu_t* menu); | |
13 m_struct_t* priv_st; | |
14 struct menu_priv_s* priv; | |
15 int show; // Draw it ? | |
16 int cl; // Close request (user sent a close cmd or | |
17 menu_t* parent; | |
25208
1b3dabc8c2b8
Add type info to menu_t, now we can get the menu name and the type name of menu.
ulion
parents:
22284
diff
changeset
|
18 menu_def_t *type; |
8197 | 19 }; |
20 | |
21 typedef struct menu_info_s { | |
22 const char *info; | |
23 const char *name; | |
24 const char *author; | |
25 const char *comment; | |
26 m_struct_t priv_st; // Config struct definition | |
27 // cfg is a config struct as defined in cfg_st, it may be used as a priv struct | |
28 // cfg is filled from the attributs found in the cfg file | |
29 // the args param hold the content of the balise in the cfg file (if any) | |
30 int (*open)(menu_t* menu, char* args); | |
31 } menu_info_t; | |
32 | |
33 | |
34 #define MENU_CMD_UP 0 | |
35 #define MENU_CMD_DOWN 1 | |
36 #define MENU_CMD_OK 2 | |
37 #define MENU_CMD_CANCEL 3 | |
17945
98f4e3704a76
Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents:
8197
diff
changeset
|
38 #define MENU_CMD_LEFT 4 |
98f4e3704a76
Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents:
8197
diff
changeset
|
39 #define MENU_CMD_RIGHT 5 |
19490
f57977ac0394
support multiple actions in menu's file browser using key bindings
ben
parents:
18193
diff
changeset
|
40 #define MENU_CMD_ACTION 6 |
8197 | 41 |
42 /// Global init/uninit | |
22284 | 43 int menu_init(struct MPContext *mpctx, char* cfg_file); |
8197 | 44 void menu_unint(void); |
45 | |
46 /// Open a menu defined in the config file | |
47 menu_t* menu_open(char *name); | |
48 | |
49 void menu_draw(menu_t* menu,mp_image_t* mpi); | |
50 void menu_read_cmd(menu_t* menu,int cmd); | |
51 void menu_close(menu_t* menu); | |
52 void menu_read_key(menu_t* menu,int cmd); | |
53 | |
54 //// Default implementation | |
55 void menu_dflt_read_key(menu_t* menu,int cmd); | |
56 | |
57 /////////// Helpers | |
58 | |
59 #define MENU_TEXT_TOP (1<<0) | |
60 #define MENU_TEXT_VCENTER (1<<1) | |
61 #define MENU_TEXT_BOT (1<<2) | |
62 #define MENU_TEXT_VMASK (MENU_TEXT_TOP|MENU_TEXT_VCENTER|MENU_TEXT_BOT) | |
63 #define MENU_TEXT_LEFT (1<<3) | |
64 #define MENU_TEXT_HCENTER (1<<4) | |
65 #define MENU_TEXT_RIGHT (1<<5) | |
66 #define MENU_TEXT_HMASK (MENU_TEXT_LEFT|MENU_TEXT_HCENTER|MENU_TEXT_RIGHT) | |
67 #define MENU_TEXT_CENTER (MENU_TEXT_VCENTER|MENU_TEXT_HCENTER) | |
68 | |
69 void menu_draw_text(mp_image_t* mpi, char* txt, int x, int y); | |
70 int menu_text_length(char* txt); | |
71 int menu_text_num_lines(char* txt, int max_width); | |
72 | |
73 void menu_text_size(char* txt,int max_width, | |
74 int vspace, int warp, | |
75 int* _w, int* _h); | |
76 | |
77 void menu_draw_text_full(mp_image_t* mpi,char* txt, | |
78 int x, int y,int w, int h, | |
79 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
|
80 |
18193 | 81 void menu_draw_box(mp_image_t* mpi, unsigned char grey, unsigned char alpha, int x, int y, int w, int h); |