annotate libmenu/menu.h @ 26024:4f056043c2c1

Remove misplaced #endif comment.
author diego
date Thu, 21 Feb 2008 22:28:58 +0000
parents 6ac1ece1f9fe
children 4129c8cfa742
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
3
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
4 struct menu_priv_s;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
5 typedef struct menu_s menu_t;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
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
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
11 struct menu_s {
22284
83366c8e1928 Fix menu to work with mpctx
uau
parents: 19490
diff changeset
12 struct MPContext *ctx;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
13 void (*draw)(menu_t* menu,mp_image_t* mpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
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
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
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
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
18 struct menu_priv_s* priv;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
19 int show; // Draw it ?
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
20 int cl; // Close request (user sent a close cmd or
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
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
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
23 };
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
24
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
25 typedef struct menu_info_s {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
26 const char *info;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
27 const char *name;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
28 const char *author;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
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
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
31 // cfg is a config struct as defined in cfg_st, it may be used as a priv struct
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
32 // cfg is filled from the attributs found in the cfg file
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
33 // the args param hold the content of the balise in the cfg file (if any)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
34 int (*open)(menu_t* menu, char* args);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
35 } menu_info_t;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
36
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
37
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
38 #define MENU_CMD_UP 0
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
39 #define MENU_CMD_DOWN 1
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
40 #define MENU_CMD_OK 2
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
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
7ef04742572c OSD menu support mouse selection.
ulion
parents: 25420
diff changeset
49 #define MENU_CMD_CLICK 11
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
50
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
51 /// Global init/uninit
22284
83366c8e1928 Fix menu to work with mpctx
uau
parents: 19490
diff changeset
52 int menu_init(struct MPContext *mpctx, char* cfg_file);
25420
e5a7f0401180 Fix the menu uninit function name.
ulion
parents: 25419
diff changeset
53 void menu_uninit(void);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
54
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
55 /// Open a menu defined in the config file
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
56 menu_t* menu_open(char *name);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
57
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
58 void menu_draw(menu_t* menu,mp_image_t* mpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
59 void menu_read_cmd(menu_t* menu,int cmd);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
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
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
62
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
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
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
65
25461
7ef04742572c OSD menu support mouse selection.
ulion
parents: 25420
diff changeset
66 /// Receive mouse position events.
7ef04742572c OSD menu support mouse selection.
ulion
parents: 25420
diff changeset
67 void menu_update_mouse_pos(double x, double y);
7ef04742572c OSD menu support mouse selection.
ulion
parents: 25420
diff changeset
68
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
69 /////////// Helpers
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
70
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
71 #define MENU_TEXT_TOP (1<<0)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
72 #define MENU_TEXT_VCENTER (1<<1)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
73 #define MENU_TEXT_BOT (1<<2)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
74 #define MENU_TEXT_VMASK (MENU_TEXT_TOP|MENU_TEXT_VCENTER|MENU_TEXT_BOT)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
75 #define MENU_TEXT_LEFT (1<<3)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
76 #define MENU_TEXT_HCENTER (1<<4)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
77 #define MENU_TEXT_RIGHT (1<<5)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
78 #define MENU_TEXT_HMASK (MENU_TEXT_LEFT|MENU_TEXT_HCENTER|MENU_TEXT_RIGHT)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
79 #define MENU_TEXT_CENTER (MENU_TEXT_VCENTER|MENU_TEXT_HCENTER)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
80
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
81 void menu_draw_text(mp_image_t* mpi, char* txt, int x, int y);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
82 int menu_text_length(char* txt);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
83 int menu_text_num_lines(char* txt, int max_width);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
84
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
85 void menu_text_size(char* txt,int max_width,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
86 int vspace, int warp,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
87 int* _w, int* _h);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
88
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
89 void menu_draw_text_full(mp_image_t* mpi,char* txt,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
90 int x, int y,int w, int h,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
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
e8cbaf092e96 Fix menu background drawing.
albeu
parents: 17993
diff changeset
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 */