Fixed freeing data at stop & start. Previously the root window was set to NULL when...
[rodin/chimara.git] / libchimara / chimara-glk.h
index 78ea8deae477e6b593f52d946a20a05f9972fd06..dfa669e3afa1b4f281712ec65a47876be89dfbd3 100644 (file)
@@ -3,7 +3,7 @@
 #ifndef __CHIMARA_GLK_H__
 #define __CHIMARA_GLK_H__
 
-#include <glib-object.h>
+#include <glib.h>
 #include <gtk/gtk.h>
 #include <pango/pango.h>
 
@@ -32,11 +32,50 @@ typedef struct _ChimaraGlkClass {
        /* Signals */
        void(* stopped) (ChimaraGlk *self);
        void(* started) (ChimaraGlk *self);
+       void(* waiting) (ChimaraGlk *self);
        void(* char_input) (ChimaraGlk *self, guint32 window_rock, guint keysym);
        void(* line_input) (ChimaraGlk *self, guint32 window_rock, gchar *text);
        void(* text_buffer_output) (ChimaraGlk *self, guint32 window_rock, gchar *text);
 } ChimaraGlkClass;
 
+/**
+ * ChimaraError:
+ * 
+ * Error codes returned by #ChimaraGlk widgets and subclasses.
+ * <variablelist>
+ * <varlistentry>
+ *   <term>CHIMARA_LOAD_MODULE_ERROR</term>
+ *   <listitem><para>There was an error opening the plugin containing the Glk
+ *   program. The error message from <link 
+ *   linkend="g-module-error">g_module_error()</link> is appended to the <link
+ *   linkend="GError">GError</link> message.</para></listitem>
+ * </varlistentry>
+ * <varlistentry>
+ *   <term>CHIMARA_NO_GLK_MAIN</term>
+ *   <listitem><para>The plugin containing the Glk program did not export a 
+ *   glk_main() function.</para></listitem>
+ * </varlistentry>
+ * <varlistentry>
+ *   <term>CHIMARA_PLUGIN_NOT_FOUND</term>
+ *   <listitem><para>An appropriate interpreter plugin for the autodetected
+ *   game file type could not be found.</para></listitem>
+ * </varlistentry>
+ * </variablelist>
+ */
+typedef enum _ChimaraError {
+       CHIMARA_LOAD_MODULE_ERROR,
+       CHIMARA_NO_GLK_MAIN,
+       CHIMARA_PLUGIN_NOT_FOUND
+} ChimaraError;
+
+/**
+ * CHIMARA_ERROR:
+ *
+ * The domain of errors raised by Chimara widgets.
+ */
+#define CHIMARA_ERROR chimara_error_quark()
+
+GQuark chimara_error_quark(void);
 GType chimara_glk_get_type(void) G_GNUC_CONST;
 GtkWidget *chimara_glk_new(void);
 void chimara_glk_set_interactive(ChimaraGlk *glk, gboolean interactive);
@@ -51,9 +90,12 @@ void chimara_glk_set_monospace_font_string(ChimaraGlk *glk, const gchar *font);
 PangoFontDescription *chimara_glk_get_monospace_font_description(ChimaraGlk *glk);
 void chimara_glk_set_spacing(ChimaraGlk *glk, guint spacing);
 guint chimara_glk_get_spacing(ChimaraGlk *glk);
-gboolean chimara_glk_run(ChimaraGlk *glk, gchar *plugin, int argc, char *argv[], GError **error);
+gboolean chimara_glk_run(ChimaraGlk *glk, const gchar *plugin, int argc, char *argv[], GError **error);
 void chimara_glk_stop(ChimaraGlk *glk);
 void chimara_glk_wait(ChimaraGlk *glk);
+gboolean chimara_glk_get_running(ChimaraGlk *glk);
+void chimara_glk_feed_char_input(ChimaraGlk *glk, guint32 keycode);
+void chimara_glk_feed_line_input(ChimaraGlk *glk, const gchar *text);
 
 G_END_DECLS