1 /* Copyright / licensing information here. */
3 #ifndef __CHIMARA_GLK_H__
4 #define __CHIMARA_GLK_H__
8 #include <pango/pango.h>
12 #define CHIMARA_TYPE_GLK (chimara_glk_get_type())
13 #define CHIMARA_GLK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), CHIMARA_TYPE_GLK, ChimaraGlk))
14 #define CHIMARA_GLK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), CHIMARA_TYPE_GLK, ChimaraGlkClass))
15 #define CHIMARA_IS_GLK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), CHIMARA_TYPE_GLK))
16 #define CHIMARA_IS_GLK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), CHIMARA_TYPE_GLK))
17 #define CHIMARA_GLK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), CHIMARA_TYPE_GLK, ChimaraGlkClass))
22 * This structure contains no public members.
24 typedef struct _ChimaraGlk {
25 GtkContainer parent_instance;
30 typedef struct _ChimaraGlkClass {
31 GtkContainerClass parent_class;
33 void(* stopped) (ChimaraGlk *self);
34 void(* started) (ChimaraGlk *self);
35 void(* waiting) (ChimaraGlk *self);
36 void(* char_input) (ChimaraGlk *self, guint32 window_rock, guint keysym);
37 void(* line_input) (ChimaraGlk *self, guint32 window_rock, gchar *text);
38 void(* text_buffer_output) (ChimaraGlk *self, guint32 window_rock, gchar *text);
39 void(* iliad_screen_update) (ChimaraGlk *self, gboolean typing);
44 * @CHIMARA_LOAD_MODULE_ERROR: There was an error opening the plugin containing
45 * the Glk program. The error message from <link
46 * linkend="g-module-error">g_module_error()</link> is appended to the <link
47 * linkend="GError">GError</link> message.
48 * @CHIMARA_NO_GLK_MAIN: The plugin containing the Glk program did not export a
49 * glk_main() function.
50 * @CHIMARA_PLUGIN_NOT_FOUND: An appropriate interpreter plugin for the
51 * autodetected game file type could not be found.
52 * @CHIMARA_PLUGIN_ALREADY_RUNNING: A plugin was opened while there was already
53 * another plugin running in the widget.
55 * Error codes returned by #ChimaraGlk widgets and subclasses.
57 typedef enum _ChimaraError {
58 CHIMARA_LOAD_MODULE_ERROR,
60 CHIMARA_PLUGIN_NOT_FOUND,
61 CHIMARA_PLUGIN_ALREADY_RUNNING
67 * The domain of errors raised by Chimara widgets.
69 #define CHIMARA_ERROR chimara_error_quark()
71 GQuark chimara_error_quark(void);
72 GType chimara_glk_get_type(void) G_GNUC_CONST;
73 GtkWidget *chimara_glk_new(void);
74 void chimara_glk_set_interactive(ChimaraGlk *glk, gboolean interactive);
75 gboolean chimara_glk_get_interactive(ChimaraGlk *glk);
76 void chimara_glk_set_protect(ChimaraGlk *glk, gboolean protect);
77 gboolean chimara_glk_get_protect(ChimaraGlk *glk);
78 void chimara_glk_set_css_to_default(ChimaraGlk *glk);
79 gboolean chimara_glk_set_css_from_file(ChimaraGlk *glk, const gchar *filename, GError **error);
80 void chimara_glk_set_css_from_string(ChimaraGlk *glk, const gchar *css);
81 void chimara_glk_set_spacing(ChimaraGlk *glk, guint spacing);
82 guint chimara_glk_get_spacing(ChimaraGlk *glk);
83 gboolean chimara_glk_run(ChimaraGlk *glk, const gchar *plugin, int argc, char *argv[], GError **error);
84 void chimara_glk_stop(ChimaraGlk *glk);
85 void chimara_glk_wait(ChimaraGlk *glk);
86 gboolean chimara_glk_get_running(ChimaraGlk *glk);
87 void chimara_glk_feed_char_input(ChimaraGlk *glk, guint32 keyval);
88 void chimara_glk_feed_line_input(ChimaraGlk *glk, const gchar *text);
92 #endif /* __CHIMARA_GLK_H__ */