2 Stuphead: (C) 2000,2001 Grigroy Bakunov, Sergey Pinaev
4 /* gtkpspell - a spell-checking addon for GtkText
5 * Copyright (c) 2000 Evan Martin.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * Adapted by the Sylpheed Claws Team.
27 * Adapted for pspell (c) 2001 Melvin Hadasht
31 /* first a pspell config must be created (at the beginning of the app)
33 GtkPspellConfig gtkpspellconfig = gtkpspell_init();
34 then for each document use this to create a manager
35 GtkPspell = gtkpspell_new(GtkPspellConfig *gtkpspellconfig);
36 Now, path and dict can be set
37 gtkpspell_set_path_and_dict(GtkPspell *gtkpspell, guchar * path, guchar * dict);
38 then attach this to a gtktext widget :
39 gtkpspell_attach(GtkPspell *gtkpspell, GtkXText *gtkxtext);
40 and we can also detach :
41 gtkpspell_deattach(GtkPspell *gtkpspell, GtkXText *gtkxtext);
42 When finished, GtkPspell can be deleted with
43 gtkpspell_delete(GtkPspell * gtkpspell);
44 At the end of the app, GtkPspellConfig should be deleted with :
45 gtkpspell_finished(GtkPspellConfig * gtkpspellconfig);
48 #ifndef __gtkpspell_h__
49 #define __gtkpspell_h__
52 #include <pspell/pspell.h>
54 #define PSPELL_FASTMODE 1
55 #define PSPELL_NORMALMODE 2
56 #define PSPELL_BADSPELLERMODE 3
58 typedef struct _Dictionary {
62 typedef struct _GtkPspell
64 PspellConfig * config;
65 PspellCanHaveError * possible_err ;
66 PspellManager * checker;
76 GSList * dictionary_list;
81 typedef PspellConfig GtkPspellConfig;
83 /* Create a new gtkspell instance to manage one text widget */
85 /* These one create and delete a pspell config */
86 GtkPspellConfig *gtkpspell_init();
87 void gtkpspell_finished(GtkPspellConfig * gtkpspellconfig);
89 /* These ones create and delete a manager*/
90 GtkPspell *gtkpspell_new(GtkPspellConfig * config);
92 GtkPspell *gtkpspell_new_with_config(GtkPspellConfig *gtkpspellconfig,
96 const guchar *encoding);
97 GtkPspell *gtkpspell_delete(GtkPspell *gtkpspell);
99 int gtkpspell_set_path_and_dict(GtkPspell *gtkpspell, guchar * path,
101 guchar *gtkpspell_get_dict(GtkPspell *gtkpspell);
103 guchar *gtkpspell_get_path(GtkPspell *gtkpspell);
105 /* This sets suggestion mode "fast" "normal" "bad-spellers" */
106 /* and resets the dict & path (which should be set first) */
107 /* return 0 on failure and -1 on success */
108 int gtkpspell_set_sug_mode(GtkPspell * gtkpspell, gchar * themode);
110 void gtkpspell_attach(GtkPspell *gtkpspell, GtkXText *text_ccc);
112 void gtkpspell_detach(GtkPspell *gtkpspell);
114 void gtkpspell_check_all(GtkPspell *gtkpspell);
116 void gtkpspell_uncheck_all(GtkPspell *gtkpspell);
118 GSList *gtkpspell_get_dictionary_list(const char *pspell_path);
120 void gtkpspell_free_dictionary_list(GSList *list);
122 GtkWidget *gtkpspell_dictionary_option_menu_new(const gchar *pspell_path);
123 gchar *gtkpspell_get_dictionary_menu_active_item(GtkWidget *menu);
125 extern GtkPspellConfig * gtkpspellconfig;
127 #endif /* __gtkpspell_h__ */