Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Controls text search in a WebView
.
A FindController
is used to search text in a WebView
. You
can get a WebView
's FindController
with
webViewGetFindController
, and later use it to search
for text using findControllerSearch
, or get the
number of matches using findControllerCountMatches
. The
operations are asynchronous and trigger signals when ready, such as
FindController::foundText,
FindController::failedToFindText or
FindController::countedMatches.
Synopsis
- newtype FindController = FindController (ManagedPtr FindController)
- class (GObject o, IsDescendantOf FindController o) => IsFindController o
- toFindController :: (MonadIO m, IsFindController o) => o -> m FindController
- findControllerCountMatches :: (HasCallStack, MonadIO m, IsFindController a) => a -> Text -> Word32 -> Word32 -> m ()
- findControllerGetMaxMatchCount :: (HasCallStack, MonadIO m, IsFindController a) => a -> m Word32
- findControllerGetOptions :: (HasCallStack, MonadIO m, IsFindController a) => a -> m Word32
- findControllerGetSearchText :: (HasCallStack, MonadIO m, IsFindController a) => a -> m Text
- findControllerGetWebView :: (HasCallStack, MonadIO m, IsFindController a) => a -> m WebView
- findControllerSearch :: (HasCallStack, MonadIO m, IsFindController a) => a -> Text -> Word32 -> Word32 -> m ()
- findControllerSearchFinish :: (HasCallStack, MonadIO m, IsFindController a) => a -> m ()
- findControllerSearchNext :: (HasCallStack, MonadIO m, IsFindController a) => a -> m ()
- findControllerSearchPrevious :: (HasCallStack, MonadIO m, IsFindController a) => a -> m ()
- getFindControllerMaxMatchCount :: (MonadIO m, IsFindController o) => o -> m Word32
- getFindControllerOptions :: (MonadIO m, IsFindController o) => o -> m [FindOptions]
- getFindControllerText :: (MonadIO m, IsFindController o) => o -> m (Maybe Text)
- constructFindControllerWebView :: (IsFindController o, MonadIO m, IsWebView a) => a -> m (GValueConstruct o)
- getFindControllerWebView :: (MonadIO m, IsFindController o) => o -> m WebView
- type FindControllerCountedMatchesCallback = Word32 -> IO ()
- afterFindControllerCountedMatches :: (IsFindController a, MonadIO m) => a -> ((?self :: a) => FindControllerCountedMatchesCallback) -> m SignalHandlerId
- onFindControllerCountedMatches :: (IsFindController a, MonadIO m) => a -> ((?self :: a) => FindControllerCountedMatchesCallback) -> m SignalHandlerId
- type FindControllerFailedToFindTextCallback = IO ()
- afterFindControllerFailedToFindText :: (IsFindController a, MonadIO m) => a -> ((?self :: a) => FindControllerFailedToFindTextCallback) -> m SignalHandlerId
- onFindControllerFailedToFindText :: (IsFindController a, MonadIO m) => a -> ((?self :: a) => FindControllerFailedToFindTextCallback) -> m SignalHandlerId
- type FindControllerFoundTextCallback = Word32 -> IO ()
- afterFindControllerFoundText :: (IsFindController a, MonadIO m) => a -> ((?self :: a) => FindControllerFoundTextCallback) -> m SignalHandlerId
- onFindControllerFoundText :: (IsFindController a, MonadIO m) => a -> ((?self :: a) => FindControllerFoundTextCallback) -> m SignalHandlerId
Exported types
newtype FindController Source #
Memory-managed wrapper type.
FindController (ManagedPtr FindController) |
Instances
Eq FindController Source # | |
Defined in GI.WebKit2.Objects.FindController (==) :: FindController -> FindController -> Bool # (/=) :: FindController -> FindController -> Bool # | |
GObject FindController Source # | |
Defined in GI.WebKit2.Objects.FindController | |
ManagedPtrNewtype FindController Source # | |
Defined in GI.WebKit2.Objects.FindController toManagedPtr :: FindController -> ManagedPtr FindController | |
TypedObject FindController Source # | |
Defined in GI.WebKit2.Objects.FindController | |
HasParentTypes FindController Source # | |
Defined in GI.WebKit2.Objects.FindController | |
IsGValue (Maybe FindController) Source # | Convert |
Defined in GI.WebKit2.Objects.FindController gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe FindController -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe FindController) | |
type ParentTypes FindController Source # | |
Defined in GI.WebKit2.Objects.FindController type ParentTypes FindController = '[Object] |
class (GObject o, IsDescendantOf FindController o) => IsFindController o Source #
Type class for types which can be safely cast to FindController
, for instance with toFindController
.
Instances
(GObject o, IsDescendantOf FindController o) => IsFindController o Source # | |
Defined in GI.WebKit2.Objects.FindController |
toFindController :: (MonadIO m, IsFindController o) => o -> m FindController Source #
Cast to FindController
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, countMatches, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, search, searchFinish, searchNext, searchPrevious, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getMaxMatchCount, getOptions, getProperty, getQdata, getSearchText, getWebView.
Setters
countMatches
findControllerCountMatches Source #
:: (HasCallStack, MonadIO m, IsFindController a) | |
=> a |
|
-> Text |
|
-> Word32 |
|
-> Word32 |
|
-> m () |
Counts the number of matches for searchText
.
Counts the number of matches for searchText
found in the
WebView
with the provided findOptions
. The number of
matches will be provided by the
FindController::countedMatches signal.
getMaxMatchCount
findControllerGetMaxMatchCount Source #
:: (HasCallStack, MonadIO m, IsFindController a) | |
=> a |
|
-> m Word32 | Returns: the maximum number of matches to report. |
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
findControllerSearch
or
findControllerCountMatches
.
getOptions
findControllerGetOptions Source #
:: (HasCallStack, MonadIO m, IsFindController a) | |
=> a |
|
-> m Word32 | Returns: a bitmask containing the |
Gets the FindOptions
for the current search.
Gets a bitmask containing the FindOptions
associated with
the current search.
getSearchText
findControllerGetSearchText Source #
:: (HasCallStack, MonadIO m, IsFindController a) | |
=> a |
|
-> m Text | Returns: the text to look for in the |
Gets the text that findController
is searching for.
Gets the text that findController
is currently searching
for. This text is passed to either
findControllerSearch
or
findControllerCountMatches
.
getWebView
findControllerGetWebView Source #
:: (HasCallStack, MonadIO m, IsFindController a) | |
=> a |
|
-> m WebView | Returns: the |
Gets the WebView
this find controller is associated to.
Do
not dereference the returned instance as it belongs to the
FindController
.
search
:: (HasCallStack, MonadIO m, IsFindController a) | |
=> a |
|
-> Text |
|
-> Word32 |
|
-> Word32 |
|
-> m () |
Looks for searchText
associated with findController
.
Looks for searchText
in the WebView
associated with
findController
since the beginning of the document highlighting
up to maxMatchCount
matches. The outcome of the search will be
asynchronously provided by the FindController::foundText
and FindController::failedToFindText signals.
To look for the next or previous occurrences of the same text
with the same find options use findControllerSearchNext
and/or findControllerSearchPrevious
. 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 maxMatchCount
then FindController::foundText will report G_MAXUINT
matches
instead of the actual number.
Callers should call findControllerSearchFinish
to
finish the current search operation.
searchFinish
findControllerSearchFinish Source #
:: (HasCallStack, MonadIO m, IsFindController a) | |
=> a |
|
-> m () |
Finishes a find operation.
Finishes a find operation started by
findControllerSearch
. 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.
searchNext
findControllerSearchNext Source #
:: (HasCallStack, MonadIO m, IsFindController a) | |
=> a |
|
-> m () |
Looks for the next occurrence of the search text.
Calling this method before findControllerSearch
or
findControllerCountMatches
is a programming error.
searchPrevious
findControllerSearchPrevious Source #
:: (HasCallStack, MonadIO m, IsFindController a) | |
=> a |
|
-> m () |
Looks for the previous occurrence of the search text.
Calling this method before findControllerSearch
or
findControllerCountMatches
is a programming error.
Properties
maxMatchCount
The maximum number of matches to report for a given search.
getFindControllerMaxMatchCount :: (MonadIO m, IsFindController o) => o -> m Word32 Source #
Get the value of the “max-match-count
” property.
When overloading is enabled, this is equivalent to
get
findController #maxMatchCount
options
The options to be used in the search operation.
getFindControllerOptions :: (MonadIO m, IsFindController o) => o -> m [FindOptions] Source #
Get the value of the “options
” property.
When overloading is enabled, this is equivalent to
get
findController #options
text
The current search text for this FindController
.
getFindControllerText :: (MonadIO m, IsFindController o) => o -> m (Maybe Text) Source #
Get the value of the “text
” property.
When overloading is enabled, this is equivalent to
get
findController #text
webView
The WebView
this controller is associated to.
constructFindControllerWebView :: (IsFindController o, MonadIO m, IsWebView a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “web-view
” property. This is rarely needed directly, but it is used by new
.
getFindControllerWebView :: (MonadIO m, IsFindController o) => o -> m WebView Source #
Get the value of the “web-view
” property.
When overloading is enabled, this is equivalent to
get
findController #webView
Signals
countedMatches
type FindControllerCountedMatchesCallback Source #
This signal is emitted when the FindController
has
counted the number of matches for a given text after a call
to findControllerCountMatches
.
afterFindControllerCountedMatches :: (IsFindController a, MonadIO m) => a -> ((?self :: a) => FindControllerCountedMatchesCallback) -> m SignalHandlerId Source #
Connect a signal handler for the countedMatches signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
findController #countedMatches callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onFindControllerCountedMatches :: (IsFindController a, MonadIO m) => a -> ((?self :: a) => FindControllerCountedMatchesCallback) -> m SignalHandlerId Source #
Connect a signal handler for the countedMatches signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
findController #countedMatches callback
failedToFindText
type FindControllerFailedToFindTextCallback = IO () Source #
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
findControllerSearch
, findControllerSearchNext
or findControllerSearchPrevious
.
afterFindControllerFailedToFindText :: (IsFindController a, MonadIO m) => a -> ((?self :: a) => FindControllerFailedToFindTextCallback) -> m SignalHandlerId Source #
Connect a signal handler for the failedToFindText signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
findController #failedToFindText callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onFindControllerFailedToFindText :: (IsFindController a, MonadIO m) => a -> ((?self :: a) => FindControllerFailedToFindTextCallback) -> m SignalHandlerId Source #
Connect a signal handler for the failedToFindText signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
findController #failedToFindText callback
foundText
type FindControllerFoundTextCallback Source #
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 findControllerSearch
,
findControllerSearchNext
or
findControllerSearchPrevious
.
afterFindControllerFoundText :: (IsFindController a, MonadIO m) => a -> ((?self :: a) => FindControllerFoundTextCallback) -> m SignalHandlerId Source #
Connect a signal handler for the foundText signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
findController #foundText callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onFindControllerFoundText :: (IsFindController a, MonadIO m) => a -> ((?self :: a) => FindControllerFoundTextCallback) -> m SignalHandlerId Source #
Connect a signal handler for the foundText signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
findController #foundText callback