SearchBarRef

public struct SearchBarRef : SearchBarProtocol, GWeakCapturing

GtkSearchBar is a container made to have a search entry.

An example GtkSearchBar

It can also contain additional widgets, such as drop-down menus, or buttons. The search bar would appear when a search is started through typing on the keyboard, or the application’s search mode is toggled on.

For keyboard presses to start a search, the search bar must be told of a widget to capture key events from through [methodGtk.SearchBar.set_key_capture_widget]. This widget will typically be the top-level window, or a parent container of the search bar. Common shortcuts such as Ctrl+F should be handled as an application action, or through the menu items.

You will also need to tell the search bar about which entry you are using as your search entry using [methodGtk.SearchBar.connect_entry].

The following example shows you how to create a more complex search entry.

A simple example

CSS nodes

searchbar
╰── revealer
    ╰── box
         ├── [child]
         ╰── [button.close]

GtkSearchBar has a main CSS node with name searchbar. It has a child node with name revealer that contains a node with name box. The box node contains both the CSS node of the child widget as well as an optional button node which gets the .close style class applied.

Accessibility

GtkSearchBar uses the GTK_ACCESSIBLE_ROLE_SEARCH role.

The SearchBarRef type acts as a lightweight Swift reference to an underlying GtkSearchBar instance. It exposes methods that can operate on this data type through SearchBarProtocol conformance. Use SearchBarRef only as an unowned reference to an existing GtkSearchBar instance.

  • ptr
    Untyped pointer to the underlying `GtkSearchBar` instance.
    

    For type-safe access, use the generated, typed pointer search_bar_ptr property instead.

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!

SearchBar Class

  • Designated initialiser from the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafeMutablePointer<GtkSearchBar>)
  • Designated initialiser from a constant pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafePointer<GtkSearchBar>)
  • Conditional initialiser from an optional pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafeMutablePointer<GtkSearchBar>?)
  • Conditional initialiser from an optional, non-mutable pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafePointer<GtkSearchBar>?)
  • Conditional initialiser from an optional gpointer

    Declaration

    Swift

    @inlinable
    init!(gpointer g: gpointer?)
  • Conditional initialiser from an optional, non-mutable gconstpointer

    Declaration

    Swift

    @inlinable
    init!(gconstpointer g: gconstpointer?)
  • Reference intialiser for a related type that implements SearchBarProtocol

    Declaration

    Swift

    @inlinable
    init<T>(_ other: T) where T : SearchBarProtocol
  • This factory is syntactic sugar for setting weak pointers wrapped in GWeak<T>

    Declaration

    Swift

    @inlinable
    static func unowned<T>(_ other: T) -> SearchBarRef where T : SearchBarProtocol
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to SearchBarProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(cPointer: UnsafeMutablePointer<T>)
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to SearchBarProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(constPointer: UnsafePointer<T>)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to SearchBarProtocol.

    Declaration

    Swift

    @inlinable
    init(mutating raw: UnsafeRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to SearchBarProtocol.

    Declaration

    Swift

    @inlinable
    init(raw: UnsafeMutableRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to SearchBarProtocol.

    Declaration

    Swift

    @inlinable
    init(opaquePointer: OpaquePointer)
  • Creates a `GtkSearchBar`.
    

    You will need to tell it about which widget is going to be your text entry using [methodGtk.SearchBar.connect_entry].

    Declaration

    Swift

    @inlinable
    init()