Trait webkit2gtk::prelude::FindControllerExt
source · [−]pub trait FindControllerExt: 'static {
Show 16 methods
fn count_matches(
&self,
search_text: &str,
find_options: u32,
max_match_count: u32
);
fn max_match_count(&self) -> u32;
fn options(&self) -> u32;
fn search_text(&self) -> Option<GString>;
fn web_view(&self) -> Option<WebView>;
fn search(&self, search_text: &str, find_options: u32, max_match_count: u32);
fn search_finish(&self);
fn search_next(&self);
fn search_previous(&self);
fn text(&self) -> Option<GString>;
fn connect_counted_matches<F: Fn(&Self, u32) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_failed_to_find_text<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_found_text<F: Fn(&Self, u32) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_max_match_count_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_options_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_text_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
}
Expand description
Required Methods
sourcefn count_matches(&self, search_text: &str, find_options: u32, max_match_count: u32)
fn count_matches(&self, search_text: &str, find_options: u32, max_match_count: u32)
Counts the number of matches for search_text
.
Counts the number of matches for search_text
found in the
WebView
with the provided find_options
. The number of
matches will be provided by the
signal::FindController::counted-matches
signal.
search_text
the text to look for
find_options
a bitmask with the FindOptions
used in the search
max_match_count
the maximum number of matches allowed in the search
sourcefn max_match_count(&self) -> u32
fn max_match_count(&self) -> u32
Gets the maximum number of matches to report.
Gets the maximum number of matches to report during a text
lookup. This number is passed as the last argument of
search()
or
count_matches()
.
Returns
the maximum number of matches to report.
sourcefn options(&self) -> u32
fn options(&self) -> u32
Gets the FindOptions
for the current search.
Gets a bitmask containing the FindOptions
associated with
the current search.
Returns
a bitmask containing the FindOptions
associated
with the current search.
sourcefn search_text(&self) -> Option<GString>
fn search_text(&self) -> Option<GString>
Gets the text that self
is searching for.
Gets the text that self
is currently searching
for. This text is passed to either
search()
or
count_matches()
.
Returns
the text to look for in the WebView
.
sourcefn web_view(&self) -> Option<WebView>
fn web_view(&self) -> Option<WebView>
Gets the WebView
this find controller is associated to.
Do
not dereference the returned instance as it belongs to the
FindController
.
Returns
the WebView
.
sourcefn search(&self, search_text: &str, find_options: u32, max_match_count: u32)
fn search(&self, search_text: &str, find_options: u32, max_match_count: u32)
Looks for search_text
associated with self
.
Looks for search_text
in the WebView
associated with
self
since the beginning of the document highlighting
up to max_match_count
matches. The outcome of the search will be
asynchronously provided by the signal::FindController::found-text
and signal::FindController::failed-to-find-text
signals.
To look for the next or previous occurrences of the same text
with the same find options use search_next()
and/or search_previous()
. The
FindController
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 signal::FindController::found-text
will report G_MAXUINT
matches
instead of the actual number.
Callers should call search_finish()
to
finish the current search operation.
search_text
the text to look for
find_options
a bitmask with the FindOptions
used in the search
max_match_count
the maximum number of matches allowed in the search
sourcefn search_finish(&self)
fn search_finish(&self)
Finishes a find operation.
Finishes a find operation started by
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.
sourcefn search_next(&self)
fn search_next(&self)
Looks for the next occurrence of the search text.
Calling this method before search()
or
count_matches()
is a programming error.
sourcefn search_previous(&self)
fn search_previous(&self)
Looks for the previous occurrence of the search text.
Calling this method before search()
or
count_matches()
is a programming error.
sourcefn text(&self) -> Option<GString>
fn text(&self) -> Option<GString>
The current search text for this FindController
.
sourcefn connect_counted_matches<F: Fn(&Self, u32) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_counted_matches<F: Fn(&Self, u32) + 'static>(
&self,
f: F
) -> SignalHandlerId
This signal is emitted when the FindController
has
counted the number of matches for a given text after a call
to count_matches()
.
match_count
the number of matches of the search text
sourcefn connect_failed_to_find_text<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_failed_to_find_text<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
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
search()
, search_next()
or search_previous()
.
sourcefn connect_found_text<F: Fn(&Self, u32) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_found_text<F: Fn(&Self, u32) + 'static>(
&self,
f: F
) -> SignalHandlerId
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 search()
,
search_next()
or
search_previous()
.
match_count
the number of matches found of the search text