rpm: Remove MEncoder from rpm packaging
[mplayer/glamo.git] / libmenu / menu.h
blob0414aea9b4c39f7c7a38dddc73f2547a9924f8b6
1 /*
2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #ifndef MPLAYER_MENU_H
20 #define MPLAYER_MENU_H
22 #include "m_struct.h"
23 #include "libmpcodecs/mp_image.h"
25 extern double menu_mouse_x;
26 extern double menu_mouse_y;
27 extern int menu_mouse_pos_updated;
28 extern const struct vf_info vf_info_menu;
30 struct menu_priv_s;
31 typedef struct menu_s menu_t;
33 typedef struct menu_def_st menu_def_t;
35 struct m_struct_st;
37 struct menu_s {
38 struct MPContext *ctx;
39 struct m_config *mconfig;
40 struct input_ctx *input_ctx;
41 void (*draw)(menu_t* menu,mp_image_t* mpi);
42 void (*read_cmd)(menu_t* menu,int cmd);
43 int (*read_key)(menu_t* menu,int cmd);
44 void (*close)(menu_t* menu);
45 struct m_struct_st* priv_st;
46 struct menu_priv_s* priv;
47 int show; // Draw it ?
48 int cl; // Close request (user sent a close cmd or
49 menu_t* parent;
50 menu_def_t *type;
53 typedef struct menu_info_s {
54 const char *info;
55 const char *name;
56 const char *author;
57 const char *comment;
58 struct m_struct_st priv_st; // Config struct definition
59 // cfg is a config struct as defined in cfg_st, it may be used as a priv struct
60 // cfg is filled from the attributs found in the cfg file
61 // the args param hold the content of the balise in the cfg file (if any)
62 int (*open)(menu_t* menu, char* args);
63 } menu_info_t;
66 #define MENU_CMD_UP 0
67 #define MENU_CMD_DOWN 1
68 #define MENU_CMD_OK 2
69 #define MENU_CMD_CANCEL 3
70 #define MENU_CMD_LEFT 4
71 #define MENU_CMD_RIGHT 5
72 #define MENU_CMD_ACTION 6
73 #define MENU_CMD_HOME 7
74 #define MENU_CMD_END 8
75 #define MENU_CMD_PAGE_UP 9
76 #define MENU_CMD_PAGE_DOWN 10
77 #define MENU_CMD_CLICK 11
79 /// Global init/uninit
80 int menu_init(struct MPContext *mpctx, struct m_config *mconfig,
81 struct input_ctx *input_ctx, char* cfg_file);
82 void menu_uninit(void);
84 /// Open a menu defined in the config file
85 menu_t* menu_open(char *name);
87 void menu_draw(menu_t* menu,mp_image_t* mpi);
88 void menu_read_cmd(menu_t* menu,int cmd);
89 void menu_close(menu_t* menu);
90 int menu_read_key(menu_t* menu,int cmd);
92 //// Default implementation
93 int menu_dflt_read_key(menu_t* menu,int cmd);
95 /// Receive mouse position events.
96 void menu_update_mouse_pos(double x, double y);
98 /////////// Helpers
100 #define MENU_TEXT_TOP (1<<0)
101 #define MENU_TEXT_VCENTER (1<<1)
102 #define MENU_TEXT_BOT (1<<2)
103 #define MENU_TEXT_VMASK (MENU_TEXT_TOP|MENU_TEXT_VCENTER|MENU_TEXT_BOT)
104 #define MENU_TEXT_LEFT (1<<3)
105 #define MENU_TEXT_HCENTER (1<<4)
106 #define MENU_TEXT_RIGHT (1<<5)
107 #define MENU_TEXT_HMASK (MENU_TEXT_LEFT|MENU_TEXT_HCENTER|MENU_TEXT_RIGHT)
108 #define MENU_TEXT_CENTER (MENU_TEXT_VCENTER|MENU_TEXT_HCENTER)
110 void menu_draw_text(mp_image_t* mpi, char* txt, int x, int y);
111 int menu_text_length(char* txt);
112 int menu_text_num_lines(char* txt, int max_width);
114 void menu_text_size(char* txt,int max_width,
115 int vspace, int warp,
116 int* _w, int* _h);
118 void menu_draw_text_full(mp_image_t* mpi,char* txt,
119 int x, int y,int w, int h,
120 int vspace, int warp, int align, int anchor);
122 void menu_draw_box(mp_image_t* mpi, unsigned char grey, unsigned char alpha, int x, int y, int w, int h);
124 struct vf_instance;
125 void vf_menu_pause_update(struct vf_instance *vf);
127 #endif /* MPLAYER_MENU_H */