annotate libmenu/menu_list.h @ 33929:ef9b6445fc55

Ensure we do not use 100% CPU when waiting for input with no file-based inputs.
author reimar
date Sat, 27 Aug 2011 09:58:54 +0000
parents 0f1b5b68af32
children
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_LIST_H
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25553
diff changeset
20 #define MPLAYER_MENU_LIST_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 "menu.h"
4ebf3c3f2bf6 Add missing header #includes to fix 'make checkheaders'.
diego
parents: 26029
diff changeset
23
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
24 typedef struct list_entry_s list_entry_t;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
25
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
26
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
27 #ifdef IMPL
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
28 struct list_entry_s {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
29 #else
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
30 struct list_entry {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
31 #endif
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
32 list_entry_t* prev;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
33 list_entry_t* next;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
34
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
35 char* txt;
17946
0afe12256464 Allow hiding list elements and disableing the pointer.
albeu
parents: 8197
diff changeset
36 char hide;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
37 };
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
38
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
39
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
40 #ifndef IMPL
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
41 typedef struct menu_list_priv_s {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
42 #else
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
43 typedef struct menu_priv_s {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
44 #endif
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
45 list_entry_t* menu;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
46 list_entry_t* current;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
47 int count;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
48
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
49 char* title;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
50 int x,y;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
51 int w,h;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
52 int vspace, minb;
24979
476d4922566a Make page up and down with proper page size instead of always 10 rows.
ulion
parents: 19759
diff changeset
53 int disp_lines;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
54 char* ptr;
17993
98eb966a4024 Add a function to draw flat boxes and use it to make the list
albeu
parents: 17946
diff changeset
55 int title_bg,title_bg_alpha;
98eb966a4024 Add a function to draw flat boxes and use it to make the list
albeu
parents: 17946
diff changeset
56 int item_bg,item_bg_alpha;
98eb966a4024 Add a function to draw flat boxes and use it to make the list
albeu
parents: 17946
diff changeset
57 int ptr_bg,ptr_bg_alpha;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
58 } menu_list_priv_t;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
59
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
60 typedef void (*free_entry_t)(list_entry_t* entry);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
61
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
62 void menu_list_read_cmd(menu_t* menu,int cmd);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
63 void menu_list_draw(menu_t* menu,mp_image_t* mpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
64 void menu_list_add_entry(menu_t* menu,list_entry_t* entry);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
65 void menu_list_init(menu_t* menu);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
66 void menu_list_uninit(menu_t* menu,free_entry_t free_func);
25263
96d0992c7920 Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents: 24979
diff changeset
67 int menu_list_jump_to_key(menu_t* menu,int c);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
68
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
69 extern const menu_list_priv_t menu_list_priv_dflt;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
70
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
71 #define MENU_LIST_PRIV_DFLT { \
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
72 NULL, \
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
73 NULL, \
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
74 0, \
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
75 \
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
76 "MPlayer", \
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
77 -1,-1, \
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
78 0,0, \
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
79 5, 3, \
24979
476d4922566a Make page up and down with proper page size instead of always 10 rows.
ulion
parents: 19759
diff changeset
80 0, \
17993
98eb966a4024 Add a function to draw flat boxes and use it to make the list
albeu
parents: 17946
diff changeset
81 NULL, \
19759
9ad9b0a4db27 better readability on selected menu item by tweaking alpha channel properties
ben
parents: 18193
diff changeset
82 0xFF, 0xFF, \
9ad9b0a4db27 better readability on selected menu item by tweaking alpha channel properties
ben
parents: 18193
diff changeset
83 0xFF, 0xFF, \
9ad9b0a4db27 better readability on selected menu item by tweaking alpha channel properties
ben
parents: 18193
diff changeset
84 0xA4, 0x50 \
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
85 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28113
diff changeset
86
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
87
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
88 #define MENU_LIST_PRIV_FIELDS \
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
89 { "minbor", M_ST_OFF(menu_list_priv_t,minb), CONF_TYPE_INT, M_OPT_MIN, 0, 0, NULL }, \
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
90 { "vspace", M_ST_OFF(menu_list_priv_t,vspace), CONF_TYPE_INT, M_OPT_MIN, 0, 0, NULL }, \
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
91 { "x", M_ST_OFF(menu_list_priv_t,x), CONF_TYPE_INT, M_OPT_MIN, 0, 0, NULL }, \
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
92 { "y", M_ST_OFF(menu_list_priv_t,y), CONF_TYPE_INT, M_OPT_MIN, 0, 0, NULL }, \
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
93 { "w", M_ST_OFF(menu_list_priv_t,w), CONF_TYPE_INT, M_OPT_MIN, 0, 0, NULL }, \
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
94 { "h", M_ST_OFF(menu_list_priv_t,h), CONF_TYPE_INT, M_OPT_MIN, 0, 0, NULL }, \
17993
98eb966a4024 Add a function to draw flat boxes and use it to make the list
albeu
parents: 17946
diff changeset
95 { "ptr", M_ST_OFF(menu_list_priv_t,ptr), CONF_TYPE_STRING, 0, 0, 0, NULL }, \
98eb966a4024 Add a function to draw flat boxes and use it to make the list
albeu
parents: 17946
diff changeset
96 { "title-bg", M_ST_OFF(menu_list_priv_t,title_bg), CONF_TYPE_INT, M_OPT_RANGE, -1, 255, NULL }, \
98eb966a4024 Add a function to draw flat boxes and use it to make the list
albeu
parents: 17946
diff changeset
97 { "title-bg-alpha", M_ST_OFF(menu_list_priv_t,title_bg_alpha), \
98eb966a4024 Add a function to draw flat boxes and use it to make the list
albeu
parents: 17946
diff changeset
98 CONF_TYPE_INT, M_OPT_RANGE, 0, 255, NULL }, \
98eb966a4024 Add a function to draw flat boxes and use it to make the list
albeu
parents: 17946
diff changeset
99 { "item-bg", M_ST_OFF(menu_list_priv_t,item_bg), CONF_TYPE_INT, M_OPT_RANGE, -1, 255, NULL }, \
98eb966a4024 Add a function to draw flat boxes and use it to make the list
albeu
parents: 17946
diff changeset
100 { "item-bg-alpha", M_ST_OFF(menu_list_priv_t,item_bg_alpha), \
98eb966a4024 Add a function to draw flat boxes and use it to make the list
albeu
parents: 17946
diff changeset
101 CONF_TYPE_INT, M_OPT_RANGE, 0, 255, NULL }, \
98eb966a4024 Add a function to draw flat boxes and use it to make the list
albeu
parents: 17946
diff changeset
102 { "ptr-bg", M_ST_OFF(menu_list_priv_t,ptr_bg), CONF_TYPE_INT, M_OPT_RANGE, -1, 255, NULL }, \
98eb966a4024 Add a function to draw flat boxes and use it to make the list
albeu
parents: 17946
diff changeset
103 { "ptr-bg-alpha", M_ST_OFF(menu_list_priv_t,ptr_bg_alpha), \
98eb966a4024 Add a function to draw flat boxes and use it to make the list
albeu
parents: 17946
diff changeset
104 CONF_TYPE_INT, M_OPT_RANGE, 0, 255, NULL } \
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
105
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25553
diff changeset
106 #endif /* MPLAYER_MENU_LIST_H */