1 /* gdict-database-chooser.h - display widget for database names
2  *
3  * Copyright (C) 2006  Emmanuele Bassi <ebassi@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_H__
20 #define __GDICT_DATABASE_CHOOSER_H__
21 
22 #include <gtk/gtk.h>
23 #include "gdict-context.h"
24 
25 G_BEGIN_DECLS
26 
27 #define GDICT_TYPE_DATABASE_CHOOSER		(gdict_database_chooser_get_type ())
28 #define GDICT_DATABASE_CHOOSER(obj) \
29 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDICT_TYPE_DATABASE_CHOOSER, GdictDatabaseChooser))
30 #define GDICT_IS_DATABASE_CHOOSER(obj) \
31 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDICT_TYPE_DATABASE_CHOOSER))
32 #define GDICT_DATABASE_CHOOSER_CLASS(klass) \
33 (G_TYPE_CHECK_CLASS_CAST ((klass), GDICT_TYPE_DATABASE_CHOOSER, GdictDatabaseChooserClass))
34 #define GDICT_IS_DATABASE_CHOOSER_CLASS(klass) \
35 (G_TYPE_CHECK_CLASS_TYPE ((klass), GDICT_TYPE_DATABASE_CHOOSER))
36 #define GDICT_DATABASE_CHOOSER_GET_CLASS(obj) \
37 (G_TYPE_INSTANCE_GET_CLASS ((obj), GDICT_TYPE_DATABASE_CHOOSER, GdictDatabaseChooserClass))
38 
39 typedef struct _GdictDatabaseChooser		GdictDatabaseChooser;
40 typedef struct _GdictDatabaseChooserPrivate	GdictDatabaseChooserPrivate;
41 typedef struct _GdictDatabaseChooserClass	GdictDatabaseChooserClass;
42 
43 struct _GdictDatabaseChooser
44 {
45   /*< private >*/
46   GtkBox parent_instance;
47 
48   GdictDatabaseChooserPrivate *priv;
49 };
50 
51 struct _GdictDatabaseChooserClass
52 {
53   /*< private >*/
54   GtkBoxClass parent_class;
55 
56   /*< public >*/
57   void (*database_activated) (GdictDatabaseChooser *chooser,
58 		  	      const gchar          *name,
59 			      const gchar          *description);
60   void (*selection_changed)  (GdictDatabaseChooser *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_get_type             (void) G_GNUC_CONST;
72 
73 GtkWidget *   gdict_database_chooser_new                  (void);
74 GtkWidget *   gdict_database_chooser_new_with_context     (GdictContext         *context);
75 
76 GdictContext *gdict_database_chooser_get_context          (GdictDatabaseChooser *chooser);
77 void          gdict_database_chooser_set_context          (GdictDatabaseChooser *chooser,
78 						           GdictContext         *context);
79 gboolean      gdict_database_chooser_select_database      (GdictDatabaseChooser *chooser,
80                                                            const gchar          *db_name);
81 gboolean      gdict_database_chooser_unselect_database    (GdictDatabaseChooser *chooser,
82                                                            const gchar          *db_name);
83 gboolean      gdict_database_chooser_set_current_database (GdictDatabaseChooser *chooser,
84                                                            const gchar          *db_name);
85 gchar *       gdict_database_chooser_get_current_database (GdictDatabaseChooser *chooser) G_GNUC_MALLOC;
86 gchar **      gdict_database_chooser_get_databases        (GdictDatabaseChooser *chooser,
87 						           gsize                *length) G_GNUC_MALLOC;
88 gint          gdict_database_chooser_count_databases      (GdictDatabaseChooser *chooser);
89 gboolean      gdict_database_chooser_has_database         (GdictDatabaseChooser *chooser,
90 						           const gchar          *database);
91 void          gdict_database_chooser_refresh              (GdictDatabaseChooser *chooser);
92 void          gdict_database_chooser_clear                (GdictDatabaseChooser *chooser);
93 GtkWidget *   gdict_database_chooser_add_button           (GdictDatabaseChooser *chooser,
94                                                            const gchar          *button_text);
95 
96 G_END_DECLS
97 
98 #endif /* __GDICT_DATABASE_CHOOSER_H__ */
99