Mercurial > mplayer.hg
annotate libmenu/menu.h @ 18654:9fb5e9cdcae8
re-added some missing messages (who removed these anyway?)
svn-ify revision tag
author | kraymer |
---|---|
date | Thu, 08 Jun 2006 18:56:33 +0000 |
parents | e8cbaf092e96 |
children | f57977ac0394 |
rev | line source |
---|---|
8197 | 1 |
2 struct menu_priv_s; | |
3 typedef struct menu_s menu_t; | |
4 | |
5 struct menu_s { | |
6 void (*draw)(menu_t* menu,mp_image_t* mpi); | |
7 void (*read_cmd)(menu_t* menu,int cmd); | |
8 void (*read_key)(menu_t* menu,int cmd); | |
9 void (*close)(menu_t* menu); | |
10 m_struct_t* priv_st; | |
11 struct menu_priv_s* priv; | |
12 int show; // Draw it ? | |
13 int cl; // Close request (user sent a close cmd or | |
14 menu_t* parent; | |
15 }; | |
16 | |
17 typedef struct menu_info_s { | |
18 const char *info; | |
19 const char *name; | |
20 const char *author; | |
21 const char *comment; | |
22 m_struct_t priv_st; // Config struct definition | |
23 // cfg is a config struct as defined in cfg_st, it may be used as a priv struct | |
24 // cfg is filled from the attributs found in the cfg file | |
25 // the args param hold the content of the balise in the cfg file (if any) | |
26 int (*open)(menu_t* menu, char* args); | |
27 } menu_info_t; | |
28 | |
29 | |
30 #define MENU_CMD_UP 0 | |
31 #define MENU_CMD_DOWN 1 | |
32 #define MENU_CMD_OK 2 | |
33 #define MENU_CMD_CANCEL 3 | |
17945
98f4e3704a76
Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents:
8197
diff
changeset
|
34 #define MENU_CMD_LEFT 4 |
98f4e3704a76
Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents:
8197
diff
changeset
|
35 #define MENU_CMD_RIGHT 5 |
8197 | 36 |
37 /// Global init/uninit | |
38 int menu_init(char* cfg_file); | |
39 void menu_unint(void); | |
40 | |
41 /// Open a menu defined in the config file | |
42 menu_t* menu_open(char *name); | |
43 | |
44 void menu_draw(menu_t* menu,mp_image_t* mpi); | |
45 void menu_read_cmd(menu_t* menu,int cmd); | |
46 void menu_close(menu_t* menu); | |
47 void menu_read_key(menu_t* menu,int cmd); | |
48 | |
49 //// Default implementation | |
50 void menu_dflt_read_key(menu_t* menu,int cmd); | |
51 | |
52 /////////// Helpers | |
53 | |
54 #define MENU_TEXT_TOP (1<<0) | |
55 #define MENU_TEXT_VCENTER (1<<1) | |
56 #define MENU_TEXT_BOT (1<<2) | |
57 #define MENU_TEXT_VMASK (MENU_TEXT_TOP|MENU_TEXT_VCENTER|MENU_TEXT_BOT) | |
58 #define MENU_TEXT_LEFT (1<<3) | |
59 #define MENU_TEXT_HCENTER (1<<4) | |
60 #define MENU_TEXT_RIGHT (1<<5) | |
61 #define MENU_TEXT_HMASK (MENU_TEXT_LEFT|MENU_TEXT_HCENTER|MENU_TEXT_RIGHT) | |
62 #define MENU_TEXT_CENTER (MENU_TEXT_VCENTER|MENU_TEXT_HCENTER) | |
63 | |
64 void menu_draw_text(mp_image_t* mpi, char* txt, int x, int y); | |
65 int menu_text_length(char* txt); | |
66 int menu_text_num_lines(char* txt, int max_width); | |
67 | |
68 void menu_text_size(char* txt,int max_width, | |
69 int vspace, int warp, | |
70 int* _w, int* _h); | |
71 | |
72 void menu_draw_text_full(mp_image_t* mpi,char* txt, | |
73 int x, int y,int w, int h, | |
74 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
|
75 |
18193 | 76 void menu_draw_box(mp_image_t* mpi, unsigned char grey, unsigned char alpha, int x, int y, int w, int h); |