Reset Glk style hints at beginning of program
[projects/chimara/chimara.git] / libchimara / style.h
1 #ifndef STYLE_H
2 #define STYLE_H
3
4 #include <gtk/gtk.h>
5 #include <glib.h>
6 #include <glib/gprintf.h>
7 #include "glk.h"
8 #include "chimara-glk.h"
9
10 G_GNUC_INTERNAL void style_init_textbuffer(GtkTextBuffer *buffer);
11 G_GNUC_INTERNAL void style_init_textgrid(GtkTextBuffer *buffer);
12 G_GNUC_INTERNAL void style_init(ChimaraGlk *glk);
13 G_GNUC_INTERNAL void style_reset_glk(ChimaraGlk *glk);
14 G_GNUC_INTERNAL const gchar** style_get_tag_names();
15 G_GNUC_INTERNAL void reset_default_styles(ChimaraGlk *glk);
16 G_GNUC_INTERNAL GScanner *create_css_file_scanner(void);
17 G_GNUC_INTERNAL void scan_css_file(GScanner *scanner, ChimaraGlk *glk);
18 G_GNUC_INTERNAL PangoFontDescription *get_current_font(guint32 wintype);
19 G_GNUC_INTERNAL GtkTextTag* gtk_text_tag_copy(GtkTextTag *tag);
20 G_GNUC_INTERNAL void glkcolor_to_gdkcolor(glui32 val, GdkColor *color);
21 G_GNUC_INTERNAL gchar* glkcolor_to_hex(glui32 val);
22 G_GNUC_INTERNAL gchar* gdkcolor_to_hex(GdkColor *color);
23 G_GNUC_INTERNAL void style_stream_colors(strid_t str, GdkColor **foreground, GdkColor **background);
24 G_GNUC_INTERNAL void style_apply(winid_t win, GtkTextIter *start, GtkTextIter *end);
25
26 typedef struct StyleSet {
27         GHashTable *text_grid;
28         GHashTable *text_buffer;
29 } StyleSet;
30
31 #define CHIMARA_NUM_STYLES 12
32
33 //#define DEBUG_STYLES
34
35 #define ACTUAL_FG(tag) \
36         (GPOINTER_TO_INT( g_object_get_data(G_OBJECT((tag)), "reverse-color")) ? "background-gdk":"foreground-gdk")
37
38 #define ACTUAL_BG(tag) \
39         (GPOINTER_TO_INT( g_object_get_data(G_OBJECT((tag)), "reverse-color")) ? "foreground-gdk":"background-gdk")
40
41 #define ASSIGN_COLOR(to, from) \
42         (to)->red = (from)->red; \
43         (to)->green = (from)->green; \
44         (to)->blue = (from)->blue;
45
46 #endif