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