Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
SearchEntry
is a subclass of Entry
that has been
tailored for use as a search entry.
It will show an inactive symbolic “find” icon when the search entry is empty, and a symbolic “clear” icon when there is text. Clicking on the “clear” icon will empty the search entry.
Note that the search/clear icon is shown using a secondary icon, and thus does not work if you are using the secondary icon position for some other purpose.
To make filtering appear more reactive, it is a good idea to
not react to every change in the entry text immediately, but
only after a short delay. To support this, SearchEntry
emits the SearchEntry
::search-changed
signal which can
be used instead of the Editable
::changed
signal.
The SearchEntry
::previous-match
, SearchEntry
::next-match
and SearchEntry
::stop-search
signals can be used to implement
moving between search results and ending the search.
Often, GtkSearchEntry will be fed events by means of being
placed inside a SearchBar
. If that is not the case,
you can use searchEntryHandleEvent
to pass events.
Synopsis
- newtype SearchEntry = SearchEntry (ManagedPtr SearchEntry)
- class GObject o => IsSearchEntry o
- toSearchEntry :: (MonadIO m, IsSearchEntry o) => o -> m SearchEntry
- noSearchEntry :: Maybe SearchEntry
- searchEntryHandleEvent :: (HasCallStack, MonadIO m, IsSearchEntry a) => a -> Event -> m Bool
- searchEntryNew :: (HasCallStack, MonadIO m) => m SearchEntry
- type C_SearchEntryNextMatchCallback = Ptr () -> Ptr () -> IO ()
- type SearchEntryNextMatchCallback = IO ()
- afterSearchEntryNextMatch :: (IsSearchEntry a, MonadIO m) => a -> SearchEntryNextMatchCallback -> m SignalHandlerId
- genClosure_SearchEntryNextMatch :: SearchEntryNextMatchCallback -> IO Closure
- mk_SearchEntryNextMatchCallback :: C_SearchEntryNextMatchCallback -> IO (FunPtr C_SearchEntryNextMatchCallback)
- noSearchEntryNextMatchCallback :: Maybe SearchEntryNextMatchCallback
- onSearchEntryNextMatch :: (IsSearchEntry a, MonadIO m) => a -> SearchEntryNextMatchCallback -> m SignalHandlerId
- wrap_SearchEntryNextMatchCallback :: SearchEntryNextMatchCallback -> C_SearchEntryNextMatchCallback
- type C_SearchEntryPreviousMatchCallback = Ptr () -> Ptr () -> IO ()
- type SearchEntryPreviousMatchCallback = IO ()
- afterSearchEntryPreviousMatch :: (IsSearchEntry a, MonadIO m) => a -> SearchEntryPreviousMatchCallback -> m SignalHandlerId
- genClosure_SearchEntryPreviousMatch :: SearchEntryPreviousMatchCallback -> IO Closure
- mk_SearchEntryPreviousMatchCallback :: C_SearchEntryPreviousMatchCallback -> IO (FunPtr C_SearchEntryPreviousMatchCallback)
- noSearchEntryPreviousMatchCallback :: Maybe SearchEntryPreviousMatchCallback
- onSearchEntryPreviousMatch :: (IsSearchEntry a, MonadIO m) => a -> SearchEntryPreviousMatchCallback -> m SignalHandlerId
- wrap_SearchEntryPreviousMatchCallback :: SearchEntryPreviousMatchCallback -> C_SearchEntryPreviousMatchCallback
- type C_SearchEntrySearchChangedCallback = Ptr () -> Ptr () -> IO ()
- type SearchEntrySearchChangedCallback = IO ()
- afterSearchEntrySearchChanged :: (IsSearchEntry a, MonadIO m) => a -> SearchEntrySearchChangedCallback -> m SignalHandlerId
- genClosure_SearchEntrySearchChanged :: SearchEntrySearchChangedCallback -> IO Closure
- mk_SearchEntrySearchChangedCallback :: C_SearchEntrySearchChangedCallback -> IO (FunPtr C_SearchEntrySearchChangedCallback)
- noSearchEntrySearchChangedCallback :: Maybe SearchEntrySearchChangedCallback
- onSearchEntrySearchChanged :: (IsSearchEntry a, MonadIO m) => a -> SearchEntrySearchChangedCallback -> m SignalHandlerId
- wrap_SearchEntrySearchChangedCallback :: SearchEntrySearchChangedCallback -> C_SearchEntrySearchChangedCallback
- type C_SearchEntryStopSearchCallback = Ptr () -> Ptr () -> IO ()
- type SearchEntryStopSearchCallback = IO ()
- afterSearchEntryStopSearch :: (IsSearchEntry a, MonadIO m) => a -> SearchEntryStopSearchCallback -> m SignalHandlerId
- genClosure_SearchEntryStopSearch :: SearchEntryStopSearchCallback -> IO Closure
- mk_SearchEntryStopSearchCallback :: C_SearchEntryStopSearchCallback -> IO (FunPtr C_SearchEntryStopSearchCallback)
- noSearchEntryStopSearchCallback :: Maybe SearchEntryStopSearchCallback
- onSearchEntryStopSearch :: (IsSearchEntry a, MonadIO m) => a -> SearchEntryStopSearchCallback -> m SignalHandlerId
- wrap_SearchEntryStopSearchCallback :: SearchEntryStopSearchCallback -> C_SearchEntryStopSearchCallback
Exported types
newtype SearchEntry Source #
Memory-managed wrapper type.
Instances
GObject SearchEntry Source # | |
Defined in GI.Gtk.Objects.SearchEntry gobjectType :: SearchEntry -> IO GType # | |
IsImplementorIface SearchEntry Source # | |
Defined in GI.Gtk.Objects.SearchEntry | |
IsObject SearchEntry Source # | |
Defined in GI.Gtk.Objects.SearchEntry | |
IsBuildable SearchEntry Source # | |
Defined in GI.Gtk.Objects.SearchEntry | |
IsCellEditable SearchEntry Source # | |
Defined in GI.Gtk.Objects.SearchEntry | |
IsEditable SearchEntry Source # | |
Defined in GI.Gtk.Objects.SearchEntry | |
IsEntry SearchEntry Source # | |
Defined in GI.Gtk.Objects.SearchEntry | |
IsWidget SearchEntry Source # | |
Defined in GI.Gtk.Objects.SearchEntry | |
IsSearchEntry SearchEntry Source # | |
Defined in GI.Gtk.Objects.SearchEntry |
class GObject o => IsSearchEntry o Source #
Type class for types which can be safely cast to SearchEntry
, for instance with toSearchEntry
.
Instances
(GObject a, (UnknownAncestorError SearchEntry a :: Constraint)) => IsSearchEntry a Source # | |
Defined in GI.Gtk.Objects.SearchEntry | |
IsSearchEntry SearchEntry Source # | |
Defined in GI.Gtk.Objects.SearchEntry |
toSearchEntry :: (MonadIO m, IsSearchEntry o) => o -> m SearchEntry Source #
Cast to SearchEntry
, for types for which this is known to be safe. For general casts, use castTo
.
noSearchEntry :: Maybe SearchEntry Source #
A convenience alias for Nothing
:: Maybe
SearchEntry
.
Methods
handleEvent
searchEntryHandleEvent Source #
:: (HasCallStack, MonadIO m, IsSearchEntry a) | |
=> a |
|
-> Event |
|
-> m Bool | Returns: |
This function should be called when the top-level window
which contains the search entry received a key event. If
the entry is part of a SearchBar
, it is preferable
to call searchBarHandleEvent
instead, which will
reveal the entry in addition to passing the event to this
function.
If the key event is handled by the search entry and starts
or continues a search, EVENT_STOP
will be returned.
The caller should ensure that the entry is shown in this
case, and not propagate the event further.
Since: 3.16
new
:: (HasCallStack, MonadIO m) | |
=> m SearchEntry | Returns: a new |
Creates a SearchEntry
, with a find icon when the search field is
empty, and a clear icon when it isn't.
Since: 3.6
Signals
nextMatch
type C_SearchEntryNextMatchCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type SearchEntryNextMatchCallback = IO () Source #
The ::next-match signal is a [keybinding signal][GtkBindingSignal] which gets emitted when the user initiates a move to the next match for the current search string.
Applications should connect to it, to implement moving between matches.
The default bindings for this signal is Ctrl-g.
Since: 3.16
afterSearchEntryNextMatch :: (IsSearchEntry a, MonadIO m) => a -> SearchEntryNextMatchCallback -> m SignalHandlerId Source #
Connect a signal handler for the “next-match
” signal, to be run after the default handler.
When overloading is enabled, this is equivalent to
after
searchEntry #nextMatch callback
genClosure_SearchEntryNextMatch :: SearchEntryNextMatchCallback -> IO Closure Source #
Wrap the callback into a Closure
.
mk_SearchEntryNextMatchCallback :: C_SearchEntryNextMatchCallback -> IO (FunPtr C_SearchEntryNextMatchCallback) Source #
Generate a function pointer callable from C code, from a C_SearchEntryNextMatchCallback
.
noSearchEntryNextMatchCallback :: Maybe SearchEntryNextMatchCallback Source #
A convenience synonym for
.Nothing
:: Maybe
SearchEntryNextMatchCallback
onSearchEntryNextMatch :: (IsSearchEntry a, MonadIO m) => a -> SearchEntryNextMatchCallback -> m SignalHandlerId Source #
Connect a signal handler for the “next-match
” signal, to be run before the default handler.
When overloading is enabled, this is equivalent to
on
searchEntry #nextMatch callback
wrap_SearchEntryNextMatchCallback :: SearchEntryNextMatchCallback -> C_SearchEntryNextMatchCallback Source #
Wrap a SearchEntryNextMatchCallback
into a C_SearchEntryNextMatchCallback
.
previousMatch
type C_SearchEntryPreviousMatchCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type SearchEntryPreviousMatchCallback = IO () Source #
The ::previous-match signal is a [keybinding signal][GtkBindingSignal] which gets emitted when the user initiates a move to the previous match for the current search string.
Applications should connect to it, to implement moving between matches.
The default bindings for this signal is Ctrl-Shift-g.
Since: 3.16
afterSearchEntryPreviousMatch :: (IsSearchEntry a, MonadIO m) => a -> SearchEntryPreviousMatchCallback -> m SignalHandlerId Source #
Connect a signal handler for the “previous-match
” signal, to be run after the default handler.
When overloading is enabled, this is equivalent to
after
searchEntry #previousMatch callback
genClosure_SearchEntryPreviousMatch :: SearchEntryPreviousMatchCallback -> IO Closure Source #
Wrap the callback into a Closure
.
mk_SearchEntryPreviousMatchCallback :: C_SearchEntryPreviousMatchCallback -> IO (FunPtr C_SearchEntryPreviousMatchCallback) Source #
Generate a function pointer callable from C code, from a C_SearchEntryPreviousMatchCallback
.
noSearchEntryPreviousMatchCallback :: Maybe SearchEntryPreviousMatchCallback Source #
A convenience synonym for
.Nothing
:: Maybe
SearchEntryPreviousMatchCallback
onSearchEntryPreviousMatch :: (IsSearchEntry a, MonadIO m) => a -> SearchEntryPreviousMatchCallback -> m SignalHandlerId Source #
Connect a signal handler for the “previous-match
” signal, to be run before the default handler.
When overloading is enabled, this is equivalent to
on
searchEntry #previousMatch callback
wrap_SearchEntryPreviousMatchCallback :: SearchEntryPreviousMatchCallback -> C_SearchEntryPreviousMatchCallback Source #
searchChanged
type C_SearchEntrySearchChangedCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type SearchEntrySearchChangedCallback = IO () Source #
The SearchEntry
::search-changed
signal is emitted with a short
delay of 150 milliseconds after the last change to the entry text.
Since: 3.10
afterSearchEntrySearchChanged :: (IsSearchEntry a, MonadIO m) => a -> SearchEntrySearchChangedCallback -> m SignalHandlerId Source #
Connect a signal handler for the “search-changed
” signal, to be run after the default handler.
When overloading is enabled, this is equivalent to
after
searchEntry #searchChanged callback
genClosure_SearchEntrySearchChanged :: SearchEntrySearchChangedCallback -> IO Closure Source #
Wrap the callback into a Closure
.
mk_SearchEntrySearchChangedCallback :: C_SearchEntrySearchChangedCallback -> IO (FunPtr C_SearchEntrySearchChangedCallback) Source #
Generate a function pointer callable from C code, from a C_SearchEntrySearchChangedCallback
.
noSearchEntrySearchChangedCallback :: Maybe SearchEntrySearchChangedCallback Source #
A convenience synonym for
.Nothing
:: Maybe
SearchEntrySearchChangedCallback
onSearchEntrySearchChanged :: (IsSearchEntry a, MonadIO m) => a -> SearchEntrySearchChangedCallback -> m SignalHandlerId Source #
Connect a signal handler for the “search-changed
” signal, to be run before the default handler.
When overloading is enabled, this is equivalent to
on
searchEntry #searchChanged callback
wrap_SearchEntrySearchChangedCallback :: SearchEntrySearchChangedCallback -> C_SearchEntrySearchChangedCallback Source #
stopSearch
type C_SearchEntryStopSearchCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type SearchEntryStopSearchCallback = IO () Source #
The ::stop-search signal is a [keybinding signal][GtkBindingSignal] which gets emitted when the user stops a search via keyboard input.
Applications should connect to it, to implement hiding the search entry in this case.
The default bindings for this signal is Escape.
Since: 3.16
afterSearchEntryStopSearch :: (IsSearchEntry a, MonadIO m) => a -> SearchEntryStopSearchCallback -> m SignalHandlerId Source #
Connect a signal handler for the “stop-search
” signal, to be run after the default handler.
When overloading is enabled, this is equivalent to
after
searchEntry #stopSearch callback
genClosure_SearchEntryStopSearch :: SearchEntryStopSearchCallback -> IO Closure Source #
Wrap the callback into a Closure
.
mk_SearchEntryStopSearchCallback :: C_SearchEntryStopSearchCallback -> IO (FunPtr C_SearchEntryStopSearchCallback) Source #
Generate a function pointer callable from C code, from a C_SearchEntryStopSearchCallback
.
noSearchEntryStopSearchCallback :: Maybe SearchEntryStopSearchCallback Source #
A convenience synonym for
.Nothing
:: Maybe
SearchEntryStopSearchCallback
onSearchEntryStopSearch :: (IsSearchEntry a, MonadIO m) => a -> SearchEntryStopSearchCallback -> m SignalHandlerId Source #
Connect a signal handler for the “stop-search
” signal, to be run before the default handler.
When overloading is enabled, this is equivalent to
on
searchEntry #stopSearch callback