1 /* 2 * gsdlg.h - Simple GTK dialog wrapper 3 * 4 * Copyright 2007-2008 Jeff Pohlmeyer <yetanothergeek(at)gmail(dot)com> 5 * 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License along 19 * with this program; if not, write to the Free Software Foundation, Inc., 20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 */ 22 23 24 /* 25 26 Defining GSDLG_ALL_IN_ONE will cause this header to also include the 27 complete "gsdlg.c" sources. This is done by "gsdlg_lua.c" to keep 28 the implemention details static. 29 30 But since the "gsdlg.c" API might also be useful outside of Lua, 31 it is also possible to build it as a standalone object file, in 32 which case the GSDLG_API functions will be available externally. 33 34 */ 35 36 #ifdef GSDLG_ALL_IN_ONE 37 #define GSDLG_API static 38 #else 39 #define GSDLG_API 40 #endif 41 42 #include <gtk/gtk.h> 43 44 typedef const gchar* GsDlgStr; 45 46 GSDLG_API void gsdlg_text( GtkDialog *dlg, GsDlgStr key, GsDlgStr value, GsDlgStr label); 47 GSDLG_API void gsdlg_password( GtkDialog *dlg, GsDlgStr key, GsDlgStr value, GsDlgStr label); 48 GSDLG_API void gsdlg_textarea( GtkDialog *dlg, GsDlgStr key, GsDlgStr value, GsDlgStr label); 49 GSDLG_API void gsdlg_file( GtkDialog *dlg, GsDlgStr key, GsDlgStr value, GsDlgStr label); 50 GSDLG_API void gsdlg_color( GtkDialog *dlg, GsDlgStr key, GsDlgStr value, GsDlgStr label); 51 GSDLG_API void gsdlg_font( GtkDialog *dlg, GsDlgStr key, GsDlgStr value, GsDlgStr label); 52 53 GSDLG_API void gsdlg_group( GtkDialog *dlg, GsDlgStr key, GsDlgStr value, GsDlgStr label); 54 GSDLG_API void gsdlg_radio( GtkDialog *dlg, GsDlgStr key, GsDlgStr value, GsDlgStr label); 55 GSDLG_API void gsdlg_select( GtkDialog *dlg, GsDlgStr key, GsDlgStr value, GsDlgStr label); 56 GSDLG_API void gsdlg_option( GtkDialog *dlg, GsDlgStr key, GsDlgStr value, GsDlgStr label); 57 58 GSDLG_API void gsdlg_checkbox( GtkDialog *dlg, GsDlgStr key, gboolean value, GsDlgStr label); 59 60 GSDLG_API void gsdlg_label( GtkDialog *dlg, GsDlgStr text); 61 GSDLG_API void gsdlg_heading( GtkDialog *dlg, GsDlgStr text); 62 GSDLG_API void gsdlg_hr( GtkDialog *dlg); 63 64 65 GSDLG_API GtkDialog *gsdlg_new(GsDlgStr title, GsDlgStr* btns); 66 GSDLG_API GHashTable* gsdlg_run(GtkDialog *dlg, gint *btn, gpointer user_data); 67 68 GSDLG_API GtkWindow* gsdlg_toplevel; 69 70 71 typedef void (*GsDlgRunHook) (gboolean running, gpointer user_data); 72 73 /* 74 If assigned, the cb callback will be called twice by gsdlg_run(), 75 first with running=TRUE when the dialog is displayed, and 76 then with running=FALSE when it is dismissed. 77 */ 78 #ifndef DIALOG_LIB 79 GSDLG_API void gsdlg_set_run_hook(GsDlgRunHook cb); 80 #endif 81 82 83 #ifdef GSDLG_ALL_IN_ONE 84 #include "gsdlg.c" 85 #endif 86