1/*
2 * Copyright (C) 2012 Igalia S.L.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2,1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
21#error "Only <webkit2/webkit2.h> can be included directly."
22#endif
23
24#ifndef WebKitFindController_h
25#define WebKitFindController_h
26
27#include <glib-object.h>
28#include <webkit2/WebKitDefines.h>
29#include <webkit2/WebKitForwardDeclarations.h>
30
31G_BEGIN_DECLS
32
33#define WEBKIT_TYPE_FIND_CONTROLLER (webkit_find_controller_get_type())
34#define WEBKIT_FIND_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_FIND_CONTROLLER, WebKitFindController))
35#define WEBKIT_FIND_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_FIND_CONTROLLER, WebKitFindControllerClass))
36#define WEBKIT_IS_FIND_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_FIND_CONTROLLER))
37#define WEBKIT_IS_FIND_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_FIND_CONTROLLER))
38#define WEBKIT_FIND_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_FIND_CONTROLLER, WebKitFindControllerClass))
39
40typedef struct _WebKitFindControllerPrivate WebKitFindControllerPrivate;
41typedef struct _WebKitFindControllerClass WebKitFindControllerClass;
42
43/**
44 * WebKitFindOptions:
45 * @WEBKIT_FIND_OPTIONS_NONE: no search flags, this means a case
46 * sensitive, no wrap, forward only search.
47 * @WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE: case insensitive search.
48 * @WEBKIT_FIND_OPTIONS_AT_WORD_STARTS: search text only at the
49 * begining of the words.
50 * @WEBKIT_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START: treat
51 * capital letters in the middle of words as word start.
52 * @WEBKIT_FIND_OPTIONS_BACKWARDS: search backwards.
53 * @WEBKIT_FIND_OPTIONS_WRAP_AROUND: if not present search will stop
54 * at the end of the document.
55 *
56 * Enum values used to specify search options.
57 */
58typedef enum {
59 WEBKIT_FIND_OPTIONS_NONE,
60
61 WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE = 1 << 0,
62 WEBKIT_FIND_OPTIONS_AT_WORD_STARTS = 1 << 1,
63 WEBKIT_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START = 1 << 2,
64 WEBKIT_FIND_OPTIONS_BACKWARDS = 1 << 3,
65 WEBKIT_FIND_OPTIONS_WRAP_AROUND = 1 << 4
66} WebKitFindOptions;
67
68struct _WebKitFindController {
69 GObject parent;
70
71 /*< private >*/
72 WebKitFindControllerPrivate *priv;
73};
74
75struct _WebKitFindControllerClass {
76 GObjectClass parent_class;
77
78 void (*_webkit_reserved0) (void);
79 void (*_webkit_reserved1) (void);
80 void (*_webkit_reserved2) (void);
81 void (*_webkit_reserved3) (void);
82};
83
84WEBKIT_API GType
85webkit_find_controller_get_type (void);
86
87WEBKIT_API void
88webkit_find_controller_search (WebKitFindController *find_controller,
89 const gchar *search_text,
90 guint32 find_options,
91 guint max_match_count);
92
93WEBKIT_API void
94webkit_find_controller_search_finish (WebKitFindController *find_controller);
95
96WEBKIT_API void
97webkit_find_controller_search_next (WebKitFindController *find_controller);
98
99WEBKIT_API void
100webkit_find_controller_search_previous (WebKitFindController *find_controller);
101
102WEBKIT_API void
103webkit_find_controller_count_matches (WebKitFindController *find_controller,
104 const gchar *search_text,
105 guint32 find_options,
106 guint max_match_count);
107
108WEBKIT_API const gchar *
109webkit_find_controller_get_search_text (WebKitFindController *find_controller);
110
111WEBKIT_API guint32
112webkit_find_controller_get_options (WebKitFindController *find_controller);
113
114WEBKIT_API guint
115webkit_find_controller_get_max_match_count (WebKitFindController *find_controller);
116
117WEBKIT_API WebKitWebView *
118webkit_find_controller_get_web_view (WebKitFindController *find_controller);
119
120G_END_DECLS
121
122#endif
123