Mercurial > mplayer.hg
annotate libmenu/menu.h @ 25899:9d4121fa508a
Split osd related stuff from mp_core.h into new header file mp_osd.h.
author | ulion |
---|---|
date | Wed, 30 Jan 2008 07:21:05 +0000 |
parents | 6ac1ece1f9fe |
children | 4129c8cfa742 |
rev | line source |
---|---|
25553
6ac1ece1f9fe
Add multiple inclusion guards to all header files that lack them.
diego
parents:
25502
diff
changeset
|
1 #ifndef MENU_H |
6ac1ece1f9fe
Add multiple inclusion guards to all header files that lack them.
diego
parents:
25502
diff
changeset
|
2 #define MENU_H |
8197 | 3 |
4 struct menu_priv_s; | |
5 typedef struct menu_s menu_t; | |
6 | |
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
|
7 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
|
8 |
25417
b0cd876a0c32
Remove dependency on m_struct.h when include libmenu/menu.h.
ulion
parents:
25263
diff
changeset
|
9 struct m_struct_st; |
b0cd876a0c32
Remove dependency on m_struct.h when include libmenu/menu.h.
ulion
parents:
25263
diff
changeset
|
10 |
8197 | 11 struct menu_s { |
22284 | 12 struct MPContext *ctx; |
8197 | 13 void (*draw)(menu_t* menu,mp_image_t* mpi); |
14 void (*read_cmd)(menu_t* menu,int cmd); | |
25502
605d4e3e403f
From now on, libmenu does not steal all input keys from input modules.
ulion
parents:
25461
diff
changeset
|
15 int (*read_key)(menu_t* menu,int cmd); |
8197 | 16 void (*close)(menu_t* menu); |
25417
b0cd876a0c32
Remove dependency on m_struct.h when include libmenu/menu.h.
ulion
parents:
25263
diff
changeset
|
17 struct m_struct_st* priv_st; |
8197 | 18 struct menu_priv_s* priv; |
19 int show; // Draw it ? | |
20 int cl; // Close request (user sent a close cmd or | |
21 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
|
22 menu_def_t *type; |
8197 | 23 }; |
24 | |
25 typedef struct menu_info_s { | |
26 const char *info; | |
27 const char *name; | |
28 const char *author; | |
29 const char *comment; | |
25419
59aba7a96701
Replace another m_struct_t by 'struct m_struct_st' to remove depedency
ulion
parents:
25417
diff
changeset
|
30 struct m_struct_st priv_st; // Config struct definition |
8197 | 31 // cfg is a config struct as defined in cfg_st, it may be used as a priv struct |
32 // cfg is filled from the attributs found in the cfg file | |
33 // the args param hold the content of the balise in the cfg file (if any) | |
34 int (*open)(menu_t* menu, char* args); | |
35 } menu_info_t; | |
36 | |
37 | |
38 #define MENU_CMD_UP 0 | |
39 #define MENU_CMD_DOWN 1 | |
40 #define MENU_CMD_OK 2 | |
41 #define MENU_CMD_CANCEL 3 | |
17945
98f4e3704a76
Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents:
8197
diff
changeset
|
42 #define MENU_CMD_LEFT 4 |
98f4e3704a76
Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents:
8197
diff
changeset
|
43 #define MENU_CMD_RIGHT 5 |
19490
f57977ac0394
support multiple actions in menu's file browser using key bindings
ben
parents:
18193
diff
changeset
|
44 #define MENU_CMD_ACTION 6 |
25263
96d0992c7920
Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents:
25208
diff
changeset
|
45 #define MENU_CMD_HOME 7 |
96d0992c7920
Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents:
25208
diff
changeset
|
46 #define MENU_CMD_END 8 |
96d0992c7920
Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents:
25208
diff
changeset
|
47 #define MENU_CMD_PAGE_UP 9 |
96d0992c7920
Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents:
25208
diff
changeset
|
48 #define MENU_CMD_PAGE_DOWN 10 |
25461 | 49 #define MENU_CMD_CLICK 11 |
8197 | 50 |
51 /// Global init/uninit | |
22284 | 52 int menu_init(struct MPContext *mpctx, char* cfg_file); |
25420 | 53 void menu_uninit(void); |
8197 | 54 |
55 /// Open a menu defined in the config file | |
56 menu_t* menu_open(char *name); | |
57 | |
58 void menu_draw(menu_t* menu,mp_image_t* mpi); | |
59 void menu_read_cmd(menu_t* menu,int cmd); | |
60 void menu_close(menu_t* menu); | |
25502
605d4e3e403f
From now on, libmenu does not steal all input keys from input modules.
ulion
parents:
25461
diff
changeset
|
61 int menu_read_key(menu_t* menu,int cmd); |
8197 | 62 |
63 //// Default implementation | |
25263
96d0992c7920
Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents:
25208
diff
changeset
|
64 int menu_dflt_read_key(menu_t* menu,int cmd); |
8197 | 65 |
25461 | 66 /// Receive mouse position events. |
67 void menu_update_mouse_pos(double x, double y); | |
68 | |
8197 | 69 /////////// Helpers |
70 | |
71 #define MENU_TEXT_TOP (1<<0) | |
72 #define MENU_TEXT_VCENTER (1<<1) | |
73 #define MENU_TEXT_BOT (1<<2) | |
74 #define MENU_TEXT_VMASK (MENU_TEXT_TOP|MENU_TEXT_VCENTER|MENU_TEXT_BOT) | |
75 #define MENU_TEXT_LEFT (1<<3) | |
76 #define MENU_TEXT_HCENTER (1<<4) | |
77 #define MENU_TEXT_RIGHT (1<<5) | |
78 #define MENU_TEXT_HMASK (MENU_TEXT_LEFT|MENU_TEXT_HCENTER|MENU_TEXT_RIGHT) | |
79 #define MENU_TEXT_CENTER (MENU_TEXT_VCENTER|MENU_TEXT_HCENTER) | |
80 | |
81 void menu_draw_text(mp_image_t* mpi, char* txt, int x, int y); | |
82 int menu_text_length(char* txt); | |
83 int menu_text_num_lines(char* txt, int max_width); | |
84 | |
85 void menu_text_size(char* txt,int max_width, | |
86 int vspace, int warp, | |
87 int* _w, int* _h); | |
88 | |
89 void menu_draw_text_full(mp_image_t* mpi,char* txt, | |
90 int x, int y,int w, int h, | |
91 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
|
92 |
18193 | 93 void menu_draw_box(mp_image_t* mpi, unsigned char grey, unsigned char alpha, int x, int y, int w, int h); |
25553
6ac1ece1f9fe
Add multiple inclusion guards to all header files that lack them.
diego
parents:
25502
diff
changeset
|
94 |
6ac1ece1f9fe
Add multiple inclusion guards to all header files that lack them.
diego
parents:
25502
diff
changeset
|
95 #endif /* MENU_H */ |