New silcconfig library and server parser. Merged silc-newconfig-final.patch.
[runtime.git] / apps / irssi / src / fe-common / core / themes.h
1 #ifndef __THEMES_H
2 #define __THEMES_H
3
4 typedef struct {
5         char *name;
6
7         int count;
8         char **formats; /* in same order as in module's default formats */
9         char **expanded_formats; /* this contains the formats after
10                                     expanding {templates} */
11 } MODULE_THEME_REC;
12
13 typedef struct {
14         char *path;
15         char *name;
16         time_t last_modify;
17
18         int default_color; /* default color to use with text with default
19                               background. default is -1 which means the
20                               default color set by terminal */
21         GHashTable *modules;
22
23         int replace_keys[256]; /* index to replace_values for each char */
24         GSList *replace_values;
25         GHashTable *abstracts;
26
27         void *gui_data;
28 } THEME_REC;
29
30 typedef struct _FORMAT_REC FORMAT_REC;
31
32 extern GSList *themes;
33 extern THEME_REC *current_theme;
34 extern GHashTable *default_formats;
35
36 THEME_REC *theme_create(const char *path, const char *name);
37 void theme_destroy(THEME_REC *rec);
38
39 THEME_REC *theme_load(const char *name);
40
41 #define theme_register(formats) theme_register_module(MODULE_NAME, formats)
42 #define theme_unregister() theme_unregister_module(MODULE_NAME)
43 void theme_register_module(const char *module, FORMAT_REC *formats);
44 void theme_unregister_module(const char *module);
45
46 #define EXPAND_FLAG_IGNORE_REPLACES     0x01 /* don't use the character replaces when expanding */
47 #define EXPAND_FLAG_IGNORE_EMPTY        0x02 /* if abstract's argument is empty, or the argument is a $variable that is empty, don't try to expand it (ie. {xx }, but not {xx}) */
48 #define EXPAND_FLAG_RECURSIVE_MASK      0x0f
49 /* private */
50 #define EXPAND_FLAG_ROOT                0x10
51 #define EXPAND_FLAG_LASTCOLOR_ARG       0x20
52
53 char *theme_format_expand(THEME_REC *theme, const char *format);
54 char *theme_format_expand_data(THEME_REC *theme, const char **format,
55                                char default_fg, char default_bg,
56                                char *save_last_fg, char *save_last_bg,
57                                int flags);
58
59 void themes_init(void);
60 void themes_deinit(void);
61
62 #endif