Top |
WebKitFindControllerWebKitFindController — Controls text search in a WebKitWebView |
guint | max-match-count | Read |
WebKitFindOptions | options | Read |
char * | text | Read |
WebKitWebView * | web-view | Read / Write / Construct Only |
A WebKitFindController is used to search text in a WebKitWebView. You
can get a WebKitWebView's WebKitFindController with
webkit_web_view_get_find_controller()
, and later use it to search
for text using webkit_find_controller_search()
, or get the
number of matches using webkit_find_controller_count_matches()
. The
operations are asynchronous and trigger signals when ready, such as
“found-text”,
“failed-to-find-text” or
“counted-matches”.
void webkit_find_controller_search (WebKitFindController *find_controller
,const gchar *search_text
,guint32 find_options
,guint max_match_count
);
Looks for search_text
in the WebKitWebView associated with
find_controller
since the beginning of the document highlighting
up to max_match_count
matches. The outcome of the search will be
asynchronously provided by the “found-text”
and “failed-to-find-text” signals.
To look for the next or previous occurrences of the same text
with the same find options use webkit_find_controller_search_next()
and/or webkit_find_controller_search_previous()
. The
WebKitFindController will use the same text and options for the
following searches unless they are modified by another call to this
method.
Note that if the number of matches is higher than max_match_count
then “found-text” will report G_MAXUINT
matches
instead of the actual number.
Callers should call webkit_find_controller_search_finish()
to
finish the current search operation.
find_controller |
||
search_text |
the text to look for |
|
find_options |
a bitmask with the WebKitFindOptions used in the search |
|
max_match_count |
the maximum number of matches allowed in the search |
void
webkit_find_controller_search_finish (WebKitFindController *find_controller
);
Finishes a find operation started by
webkit_find_controller_search()
. It will basically unhighlight
every text match found.
This method will be typically called when the search UI is closed/hidden by the client application.
void
webkit_find_controller_search_next (WebKitFindController *find_controller
);
Looks for the next occurrence of the search text.
Calling this method before webkit_find_controller_search()
or
webkit_find_controller_count_matches()
is a programming error.
void
webkit_find_controller_search_previous
(WebKitFindController *find_controller
);
Looks for the previous occurrence of the search text.
Calling this method before webkit_find_controller_search()
or
webkit_find_controller_count_matches()
is a programming error.
const gchar *
webkit_find_controller_get_search_text
(WebKitFindController *find_controller
);
Gets the text that find_controller
is currently searching
for. This text is passed to either
webkit_find_controller_search()
or
webkit_find_controller_count_matches()
.
void webkit_find_controller_count_matches (WebKitFindController *find_controller
,const gchar *search_text
,guint32 find_options
,guint max_match_count
);
Counts the number of matches for search_text
found in the
WebKitWebView with the provided find_options
. The number of
matches will be provided by the
“counted-matches” signal.
find_controller |
||
search_text |
the text to look for |
|
find_options |
a bitmask with the WebKitFindOptions used in the search |
|
max_match_count |
the maximum number of matches allowed in the search |
guint32
webkit_find_controller_get_options (WebKitFindController *find_controller
);
Gets a bitmask containing the WebKitFindOptions associated with the current search.
guint
webkit_find_controller_get_max_match_count
(WebKitFindController *find_controller
);
Gets the maximum number of matches to report during a text
lookup. This number is passed as the last argument of
webkit_find_controller_search()
or
webkit_find_controller_count_matches()
.
WebKitWebView *
webkit_find_controller_get_web_view (WebKitFindController *find_controller
);
Gets the WebKitWebView this find controller is associated to. Do not dereference the returned instance as it belongs to the WebKitFindController.
Enum values used to specify search options.
“max-match-count”
property“max-match-count” guint
The maximum number of matches to report for a given search.
Owner: WebKitFindController
Flags: Read
Default value: 0
“options”
property“options” WebKitFindOptions
The options to be used in the search operation.
Owner: WebKitFindController
Flags: Read
“text”
property “text” char *
The current search text for this WebKitFindController.
Owner: WebKitFindController
Flags: Read
Default value: NULL
“web-view”
property“web-view” WebKitWebView *
The WebKitWebView this controller is associated to.
Owner: WebKitFindController
Flags: Read / Write / Construct Only
“counted-matches”
signalvoid user_function (WebKitFindController *find_controller, guint match_count, gpointer user_data)
This signal is emitted when the WebKitFindController has
counted the number of matches for a given text after a call
to webkit_find_controller_count_matches()
.
find_controller |
||
match_count |
the number of matches of the search text |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“failed-to-find-text”
signalvoid user_function (WebKitFindController *find_controller, gpointer user_data)
This signal is emitted when a search operation does not find
any result for the given text. It will be issued if the text
is not found asynchronously after a call to
webkit_find_controller_search()
, webkit_find_controller_search_next()
or webkit_find_controller_search_previous()
.
Flags: Run Last
“found-text”
signalvoid user_function (WebKitFindController *find_controller, guint match_count, gpointer user_data)
This signal is emitted when a given text is found in the web
page text. It will be issued if the text is found
asynchronously after a call to webkit_find_controller_search()
,
webkit_find_controller_search_next()
or
webkit_find_controller_search_previous()
.
find_controller |
||
match_count |
the number of matches found of the search text |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last