1 /* gdict-source-chooser.h - display widget for dictionary sources 2 * 3 * Copyright (C) 2007 Emmanuele Bassi <ebassi@gnome.org> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with this library. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef __GDICT_SOURCE_CHOOSER_H__ 20 #define __GDICT_SOURCE_CHOOSER_H__ 21 22 #include <gtk/gtk.h> 23 #include "gdict-source-loader.h" 24 25 G_BEGIN_DECLS 26 27 #define GDICT_TYPE_SOURCE_CHOOSER (gdict_source_chooser_get_type ()) 28 #define GDICT_SOURCE_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDICT_TYPE_SOURCE_CHOOSER, GdictSourceChooser)) 29 #define GDICT_IS_SOURCE_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDICT_TYPE_SOURCE_CHOOSER)) 30 #define GDICT_SOURCE_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDICT_TYPE_SOURCE_CHOOSER, GdictSourceChooserClass)) 31 #define GDICT_IS_SOURCE_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDICT_TYPE_SOURCE_CHOOSER)) 32 #define GDICT_SOURCE_CHOOSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDICT_TYPE_SOURCE_CHOOSER, GdictSourceChooserClass)) 33 34 typedef struct _GdictSourceChooser GdictSourceChooser; 35 typedef struct _GdictSourceChooserPrivate GdictSourceChooserPrivate; 36 typedef struct _GdictSourceChooserClass GdictSourceChooserClass; 37 38 struct _GdictSourceChooser 39 { 40 /*< private >*/ 41 GtkBox parent_instance; 42 43 GdictSourceChooserPrivate *priv; 44 }; 45 46 struct _GdictSourceChooserClass 47 { 48 /*< private >*/ 49 GtkBoxClass parent_class; 50 51 /*< public >*/ 52 void (*source_activated) (GdictSourceChooser *chooser, 53 const gchar *source_name, 54 GdictSource *source); 55 void (*selection_changed) (GdictSourceChooser *chooser); 56 57 /*< private >*/ 58 /* padding for future expansion */ 59 void (*_gdict_padding1) (void); 60 void (*_gdict_padding2) (void); 61 void (*_gdict_padding3) (void); 62 void (*_gdict_padding4) (void); 63 void (*_gdict_padding5) (void); 64 void (*_gdict_padding6) (void); 65 }; 66 67 GType gdict_source_chooser_get_type (void) G_GNUC_CONST; 68 69 GtkWidget * gdict_source_chooser_new (void); 70 GtkWidget * gdict_source_chooser_new_with_loader (GdictSourceLoader *loader); 71 void gdict_source_chooser_set_loader (GdictSourceChooser *chooser, 72 GdictSourceLoader *loader); 73 GdictSourceLoader *gdict_source_chooser_get_loader (GdictSourceChooser *chooser); 74 gboolean gdict_source_chooser_select_source (GdictSourceChooser *chooser, 75 const gchar *source_name); 76 gboolean gdict_source_chooser_unselect_source (GdictSourceChooser *chooser, 77 const gchar *source_name); 78 gboolean gdict_source_chooser_set_current_source (GdictSourceChooser *chooser, 79 const gchar *source_name); 80 gchar * gdict_source_chooser_get_current_source (GdictSourceChooser *chooser) G_GNUC_MALLOC; 81 gchar ** gdict_source_chooser_get_sources (GdictSourceChooser *chooser, 82 gsize *length) G_GNUC_MALLOC; 83 gint gdict_source_chooser_count_sources (GdictSourceChooser *chooser); 84 gboolean gdict_source_chooser_has_source (GdictSourceChooser *chooser, 85 const gchar *source_name); 86 void gdict_source_chooser_refresh (GdictSourceChooser *chooser); 87 GtkWidget * gdict_source_chooser_add_button (GdictSourceChooser *chooser, 88 const gchar *button_text); 89 90 G_END_DECLS 91 92 #endif /* __GDICT_SOURCE_CHOOSER_H__ */ 93