1 /* vifm 2 * Copyright (C) 2014 xaizek. 3 * 4 * This program 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. 8 * 9 * This program 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. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 */ 18 19 #ifndef VIFM__ENGINE__MODE_H__ 20 #define VIFM__ENGINE__MODE_H__ 21 22 /* The concept: 23 * 24 * 1. Two kinds of modes: primary and secondary; defined by their interoperation 25 * in UI; 26 * 27 * 2. While secondary mode is active primary is still visible, although it does 28 * not get any input from a user. 29 * 30 * 3. Secondary mode is also the current one. There might be two generic 31 * situations: 32 * 33 * - no secondary mode, when vle_mode_get() == vle_mode_get_primary(); 34 * - secondary mode present, which makes "current" and "primary" modes be 35 * different. */ 36 37 /* Type of mode. */ 38 typedef enum 39 { 40 VMT_PRIMARY, /* Host (main) mode (e.g. normal, visual). */ 41 VMT_SECONDARY, /* Temporary (auxiliary) mode (e.g. command-line, dialog). */ 42 } 43 VleModeType; 44 45 /* Mode identifier. It's of integer type. */ 46 typedef int vle_mode_t; 47 48 /* Gets identifier of currently active mode. Returns the id. */ 49 vle_mode_t vle_mode_get(void); 50 51 /* Checks that currently active mode is the mode. Returns non-zero if so, 52 * otherwise zero is returned. */ 53 int vle_mode_is(vle_mode_t mode); 54 55 /* Gets identifier of currently active primary mode. Returns the id. */ 56 vle_mode_t vle_mode_get_primary(void); 57 58 /* Checks that primary mode is the mode. Returns non-zero if so, otherwise zero 59 * is returned. */ 60 int vle_primary_mode_is(vle_mode_t mode); 61 62 /* Sets current mode of the specified type. */ 63 void vle_mode_set(vle_mode_t mode, VleModeType type); 64 65 #endif /* VIFM__ENGINE__MODE_H__ */ 66 67 /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ 68 /* vim: set cinoptions+=t0 filetype=c : */ 69