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 |
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::searchChanged signal which can
be used instead of the Editable::changed signal.
The SearchEntry::previousMatch, SearchEntry::nextMatch and SearchEntry::stopSearch 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.
Since: 3.6
Synopsis
- newtype SearchEntry = SearchEntry (ManagedPtr SearchEntry)
- class (GObject o, IsDescendantOf SearchEntry o) => IsSearchEntry o
- toSearchEntry :: (MonadIO m, IsSearchEntry o) => o -> m SearchEntry
- searchEntryHandleEvent :: (HasCallStack, MonadIO m, IsSearchEntry a) => a -> Event -> m Bool
- searchEntryNew :: (HasCallStack, MonadIO m) => m SearchEntry
- type SearchEntryNextMatchCallback = IO ()
- afterSearchEntryNextMatch :: (IsSearchEntry a, MonadIO m) => a -> ((?self :: a) => SearchEntryNextMatchCallback) -> m SignalHandlerId
- onSearchEntryNextMatch :: (IsSearchEntry a, MonadIO m) => a -> ((?self :: a) => SearchEntryNextMatchCallback) -> m SignalHandlerId
- type SearchEntryPreviousMatchCallback = IO ()
- afterSearchEntryPreviousMatch :: (IsSearchEntry a, MonadIO m) => a -> ((?self :: a) => SearchEntryPreviousMatchCallback) -> m SignalHandlerId
- onSearchEntryPreviousMatch :: (IsSearchEntry a, MonadIO m) => a -> ((?self :: a) => SearchEntryPreviousMatchCallback) -> m SignalHandlerId
- type SearchEntrySearchChangedCallback = IO ()
- afterSearchEntrySearchChanged :: (IsSearchEntry a, MonadIO m) => a -> ((?self :: a) => SearchEntrySearchChangedCallback) -> m SignalHandlerId
- onSearchEntrySearchChanged :: (IsSearchEntry a, MonadIO m) => a -> ((?self :: a) => SearchEntrySearchChangedCallback) -> m SignalHandlerId
- type SearchEntryStopSearchCallback = IO ()
- afterSearchEntryStopSearch :: (IsSearchEntry a, MonadIO m) => a -> ((?self :: a) => SearchEntryStopSearchCallback) -> m SignalHandlerId
- onSearchEntryStopSearch :: (IsSearchEntry a, MonadIO m) => a -> ((?self :: a) => SearchEntryStopSearchCallback) -> m SignalHandlerId
Exported types
newtype SearchEntry Source #
Memory-managed wrapper type.
SearchEntry (ManagedPtr SearchEntry) |
Instances
Eq SearchEntry Source # | |
Defined in GI.Gtk.Objects.SearchEntry (==) :: SearchEntry -> SearchEntry -> Bool # (/=) :: SearchEntry -> SearchEntry -> Bool # | |
GObject SearchEntry Source # | |
Defined in GI.Gtk.Objects.SearchEntry | |
ManagedPtrNewtype SearchEntry Source # | |
Defined in GI.Gtk.Objects.SearchEntry toManagedPtr :: SearchEntry -> ManagedPtr SearchEntry | |
TypedObject SearchEntry Source # | |
Defined in GI.Gtk.Objects.SearchEntry | |
HasParentTypes SearchEntry Source # | |
Defined in GI.Gtk.Objects.SearchEntry | |
IsGValue (Maybe SearchEntry) Source # | Convert |
Defined in GI.Gtk.Objects.SearchEntry gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe SearchEntry -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe SearchEntry) | |
type ParentTypes SearchEntry Source # | |
Defined in GI.Gtk.Objects.SearchEntry type ParentTypes SearchEntry = '[Entry, Widget, Object, ImplementorIface, Buildable, CellEditable, Editable] |
class (GObject o, IsDescendantOf SearchEntry o) => IsSearchEntry o Source #
Type class for types which can be safely cast to SearchEntry
, for instance with toSearchEntry
.
Instances
(GObject o, IsDescendantOf SearchEntry o) => IsSearchEntry o 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
.
Methods
Click to display all available methods, including inherited ones
Methods
activate, addAccelerator, addChild, addDeviceEvents, addEvents, addMnemonicLabel, addTickCallback, bindProperty, bindPropertyFull, canActivateAccel, childFocus, childNotify, classPath, computeExpand, constructChild, copyClipboard, createPangoContext, createPangoLayout, customFinished, customTagEnd, customTagStart, cutClipboard, deleteSelection, deleteText, destroy, destroyed, deviceIsShadowed, dragBegin, dragBeginWithCoordinates, dragCheckThreshold, dragDestAddImageTargets, dragDestAddTextTargets, dragDestAddUriTargets, dragDestFindTarget, dragDestGetTargetList, dragDestGetTrackMotion, dragDestSet, dragDestSetProxy, dragDestSetTargetList, dragDestSetTrackMotion, dragDestUnset, dragGetData, dragHighlight, dragSourceAddImageTargets, dragSourceAddTextTargets, dragSourceAddUriTargets, dragSourceGetTargetList, dragSourceSet, dragSourceSetIconGicon, dragSourceSetIconName, dragSourceSetIconPixbuf, dragSourceSetIconStock, dragSourceSetTargetList, dragSourceUnset, dragUnhighlight, draw, editingDone, ensureStyle, errorBell, event, forceFloating, freezeChildNotify, freezeNotify, getv, grabAdd, grabDefault, grabFocus, grabFocusWithoutSelecting, grabRemove, handleEvent, hasDefault, hasFocus, hasGrab, hasRcStyle, hasScreen, hasVisibleFocus, hide, hideOnDelete, imContextFilterKeypress, inDestruction, initTemplate, inputShapeCombineRegion, insertActionGroup, insertText, intersect, isAncestor, isComposited, isDrawable, isFloating, isFocus, isSensitive, isToplevel, isVisible, keynavFailed, layoutIndexToTextIndex, listAccelClosures, listActionPrefixes, listMnemonicLabels, map, mnemonicActivate, modifyBase, modifyBg, modifyCursor, modifyFg, modifyFont, modifyStyle, modifyText, notify, notifyByPspec, overrideBackgroundColor, overrideColor, overrideCursor, overrideFont, overrideSymbolicColor, parserFinished, pasteClipboard, path, progressPulse, queueAllocate, queueComputeExpand, queueDraw, queueDrawArea, queueDrawRegion, queueResize, queueResizeNoRedraw, realize, ref, refSink, regionIntersect, registerWindow, removeAccelerator, removeMnemonicLabel, removeTickCallback, removeWidget, renderIcon, renderIconPixbuf, reparent, resetImContext, resetRcStyles, resetStyle, runDispose, selectRegion, sendExpose, sendFocusChange, shapeCombineRegion, show, showAll, showNow, sizeAllocate, sizeAllocateWithBaseline, sizeRequest, startEditing, stealData, stealQdata, styleAttach, styleGetProperty, textIndexToLayoutIndex, thawChildNotify, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unregisterWindow, unsetInvisibleChar, unsetStateFlags, watchClosure.
Getters
getAccessible, getActionGroup, getActivatesDefault, getAlignment, getAllocatedBaseline, getAllocatedHeight, getAllocatedSize, getAllocatedWidth, getAllocation, getAncestor, getAppPaintable, getAttributes, getBuffer, getCanDefault, getCanFocus, getChars, getChildRequisition, getChildVisible, getClip, getClipboard, getCompletion, getCompositeName, getCurrentIconDragSource, getCursorHadjustment, getData, getDeviceEnabled, getDeviceEvents, getDirection, getDisplay, getDoubleBuffered, getEditable, getEvents, getFocusOnClick, getFontMap, getFontOptions, getFrameClock, getHalign, getHasFrame, getHasTooltip, getHasWindow, getHexpand, getHexpandSet, getIconActivatable, getIconArea, getIconAtPos, getIconGicon, getIconName, getIconPixbuf, getIconSensitive, getIconStock, getIconStorageType, getIconTooltipMarkup, getIconTooltipText, getInnerBorder, getInputHints, getInputPurpose, getInternalChild, getInvisibleChar, getLayout, getLayoutOffsets, getMapped, getMarginBottom, getMarginEnd, getMarginLeft, getMarginRight, getMarginStart, getMarginTop, getMaxLength, getMaxWidthChars, getModifierMask, getModifierStyle, getName, getNoShowAll, getOpacity, getOverwriteMode, getPangoContext, getParent, getParentWindow, getPath, getPlaceholderText, getPointer, getPosition, getPreferredHeight, getPreferredHeightAndBaselineForWidth, getPreferredHeightForWidth, getPreferredSize, getPreferredWidth, getPreferredWidthForHeight, getProgressFraction, getProgressPulseStep, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRequisition, getRootWindow, getScaleFactor, getScreen, getSelectionBounds, getSensitive, getSettings, getSizeRequest, getState, getStateFlags, getStyle, getStyleContext, getSupportMultidevice, getTabs, getTemplateChild, getText, getTextArea, getTextLength, getTooltipMarkup, getTooltipText, getTooltipWindow, getToplevel, getValign, getValignWithBaseline, getVexpand, getVexpandSet, getVisibility, getVisible, getVisual, getWidthChars, getWindow.
Setters
setAccelPath, setActivatesDefault, setAlignment, setAllocation, setAppPaintable, setAttributes, setBuffer, setBuildableProperty, setCanDefault, setCanFocus, setChildVisible, setClip, setCompletion, setCompositeName, setCursorHadjustment, setData, setDataFull, setDeviceEnabled, setDeviceEvents, setDirection, setDoubleBuffered, setEditable, setEvents, setFocusOnClick, setFontMap, setFontOptions, setHalign, setHasFrame, setHasTooltip, setHasWindow, setHexpand, setHexpandSet, setIconActivatable, setIconDragSource, setIconFromGicon, setIconFromIconName, setIconFromPixbuf, setIconFromStock, setIconSensitive, setIconTooltipMarkup, setIconTooltipText, setInnerBorder, setInputHints, setInputPurpose, setInvisibleChar, setMapped, setMarginBottom, setMarginEnd, setMarginLeft, setMarginRight, setMarginStart, setMarginTop, setMaxLength, setMaxWidthChars, setName, setNoShowAll, setOpacity, setOverwriteMode, setParent, setParentWindow, setPlaceholderText, setPosition, setProgressFraction, setProgressPulseStep, setProperty, setRealized, setReceivesDefault, setRedrawOnAllocate, setSensitive, setSizeRequest, setState, setStateFlags, setStyle, setSupportMultidevice, setTabs, setText, setTooltipMarkup, setTooltipText, setTooltipWindow, setValign, setVexpand, setVexpandSet, setVisibility, setVisible, setVisual, setWidthChars, setWindow.
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 SearchEntryNextMatchCallback = IO () Source #
The nextMatch 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 -> ((?self :: a) => SearchEntryNextMatchCallback) -> m SignalHandlerId Source #
Connect a signal handler for the nextMatch signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
searchEntry #nextMatch 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.
onSearchEntryNextMatch :: (IsSearchEntry a, MonadIO m) => a -> ((?self :: a) => SearchEntryNextMatchCallback) -> m SignalHandlerId Source #
Connect a signal handler for the nextMatch signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
searchEntry #nextMatch callback
previousMatch
type SearchEntryPreviousMatchCallback = IO () Source #
The previousMatch 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 -> ((?self :: a) => SearchEntryPreviousMatchCallback) -> m SignalHandlerId Source #
Connect a signal handler for the previousMatch signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
searchEntry #previousMatch 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.
onSearchEntryPreviousMatch :: (IsSearchEntry a, MonadIO m) => a -> ((?self :: a) => SearchEntryPreviousMatchCallback) -> m SignalHandlerId Source #
Connect a signal handler for the previousMatch signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
searchEntry #previousMatch callback
searchChanged
type SearchEntrySearchChangedCallback = IO () Source #
The SearchEntry::searchChanged 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 -> ((?self :: a) => SearchEntrySearchChangedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the searchChanged signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
searchEntry #searchChanged 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.
onSearchEntrySearchChanged :: (IsSearchEntry a, MonadIO m) => a -> ((?self :: a) => SearchEntrySearchChangedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the searchChanged signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
searchEntry #searchChanged callback
stopSearch
type SearchEntryStopSearchCallback = IO () Source #
The stopSearch 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 -> ((?self :: a) => SearchEntryStopSearchCallback) -> m SignalHandlerId Source #
Connect a signal handler for the stopSearch signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
searchEntry #stopSearch 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.
onSearchEntryStopSearch :: (IsSearchEntry a, MonadIO m) => a -> ((?self :: a) => SearchEntryStopSearchCallback) -> m SignalHandlerId Source #
Connect a signal handler for the stopSearch signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
searchEntry #stopSearch callback