1 /*
2  * Copyright 2008-2013 Various Authors
3  * Copyright 2006 <ft@bewatermyfriend.org>
4  *
5  * heavily based on filters.h
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef CMUS_HELP_H
22 #define CMUS_HELP_H
23 
24 #include "list.h"
25 #include "window.h"
26 #include "search.h"
27 #include "keys.h"
28 
29 struct help_entry {
30 	struct list_head node;
31 	enum {
32 		HE_TEXT,		/* text entries 	*/
33 		HE_BOUND,		/* bound keys		*/
34 		HE_UNBOUND,		/* unbound commands	*/
35 		HE_OPTION,
36 	} type;
37 	union {
38 		const char *text;			/* HE_TEXT	*/
39 		const struct binding *binding;		/* HE_BOUND	*/
40 		const struct command *command;		/* HE_UNBOUND	*/
41 		const struct cmus_opt *option;
42 	};
43 };
44 
iter_to_help_entry(struct iter * iter)45 static inline struct help_entry *iter_to_help_entry(struct iter *iter)
46 {
47 	return iter->data1;
48 }
49 
50 extern struct window *help_win;
51 extern struct searchable *help_searchable;
52 
53 void help_select(void);
54 void help_toggle(void);
55 void help_remove(void);
56 
57 void help_add_bound(const struct binding *bind);
58 void help_remove_bound(const struct binding *bind);
59 void help_remove_unbound(struct command *cmd);
60 void help_add_unbound(struct command *cmd);
61 void help_add_all_unbound(void);
62 
63 void help_init(void);
64 void help_exit(void);
65 
66 #endif /* HELP_H */
67