1 /* gdict-defbox.h - display widget for dictionary definitions
2  *
3  * Copyright (C) 2005-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_DEFBOX_H__
20 #define __GDICT_DEFBOX_H__
21 
22 #include <gtk/gtk.h>
23 #include "gdict-context.h"
24 
25 G_BEGIN_DECLS
26 
27 #define GDICT_TYPE_DEFBOX		(gdict_defbox_get_type ())
28 #define GDICT_DEFBOX(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), GDICT_TYPE_DEFBOX, GdictDefbox))
29 #define GDICT_IS_DEFBOX(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDICT_TYPE_DEFBOX))
30 #define GDICT_DEFBOX_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), GDICT_TYPE_DEFBOX, GdictDefboxClass))
31 #define GDICT_IS_DEFBOX_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass), GDICT_TYPE_DEFBOX))
32 #define GDICT_DEFBOX_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj), GDICT_TYPE_DEFBOX, GdictDefboxClass))
33 
34 typedef struct _GdictDefbox        GdictDefbox;
35 typedef struct _GdictDefboxClass   GdictDefboxClass;
36 typedef struct _GdictDefboxPrivate GdictDefboxPrivate;
37 
38 struct _GdictDefbox
39 {
40   /*< private >*/
41   GtkBox parent_instance;
42 
43   GdictDefboxPrivate *priv;
44 };
45 
46 struct _GdictDefboxClass
47 {
48   GtkBoxClass parent_class;
49 
50   /* these are all RUN_ACTION signals for key bindings */
51   void (*show_find)         (GdictDefbox *defbox);
52   void (*hide_find)         (GdictDefbox *defbox);
53   void (*find_previous)     (GdictDefbox *defbox);
54   void (*find_next)         (GdictDefbox *defbox);
55 
56   /* signals */
57   void (*link_clicked)      (GdictDefbox *defbox,
58                              const gchar *link);
59   void (*selection_changed) (GdictDefbox *defbox);
60 
61   /* padding for future expansion */
62   void (*_gdict_defbox_1) (void);
63   void (*_gdict_defbox_2) (void);
64   void (*_gdict_defbox_3) (void);
65   void (*_gdict_defbox_4) (void);
66 };
67 
68 GType                 gdict_defbox_get_type           (void) G_GNUC_CONST;
69 
70 GtkWidget *           gdict_defbox_new                (void);
71 GtkWidget *           gdict_defbox_new_with_context   (GdictContext *context);
72 void                  gdict_defbox_set_context        (GdictDefbox  *defbox,
73 						       GdictContext *context);
74 GdictContext *        gdict_defbox_get_context        (GdictDefbox  *defbox);
75 void                  gdict_defbox_set_database       (GdictDefbox  *defbox,
76 						       const gchar  *database);
77 const gchar *         gdict_defbox_get_database       (GdictDefbox  *defbox);
78 const gchar *         gdict_defbox_get_word           (GdictDefbox  *defbox);
79 gchar *               gdict_defbox_get_text           (GdictDefbox  *defbox,
80 						       gsize        *length) G_GNUC_MALLOC;
81 void                  gdict_defbox_select_all         (GdictDefbox  *defbox);
82 void                  gdict_defbox_copy_to_clipboard  (GdictDefbox  *defbox,
83 						       GtkClipboard *clipboard);
84 void                  gdict_defbox_clear              (GdictDefbox  *defbox);
85 void                  gdict_defbox_lookup             (GdictDefbox  *defbox,
86 						       const gchar  *word);
87 gint                  gdict_defbox_count_definitions  (GdictDefbox  *defbox);
88 void                  gdict_defbox_jump_to_definition (GdictDefbox  *defbox,
89 						       gint          number);
90 void                  gdict_defbox_set_show_find      (GdictDefbox  *defbox,
91 						       gboolean      show_find);
92 gboolean              gdict_defbox_get_show_find      (GdictDefbox  *defbox);
93 void                  gdict_defbox_find_next          (GdictDefbox  *defbox);
94 void                  gdict_defbox_find_previous      (GdictDefbox  *defbox);
95 void                  gdict_defbox_set_font_name      (GdictDefbox  *defbox,
96 						       const gchar  *font_name);
97 const gchar *         gdict_defbox_get_font_name      (GdictDefbox  *defbox);
98 gchar *               gdict_defbox_get_selected_word  (GdictDefbox  *defbox) G_GNUC_MALLOC;
99 gboolean              gdict_defbox_get_has_selection  (GdictDefbox  *defbox);
100 
101 G_END_DECLS
102 
103 #endif /* __GDICT_DEFBOX_H__ */
104