Backend support for using dynamic styles. See also Ticket #49.
[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         /* Spacing between Glk windows */
27         guint spacing;
28         /* The CSS file to read style defaults from */
29         gchar *css_file;
30         /* Hashtable containing the current styles set by CSS and GLK */
31         struct StyleSet *styles;
32         struct StyleSet *glk_styles;
33         PangoAttrList *pager_attr_list;
34         /* Final message displayed when game exits */
35         gchar *final_message;
36         /* Image cache */
37         GSList *image_cache;
38
39         /* *** Threading data *** */
40         /* Whether program is running */
41         gboolean running;
42     /* Glk program loaded in widget */
43     GModule *program;
44     /* Thread in which Glk program is run */
45     GThread *thread;
46     /* Event queue and threading stuff */
47     GQueue *event_queue;
48     GMutex *event_lock;
49     GCond *event_queue_not_empty;
50     GCond *event_queue_not_full;
51     /* Abort mechanism */
52     GMutex *abort_lock;
53     gboolean abort_signalled;
54         /* Key press after shutdown mechanism */
55         GMutex *shutdown_lock;
56         GCond *shutdown_key_pressed;
57         /* Window arrangement locks */
58         GMutex *arrange_lock;
59         GCond *rearranged;
60         gboolean needs_rearrange;
61         gboolean ignore_next_arrange_event;
62         /* Input queues */
63         GAsyncQueue *char_input_queue;
64         GAsyncQueue *line_input_queue;
65         /* Resource loading locks */
66         GMutex *resource_lock;
67         GCond *resource_loaded;
68         GCond *resource_info_available;
69         guint32 resource_available;
70
71         /* *** Glk library data *** */
72         /* Info about current plugin */
73         gchar *program_name;
74         gchar *program_info;
75         gchar *story_name;
76     /* User-defined interrupt handler */
77     void (*interrupt_handler)(void);
78     /* Global tree of all windows */
79     GNode *root_window;
80     /* List of filerefs currently in existence */
81     GList *fileref_list;
82     /* Current stream */
83     strid_t current_stream;
84     /* List of streams currently in existence */
85     GList *stream_list;
86         /* Current timer */
87         guint timer_id;
88         /* Current resource blorb map */
89         giblorb_map_t *resource_map;
90         /* File stream pointing to the blorb used as current resource map */
91         strid_t resource_file;
92         /* Callbacks for registering and unregistering dispatch objects */
93         gidispatch_rock_t (*register_obj)(void *, glui32);
94         void (*unregister_obj)(void *, glui32, gidispatch_rock_t);
95         gidispatch_rock_t (*register_arr)(void *, glui32, char *);
96         void (*unregister_arr)(void *, glui32, char *, gidispatch_rock_t);
97
98         /* *** Platform-dependent Glk library data *** */
99         /* Flag for functions to find out if they are being called from startup code */
100         gboolean in_startup;
101         /* "Current directory" for creating filerefs */
102         gchar *current_dir;
103 };
104
105 #define CHIMARA_GLK_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHIMARA_TYPE_GLK, ChimaraGlkPrivate))
106 #define CHIMARA_GLK_USE_PRIVATE(o, n) ChimaraGlkPrivate *n = CHIMARA_GLK_PRIVATE(o)
107
108 G_END_DECLS
109
110 #endif /* __CHIMARA_GLK_PRIVATE_H__ */