annotate libmenu/menu.h @ 15359:af245d15f502

added twolame mp2 audio encoder
author nicodvb
date Sat, 07 May 2005 14:50:14 +0000
parents b31caec933e9
children 98f4e3704a76
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
1
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
2 struct menu_priv_s;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
3 typedef struct menu_s menu_t;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
4
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
5 struct menu_s {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
6 void (*draw)(menu_t* menu,mp_image_t* mpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
7 void (*read_cmd)(menu_t* menu,int cmd);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
8 void (*read_key)(menu_t* menu,int cmd);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
9 void (*close)(menu_t* menu);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
10 m_struct_t* priv_st;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
11 struct menu_priv_s* priv;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
12 int show; // Draw it ?
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
13 int cl; // Close request (user sent a close cmd or
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
14 menu_t* parent;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
15 };
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
16
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
17 typedef struct menu_info_s {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
18 const char *info;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
19 const char *name;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
20 const char *author;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
21 const char *comment;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
22 m_struct_t priv_st; // Config struct definition
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
23 // 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
24 // cfg is filled from the attributs found in the cfg file
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
25 // the args param hold the content of the balise in the cfg file (if any)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
26 int (*open)(menu_t* menu, char* args);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
27 } menu_info_t;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
28
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
29
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
30 #define MENU_CMD_UP 0
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
31 #define MENU_CMD_DOWN 1
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
32 #define MENU_CMD_OK 2
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
33 #define MENU_CMD_CANCEL 3
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
34
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
35 /// Global init/uninit
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
36 int menu_init(char* cfg_file);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
37 void menu_unint(void);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
38
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
39 /// Open a menu defined in the config file
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
40 menu_t* menu_open(char *name);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
41
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
42 void menu_draw(menu_t* menu,mp_image_t* mpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
43 void menu_read_cmd(menu_t* menu,int cmd);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
44 void menu_close(menu_t* menu);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
45 void menu_read_key(menu_t* menu,int cmd);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
46
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
47 //// Default implementation
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
48 void menu_dflt_read_key(menu_t* menu,int cmd);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
49
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
50 /////////// Helpers
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
51
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
52 #define MENU_TEXT_TOP (1<<0)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
53 #define MENU_TEXT_VCENTER (1<<1)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
54 #define MENU_TEXT_BOT (1<<2)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
55 #define MENU_TEXT_VMASK (MENU_TEXT_TOP|MENU_TEXT_VCENTER|MENU_TEXT_BOT)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
56 #define MENU_TEXT_LEFT (1<<3)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
57 #define MENU_TEXT_HCENTER (1<<4)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
58 #define MENU_TEXT_RIGHT (1<<5)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
59 #define MENU_TEXT_HMASK (MENU_TEXT_LEFT|MENU_TEXT_HCENTER|MENU_TEXT_RIGHT)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
60 #define MENU_TEXT_CENTER (MENU_TEXT_VCENTER|MENU_TEXT_HCENTER)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
61
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
62 void menu_draw_text(mp_image_t* mpi, char* txt, int x, int y);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
63 int menu_text_length(char* txt);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
64 int menu_text_num_lines(char* txt, int max_width);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
65
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
66 void menu_text_size(char* txt,int max_width,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
67 int vspace, int warp,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
68 int* _w, int* _h);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
69
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
70 void menu_draw_text_full(mp_image_t* mpi,char* txt,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
71 int x, int y,int w, int h,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
72 int vspace, int warp, int align, int anchor);