1 /* vifm 2 * Copyright (C) 2013 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__UI__COLOR_MANAGER_H__ 20 #define VIFM__UI__COLOR_MANAGER_H__ 21 22 /* Initialization data for colmgr_init(). */ 23 typedef struct 24 { 25 /* Maximum number of color pairs. */ 26 int max_color_pairs; 27 28 /* Maximum number of colors. */ 29 int max_colors; 30 31 /* Function to set value of a color pair. Should return zero on success and 32 * anything else otherwise. */ 33 int (*init_pair)(short int pair, short int f, short int b); 34 35 /* Function to get value of a color pair. Should return zero on success and 36 * anything else otherwise. */ 37 int (*pair_content)(short int pair, short int *f, short int *b); 38 39 /* Checks whether pair is being used at the moment. Should return non-zero if 40 * so and zero otherwise. */ 41 int (*pair_in_use)(short int pair); 42 43 /* Substitutes old pair number with the new one. */ 44 void (*move_pair)(short int from, short int to); 45 } 46 colmgr_conf_t; 47 48 /* Initializes color manager unit. Creates and prepares internal variables. */ 49 void colmgr_init(const colmgr_conf_t *conf_init); 50 51 /* Resets all color pairs that are available for dynamic allocation. */ 52 void colmgr_reset(void); 53 54 /* Gets (might dynamically allocate) color pair number for specified 55 * foreground (fg) and background (bg) colors. Returns the number. On failure 56 * falls back to color pair 0. */ 57 int colmgr_get_pair(int fg, int bg); 58 59 #endif /* VIFM__UI__COLOR_MANAGER_H__ */ 60 61 /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ 62 /* vim: set cinoptions+=t0 filetype=c : */ 63