X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=libchimara%2Fchimara-glk.h;h=45b3b6aa761693e9db4da9fdca0e88086add127a;hb=3c19422ee9cc38e710bd2f262b2b91a3d6e04ab6;hp=32725de98968334294eec85e63fdbb7463e6db2d;hpb=1410fe4a16ca30242deb8273a8c5867ebeb66b65;p=rodin%2Fchimara.git diff --git a/libchimara/chimara-glk.h b/libchimara/chimara-glk.h index 32725de..45b3b6a 100644 --- a/libchimara/chimara-glk.h +++ b/libchimara/chimara-glk.h @@ -38,6 +38,49 @@ typedef struct _ChimaraGlkClass { void(* text_buffer_output) (ChimaraGlk *self, guint32 window_rock, gchar *text); } ChimaraGlkClass; +/** + * ChimaraError: + * + * Error codes returned by #ChimaraGlk widgets and subclasses. + * + * + * CHIMARA_LOAD_MODULE_ERROR + * There was an error opening the plugin containing the Glk + * program. The error message from g_module_error() is appended to the GError message. + * + * + * CHIMARA_NO_GLK_MAIN + * The plugin containing the Glk program did not export a + * glk_main() function. + * + * + * CHIMARA_PLUGIN_NOT_FOUND + * An appropriate interpreter plugin for the autodetected + * game file type could not be found. + * + * + * CHIMARA_PLUGIN_ALREADY_RUNNING + * A plugin was opened while there was already another plugin + * running in the widget. + * + */ +typedef enum _ChimaraError { + CHIMARA_LOAD_MODULE_ERROR, + CHIMARA_NO_GLK_MAIN, + CHIMARA_PLUGIN_NOT_FOUND, + CHIMARA_PLUGIN_ALREADY_RUNNING +} 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); @@ -52,9 +95,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