* Changing styles no longer affects existing windows
[rodin/chimara.git] / libchimara / chimara-glk-private.h
1 #ifndef __CHIMARA_GLK_PRIVATE_H__
2 #define __CHIMARA_GLK_PRIVATE_H__
3
4 #include <glib.h>
5 #include <gmodule.h>
6 #include <pango/pango.h>
7 #include "glk.h"
8 #include "style.h"
9 #include "gi_blorb.h"
10 #include "gi_dispa.h"
11 #include "chimara-glk.h"
12
13 G_BEGIN_DECLS
14
15 typedef struct _ChimaraGlkPrivate ChimaraGlkPrivate;
16
17 struct _ChimaraGlkPrivate {
18     /* Pointer back to the widget itself for use in thread */
19     ChimaraGlk *self;
20
21         /* *** Widget properties *** */
22     /* Whether user input is expected */
23     gboolean interactive;
24     /* Whether file operations are allowed */
25     gboolean protect;
26         /* Font description of proportional font */
27         PangoFontDescription *default_font_desc;
28         /* Font description of monospace font */
29         PangoFontDescription *monospace_font_desc;
30         /* Spacing between Glk windows */
31         guint spacing;
32         /* The CSS file to read style defaults from */
33         gchar *css_file;
34         /* Hashtable containing the default and current style */
35         struct StyleSet *default_styles;
36         struct StyleSet *current_styles;
37
38         /* *** Threading data *** */
39     /* Glk program loaded in widget */
40     GModule *program;
41     /* Thread in which Glk program is run */
42     GThread *thread;
43     /* Event queue and threading stuff */
44     GQueue *event_queue;
45     GMutex *event_lock;
46     GCond *event_queue_not_empty;
47     GCond *event_queue_not_full;
48     /* Abort mechanism */
49     GMutex *abort_lock;
50     gboolean abort_signalled;
51         /* Window arrangement locks */
52         GMutex *arrange_lock;
53         GCond *rearranged;
54         gboolean needs_rearrange;
55         gboolean ignore_next_arrange_event;
56
57         /* *** Glk library data *** */
58     /* User-defined interrupt handler */
59     void (*interrupt_handler)(void);
60     /* Global tree of all windows */
61     GNode *root_window;
62     /* List of filerefs currently in existence */
63     GList *fileref_list;
64     /* Current stream */
65     strid_t current_stream;
66     /* List of streams currently in existence */
67     GList *stream_list;
68         /* Current timer */
69         guint timer_id;
70         /* Current resource blorb map */
71         giblorb_map_t *resource_map;
72         /* File stream pointing to the blorb used as current resource map */
73         strid_t resource_file;
74         /* Callbacks for registering and unregistering dispatch objects */
75         gidispatch_rock_t (*register_obj)(void *, glui32);
76         void (*unregister_obj)(void *, glui32, gidispatch_rock_t);
77         gidispatch_rock_t (*register_arr)(void *, glui32, char *);
78         void (*unregister_arr)(void *, glui32, char *, gidispatch_rock_t);
79
80         /* *** Platform-dependent Glk library data *** */
81         /* Flag for functions to find out if they are being called from startup code */
82         gboolean in_startup;
83         /* "Current directory" for creating filerefs */
84         gchar *current_dir;
85 };
86
87 #define CHIMARA_GLK_PRIVATE(obj) \
88         (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHIMARA_TYPE_GLK, ChimaraGlkPrivate))
89         
90 G_END_DECLS
91
92 #endif /* __CHIMARA_GLK_PRIVATE_H__ */