ekg2
|
00001 /* $Id$ */ 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 "dynstuff.h" 00024 #include "plugins.h" 00025 00026 #ifdef __cplusplus 00027 extern "C" { 00028 #endif 00029 00030 typedef enum { 00031 VAR_STR, /* ciąg znaków */ 00032 VAR_INT, /* liczba całkowita */ 00033 VAR_BOOL, /* 0/1, tak/nie, yes/no, on/off */ 00034 VAR_MAP, /* bitmapa */ 00035 VAR_FILE, /* plik */ 00036 VAR_DIR, /* katalog */ 00037 VAR_THEME /* theme */ 00038 } variable_class_t; 00039 00040 typedef struct { 00041 char *label; /* nazwa wartości */ 00042 int value; /* wartość */ 00043 int conflicts; /* wartości, z którymi koliduje */ 00044 } variable_map_t; 00045 00046 typedef void (variable_notify_func_t)(const char *); 00047 typedef void (variable_check_func_t)(const char *, const char *); 00048 typedef int (variable_display_func_t)(const char *); 00049 00050 typedef struct variable { 00051 struct variable *next; 00052 00053 char *name; /* nazwa zmiennej */ 00054 plugin_t *plugin; /* wstyczka obsługująca zmienną */ 00055 int name_hash; /* hash nazwy zmiennej */ 00056 int type; /* rodzaj */ 00057 int display; /* 0 bez wartości, 1 pokazuje, 2 w ogóle */ 00058 void *ptr; /* wskaźnik do zmiennej */ 00059 variable_check_func_t *check; 00060 /* funkcja sprawdzająca czy wartość jest 00061 * prawidłowa */ 00062 variable_notify_func_t *notify; 00063 /* funkcja wywoływana po zmianie wartości */ 00064 variable_map_t *map; /* mapa wartości i etykiet */ 00065 variable_display_func_t *dyndisplay; 00066 /* funkcja sprawdzająca, czy zmienną można 00067 * wyświetlić na liście zmiennych */ 00068 } variable_t; 00069 00070 #ifndef EKG2_WIN32_NOFUNCTION 00071 00072 extern variable_t *variables; 00073 00074 void variable_init(); 00075 void variable_set_default(); 00076 variable_t *variable_find(const char *name); 00077 variable_map_t *variable_map(int count, ...); 00078 #define variable_hash ekg_hash 00079 00080 variable_t *variable_add( 00081 plugin_t *plugin, 00082 const char *name, 00083 int type, 00084 int display, 00085 void *ptr, 00086 variable_notify_func_t *notify, 00087 variable_map_t *map, 00088 variable_display_func_t *dyndisplay); 00089 00090 int variable_set(const char *name, const char *value); 00091 void variable_help(const char *name); 00092 int variable_remove(plugin_t *plugin, const char *name); 00093 00094 variable_t *variables_removei(variable_t *v); 00095 void variables_destroy(); 00096 00097 #endif 00098 00099 #ifdef __cplusplus 00100 } 00101 #endif 00102 00103 #endif /* __EKG_VARS_H */ 00104 00105 /* 00106 * Local Variables: 00107 * mode: c 00108 * c-file-style: "k&r" 00109 * c-basic-offset: 8 00110 * indent-tabs-mode: t 00111 * End: 00112 */