1 /* vifm
2  * Copyright (C) 2001 Ken Steen.
3  * Copyright (C) 2011 xaizek.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
18  */
19 
20 #ifndef VIFM__MODES__MENU_H__
21 #define VIFM__MODES__MENU_H__
22 
23 #include "../menus/menus.h"
24 #include "../utils/test_helpers.h"
25 #include "cmdline.h"
26 
27 struct view_t;
28 
29 /* Initializes menu mode. */
30 void modmenu_init(void);
31 
32 /* Enters menu mode. */
33 void modmenu_enter(menu_data_t *m, struct view_t *active_view);
34 
35 /* Aborts menu mode. */
36 void modmenu_abort(void);
37 
38 /* Replaces menu of the menu mode. */
39 void modmenu_reenter(menu_data_t *m);
40 
41 /* Performs pre main loop actions for the menu mode, which is assumed to be
42  * activated. */
43 void modmenu_pre(void);
44 
45 /* Performs post-actions (at the end of input processing loop) for the menu
46  * mode. */
47 void modmenu_post(void);
48 
49 /* Redraws menu mode. */
50 void modmenu_full_redraw(void);
51 
52 /* Redraws only the main part of menu (window with elements) assuming that size
53  * and other elements are handled elsewhere. */
54 void modmenu_partial_redraw(void);
55 
56 /* Saves information about position into temporary storage (can't store more
57  * than one state). */
58 void modmenu_save_pos(void);
59 
60 /* Restores previously saved position information. */
61 void modmenu_restore_pos(void);
62 
63 /* Leaves menu and starts command-line mode.  external flag shows whether
64  * cmd should be prepended with ":!".  To be used from keyboard handlers, which
65  * in this case must return KHR_MORPHED_MENU. */
66 void modmenu_morph_into_cline(CmdLineSubmode submode, const char input[],
67 		int external);
68 
69 /* Allows running regular command-line mode commands from menu mode. */
70 void modmenu_run_command(const char cmd[]);
71 
72 /* Returns index of last visible line in the menu.  Value returned may be
73  * greater than or equal to number of lines in the menu, which should be
74  * treated correctly. */
75 int modmenu_last_line(const menu_data_t *m);
76 
77 TSTATIC_DEFS(
78 	menu_data_t * menu_get_current(void);
79 )
80 
81 #endif /* VIFM__MODES__MENU_H__ */
82 
83 /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */
84 /* vim: set cinoptions+=t0 filetype=c : */
85