ekg2
|
00001 /* $Id: vars.h 4062 2008-07-08 08:17:16Z darkjames $ */ 00002 00003 /* 00004 * (C) Copyright 2001-2003 Wojtek Kaniewski <wojtekka@irc.pl> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License Version 2 as 00008 * published by the Free Software Foundation. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __EKG_VARS_H 00021 #define __EKG_VARS_H 00022 00023 #include "plugins.h" 00024 00025 typedef enum { 00026 VAR_STR, /* ciąg znaków */ 00027 VAR_INT, /* liczba całkowita */ 00028 VAR_BOOL, /* 0/1, tak/nie, yes/no, on/off */ 00029 VAR_MAP, /* bitmapa */ 00030 VAR_FILE, /* plik */ 00031 VAR_DIR, /* katalog */ 00032 VAR_THEME, /* theme */ 00033 00034 VAR_REMOTE /* remote, not used by plugins */ 00035 } variable_class_t; 00036 00037 typedef struct { 00038 char *label; /* nazwa wartości */ 00039 int value; /* wartość */ 00040 int conflicts; /* wartości, z którymi koliduje */ 00041 } variable_map_t; 00042 00043 typedef void (variable_notify_func_t)(const char *); 00044 typedef void (variable_check_func_t)(const char *, const char *); 00045 typedef int (variable_display_func_t)(const char *); 00046 00047 typedef struct variable { 00048 struct variable *next; 00049 00050 char *name; /* ekg2-remote: OK */ 00051 plugin_t *plugin; /* ekg2-remote: NONE */ 00052 int name_hash; /* ekg2-remote: OK */ 00053 int type; /* ekg2-remote: VAR_STR, ncurses completion BAD */ 00054 int display; /* ekg2-remote: ? 0 bez wartości, 1 pokazuje, 2 w ogóle */ 00055 void *ptr; /* ekg2-remote: OK, olewamy wartosc */ 00056 variable_check_func_t *check; /* ekg2-remote: BAD */ 00057 variable_notify_func_t *notify; /* ekg2-remote: ? */ 00058 variable_map_t *map; /* ekg2-remote: BAD */ 00059 variable_display_func_t *dyndisplay; /* ekg2-remote: BAD */ 00060 } variable_t; 00061 00062 extern variable_t *variables; 00063 00064 void variable_init(); 00065 variable_t *variable_find(const char *name); 00066 variable_map_t *variable_map(int count, ...); 00067 00068 variable_t *variable_add(plugin_t *plugin, const char *name, int type, int display, void *ptr, variable_notify_func_t *notify, variable_map_t *map, variable_display_func_t *dyndisplay); 00069 variable_t *remote_variable_add(const char *name, const char *value); 00070 00071 variable_t *variables_removei(variable_t *v); 00072 00073 void variables_destroy(); 00074 00075 #endif /* __EKG_VARS_H */ 00076 00077 /* 00078 * Local Variables: 00079 * mode: c 00080 * c-file-style: "k&r" 00081 * c-basic-offset: 8 00082 * indent-tabs-mode: t 00083 * End: 00084 */