1 /* gdict-database-chooser-button.h - display widget for database names 2 * 3 * Copyright (C) 2015 Juan R. García Blanco <juanrgar@gmail.com> 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_DATABASE_CHOOSER_BUTTON_H__ 20 #define __GDICT_DATABASE_CHOOSER_BUTTON_H__ 21 22 #include <gtk/gtk.h> 23 #include "gdict-context.h" 24 25 G_BEGIN_DECLS 26 27 #define GDICT_TYPE_DATABASE_CHOOSER_BUTTON (gdict_database_chooser_button_get_type ()) 28 #define GDICT_DATABASE_CHOOSER_BUTTON(obj) \ 29 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDICT_TYPE_DATABASE_CHOOSER_BUTTON, GdictDatabaseChooserButton)) 30 #define GDICT_IS_DATABASE_CHOOSER_BUTTON(obj) \ 31 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDICT_TYPE_DATABASE_CHOOSER_BUTTON)) 32 #define GDICT_DATABASE_CHOOSER_BUTTON_CLASS(klass) \ 33 (G_TYPE_CHECK_CLASS_CAST ((klass), GDICT_TYPE_DATABASE_CHOOSER_BUTTON, GdictDatabaseChooserButtonClass)) 34 #define GDICT_IS_DATABASE_CHOOSER_BUTTON_CLASS(klass) \ 35 (G_TYPE_CHECK_CLASS_TYPE ((klass), GDICT_TYPE_DATABASE_CHOOSER_BUTTON)) 36 #define GDICT_DATABASE_CHOOSER_BUTTON_GET_CLASS(obj) \ 37 (G_TYPE_INSTANCE_GET_CLASS ((obj), GDICT_TYPE_DATABASE_CHOOSER_BUTTON, GdictDatabaseChooserButtonClass)) 38 39 typedef struct _GdictDatabaseChooserButton GdictDatabaseChooserButton; 40 typedef struct _GdictDatabaseChooserButtonPrivate GdictDatabaseChooserButtonPrivate; 41 typedef struct _GdictDatabaseChooserButtonClass GdictDatabaseChooserButtonClass; 42 43 struct _GdictDatabaseChooserButton 44 { 45 /*< private >*/ 46 GtkMenuButton parent_instance; 47 48 GdictDatabaseChooserButtonPrivate *priv; 49 }; 50 51 struct _GdictDatabaseChooserButtonClass 52 { 53 /*< private >*/ 54 GtkMenuButtonClass parent_class; 55 56 /*< public >*/ 57 void (*database_activated) (GdictDatabaseChooserButton *chooser_button, 58 const gchar *name, 59 const gchar *description); 60 void (*selection_changed) (GdictDatabaseChooserButton *chooser); 61 62 /*< private >*/ 63 /* padding for future expansion */ 64 void (*_gdict_padding2) (void); 65 void (*_gdict_padding3) (void); 66 void (*_gdict_padding4) (void); 67 void (*_gdict_padding5) (void); 68 void (*_gdict_padding6) (void); 69 }; 70 71 GType gdict_database_chooser_button_get_type (void) G_GNUC_CONST; 72 73 GtkWidget * gdict_database_chooser_button_new (void); 74 GtkWidget * gdict_database_chooser_button_new_with_context (GdictContext *context); 75 76 GdictContext *gdict_database_chooser_button_get_context (GdictDatabaseChooserButton *chooser); 77 void gdict_database_chooser_button_set_context (GdictDatabaseChooserButton *chooser, 78 GdictContext *context); 79 gboolean gdict_database_chooser_button_select_database (GdictDatabaseChooserButton *chooser, 80 const gchar *db_name); 81 gboolean gdict_database_chooser_button_unselect_database (GdictDatabaseChooserButton *chooser, 82 const gchar *db_name); 83 gboolean gdict_database_chooser_button_set_current_database (GdictDatabaseChooserButton *chooser, 84 const gchar *db_name); 85 gchar * gdict_database_chooser_button_get_current_database (GdictDatabaseChooserButton *chooser) G_GNUC_MALLOC; 86 gchar ** gdict_database_chooser_button_get_databases (GdictDatabaseChooserButton *chooser, 87 gsize *length) G_GNUC_MALLOC; 88 gint gdict_database_chooser_button_count_databases (GdictDatabaseChooserButton *chooser); 89 gboolean gdict_database_chooser_button_has_database (GdictDatabaseChooserButton *chooser, 90 const gchar *database); 91 void gdict_database_chooser_button_clear (GdictDatabaseChooserButton *chooser); 92 93 G_END_DECLS 94 95 #endif /* __GDICT_DATABASE_CHOOSER_BUTTON_H__ */ 96