annotate libmenu/menu.h @ 36029:49be954ad61a

Move variable declarations and definitions where they belong.
author ib
date Sun, 31 Mar 2013 22:36:42 +0000
parents aad2bda4f65f
children 2c8fbf453871
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28113
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 26139
diff changeset
1 /*
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 26139
diff changeset
2 * This file is part of MPlayer.
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 26139
diff changeset
3 *
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 26139
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 26139
diff changeset
5 * it under the terms of the GNU General Public License as published by
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 26139
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 26139
diff changeset
7 * (at your option) any later version.
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 26139
diff changeset
8 *
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 26139
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 26139
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 26139
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 26139
diff changeset
12 * GNU General Public License for more details.
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 26139
diff changeset
13 *
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 26139
diff changeset
14 * You should have received a copy of the GNU General Public License along
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 26139
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 26139
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 26139
diff changeset
17 */
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 26139
diff changeset
18
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25553
diff changeset
19 #ifndef MPLAYER_MENU_H
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25553
diff changeset
20 #define MPLAYER_MENU_H
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
21
26139
4ebf3c3f2bf6 Add missing header #includes to fix 'make checkheaders'.
diego
parents: 26029
diff changeset
22 #include "m_struct.h"
4ebf3c3f2bf6 Add missing header #includes to fix 'make checkheaders'.
diego
parents: 26029
diff changeset
23 #include "libmpcodecs/mp_image.h"
30540
bf9ec7f73c86 Declare vf_menu_pause_update in libmenu/menu.h.
diego
parents: 29263
diff changeset
24 #include "libmpcodecs/vf.h"
26139
4ebf3c3f2bf6 Add missing header #includes to fix 'make checkheaders'.
diego
parents: 26029
diff changeset
25
31380
1c540767767e Move menu-related extern variable declarations to menu.h.
diego
parents: 30642
diff changeset
26 extern char *menu_chroot;
1c540767767e Move menu-related extern variable declarations to menu.h.
diego
parents: 30642
diff changeset
27 extern char *menu_fribidi_charset;
1c540767767e Move menu-related extern variable declarations to menu.h.
diego
parents: 30642
diff changeset
28 extern int menu_flip_hebrew;
1c540767767e Move menu-related extern variable declarations to menu.h.
diego
parents: 30642
diff changeset
29 extern int menu_fribidi_flip_commas;
1c540767767e Move menu-related extern variable declarations to menu.h.
diego
parents: 30642
diff changeset
30 extern int menu_keepdir;
1c540767767e Move menu-related extern variable declarations to menu.h.
diego
parents: 30642
diff changeset
31 extern int menu_startup;
32000
8278ef02b2e5 Move menu_mouse_* extern declarations to menu.h, where they belong.
diego
parents: 31380
diff changeset
32 extern double menu_mouse_x;
8278ef02b2e5 Move menu_mouse_* extern declarations to menu.h, where they belong.
diego
parents: 31380
diff changeset
33 extern double menu_mouse_y;
8278ef02b2e5 Move menu_mouse_* extern declarations to menu.h, where they belong.
diego
parents: 31380
diff changeset
34 extern int menu_mouse_pos_updated;
32025
23d8b025634a Mark vf_info_menu declaration as const.
diego
parents: 32005
diff changeset
35 extern const vf_info_t vf_info_menu;
31380
1c540767767e Move menu-related extern variable declarations to menu.h.
diego
parents: 30642
diff changeset
36
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
37 struct menu_priv_s;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
38 typedef struct menu_s menu_t;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
39
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
40 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
41
25417
b0cd876a0c32 Remove dependency on m_struct.h when include libmenu/menu.h.
ulion
parents: 25263
diff changeset
42 struct m_struct_st;
b0cd876a0c32 Remove dependency on m_struct.h when include libmenu/menu.h.
ulion
parents: 25263
diff changeset
43
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
44 struct menu_s {
22284
83366c8e1928 Fix menu to work with mpctx
uau
parents: 19490
diff changeset
45 struct MPContext *ctx;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
46 void (*draw)(menu_t* menu,mp_image_t* mpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
47 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
48 int (*read_key)(menu_t* menu,int cmd);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
49 void (*close)(menu_t* menu);
35303
aad2bda4f65f Fix const correctness.
reimar
parents: 32025
diff changeset
50 const struct m_struct_st* priv_st;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
51 struct menu_priv_s* priv;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
52 int show; // Draw it ?
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
53 int cl; // Close request (user sent a close cmd or
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
54 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
55 menu_def_t *type;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
56 };
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
57
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
58 typedef struct menu_info_s {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
59 const char *info;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
60 const char *name;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
61 const char *author;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
62 const char *comment;
25419
59aba7a96701 Replace another m_struct_t by 'struct m_struct_st' to remove depedency
ulion
parents: 25417
diff changeset
63 struct m_struct_st priv_st; // Config struct definition
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
64 // 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
65 // cfg is filled from the attributs found in the cfg file
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
66 // the args param hold the content of the balise in the cfg file (if any)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
67 int (*open)(menu_t* menu, char* args);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
68 } menu_info_t;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
69
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
70
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
71 #define MENU_CMD_UP 0
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
72 #define MENU_CMD_DOWN 1
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
73 #define MENU_CMD_OK 2
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
74 #define MENU_CMD_CANCEL 3
17945
98f4e3704a76 Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents: 8197
diff changeset
75 #define MENU_CMD_LEFT 4
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28113
diff changeset
76 #define MENU_CMD_RIGHT 5
19490
f57977ac0394 support multiple actions in menu's file browser using key bindings
ben
parents: 18193
diff changeset
77 #define MENU_CMD_ACTION 6
25263
96d0992c7920 Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents: 25208
diff changeset
78 #define MENU_CMD_HOME 7
96d0992c7920 Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents: 25208
diff changeset
79 #define MENU_CMD_END 8
96d0992c7920 Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents: 25208
diff changeset
80 #define MENU_CMD_PAGE_UP 9
96d0992c7920 Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents: 25208
diff changeset
81 #define MENU_CMD_PAGE_DOWN 10
25461
7ef04742572c OSD menu support mouse selection.
ulion
parents: 25420
diff changeset
82 #define MENU_CMD_CLICK 11
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
83
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
84 /// Global init/uninit
22284
83366c8e1928 Fix menu to work with mpctx
uau
parents: 19490
diff changeset
85 int menu_init(struct MPContext *mpctx, char* cfg_file);
25420
e5a7f0401180 Fix the menu uninit function name.
ulion
parents: 25419
diff changeset
86 void menu_uninit(void);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
87
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
88 /// Open a menu defined in the config file
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
89 menu_t* menu_open(char *name);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
90
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
91 void menu_draw(menu_t* menu,mp_image_t* mpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
92 void menu_read_cmd(menu_t* menu,int cmd);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
93 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
94 int menu_read_key(menu_t* menu,int cmd);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
95
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
96 //// Default implementation
25263
96d0992c7920 Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents: 25208
diff changeset
97 int menu_dflt_read_key(menu_t* menu,int cmd);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
98
25461
7ef04742572c OSD menu support mouse selection.
ulion
parents: 25420
diff changeset
99 /// Receive mouse position events.
7ef04742572c OSD menu support mouse selection.
ulion
parents: 25420
diff changeset
100 void menu_update_mouse_pos(double x, double y);
7ef04742572c OSD menu support mouse selection.
ulion
parents: 25420
diff changeset
101
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
102 /////////// Helpers
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
103
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
104 #define MENU_TEXT_TOP (1<<0)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
105 #define MENU_TEXT_VCENTER (1<<1)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
106 #define MENU_TEXT_BOT (1<<2)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
107 #define MENU_TEXT_VMASK (MENU_TEXT_TOP|MENU_TEXT_VCENTER|MENU_TEXT_BOT)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
108 #define MENU_TEXT_LEFT (1<<3)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
109 #define MENU_TEXT_HCENTER (1<<4)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
110 #define MENU_TEXT_RIGHT (1<<5)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
111 #define MENU_TEXT_HMASK (MENU_TEXT_LEFT|MENU_TEXT_HCENTER|MENU_TEXT_RIGHT)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
112 #define MENU_TEXT_CENTER (MENU_TEXT_VCENTER|MENU_TEXT_HCENTER)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
113
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
114 void menu_draw_text(mp_image_t* mpi, char* txt, int x, int y);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
115 int menu_text_length(char* txt);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
116 int menu_text_num_lines(char* txt, int max_width);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
117
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28113
diff changeset
118 void menu_text_size(char* txt,int max_width,
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
119 int vspace, int warp,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
120 int* _w, int* _h);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
121
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
122 void menu_draw_text_full(mp_image_t* mpi,char* txt,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
123 int x, int y,int w, int h,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
124 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
125
18193
e8cbaf092e96 Fix menu background drawing.
albeu
parents: 17993
diff changeset
126 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
127
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30540
diff changeset
128 void vf_menu_pause_update(struct vf_instance *vf);
30540
bf9ec7f73c86 Declare vf_menu_pause_update in libmenu/menu.h.
diego
parents: 29263
diff changeset
129
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25553
diff changeset
130 #endif /* MPLAYER_MENU_H */