vdk 2.4.0
gtktextsearch.h
1/* GtkTextSearch
2*
3*
4* Copyright (C) 2002 Mikael Hermansson <tyan@linux.se>
5*
6* This program is free software; you can redistribute it and/or modify
7* it under the terms of the GNU General Public License as published by
8* the Free Software Foundation; either version 2 of the License, or
9* (at your option) any later version.
10*
11* This program is distributed in the hope that it will be useful,
12* but WITHOUT ANY WARRANTY; without even the implied warranty of
13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14* GNU General Public License for more details.
15*
16* You should have received a copy of the GNU General Public License
17* along with this program; if not, write to the Free Software
18* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19*/
20
21
22#ifndef _GTK_TEXT_SEARCH__H_
23#define _GTK_TEXT_SEARCH__H_
24
25#include <gtk/gtk.h>
26
27G_BEGIN_DECLS
28
29#define GTK_TYPE_TEXT_SEARCH (gtk_text_search_get_type ())
30#define GTK_TEXT_SEARCH(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_TEXT_SEARCH, GtkTextSearch))
31#define GTK_TEXT_SEARCH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TEXT_SEARCH, GtkTextSearchClass))
32#define GTK_IS_TEXT_SEARCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TEXT_SEARCH))
33#define GTK_IS_TEXT_SEARCH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEXT_SEARCH))
34
35typedef struct _GtkTextSearch GtkTextSearch;
36typedef struct _GtkTextSearchClass GtkTextSearchClass;
37typedef gboolean (*GtkTextSearchForeachFunc) (GtkTextIter *match_start, GtkTextIter *match_end, gpointer data);
38
39typedef enum {
40 GTK_ETEXT_SEARCH_VISIBLE_ONLY, /* TODO */
41 GTK_ETEXT_SEARCH_TEXT_ONLY,
42 GTK_ETEXT_SEARCH_CASE_INSENSITIVE,
43 GTK_ETEXT_SEARCH_REGEXP /* TODO: this is not yet implemented */
44}GtkETextSearchFlags;
45
46struct _GtkTextSearch
47{
48 GObject parent;
49
50 gchar *search_for; /* the text to search for */
51 gchar *offset; /* offset in search_for used in forward find char callback */
52
53 GtkTextBuffer *buffer;
54 GtkTextMark *mark_current;
55 GtkTextMark *mark_stop;
56 GtkETextSearchFlags sflags;
57
58 gint is_matched : 1;
59};
60
61struct _GtkTextSearchClass
62{
63 GObjectClass parent;
64
65};
66
67GType gtk_text_search_get_type (void);
68
69GtkTextSearch * gtk_text_search_new (GtkTextBuffer *buffer, const GtkTextIter *start,
70 const char *search,
71 GtkETextSearchFlags sflags,
72 const GtkTextIter *limit);
73void gtk_text_search_set (GtkTextSearch *search,
74 GtkTextBuffer *buffer,
75 const GtkTextIter *start,
76 const char *searchfor,
77 GtkETextSearchFlags sflags,
78 const GtkTextIter *limit);
79void gtk_text_search_set_interval (GtkTextSearch *search, GtkTextBuffer *buffer, const GtkTextIter *start, const GtkTextIter *end);
80
81gboolean gtk_text_search_forward (GtkTextSearch *search, GtkTextIter *match_start, GtkTextIter *match_end);
82gboolean gtk_text_search_backward (GtkTextSearch *search, GtkTextIter *match_start, GtkTextIter *match_end);
83gint gtk_text_search_forward_foreach (GtkTextSearch *search, GtkTextSearchForeachFunc func, gpointer data);
84gint gtk_text_search_backward_foreach (GtkTextSearch *search, GtkTextSearchForeachFunc func, gpointer data);
85
86G_END_DECLS
87
88#endif