Handy.SearchBar
Description: Reference for Handy.SearchBar

### Class

# HandySearchBar

#### Description [src]

    class Handy.SearchBar : Gtk.Bin {
      parent_instance: GtkBin
    }

A toolbar to integrate a search entry with.

`HdySearchBar` is a container made to have a search entry (possibly with additional connex widgets, such as drop-down menus, or buttons) built-in. 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, events will need to be forwarded from the top-level window that contains the search bar. See `hdy_search_bar_handle_event()` for example code. 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 `hdy_search_bar_connect_entry()`. The following example shows you how to create a more complex search entry.

`HdySearchBar` is very similar to `GtkSearchBar`, the main difference being that it allows the search entry to fill all the available space. This allows you to control your search entry’s width with a `HdyClamp`.

## CSS nodes

`HdySearchBar` has a single CSS node with name `searchbar`.

Available since: | 1.0

#### Ancestors

- GtkBin
- GtkContainer
- GtkWidget
- GInitiallyUnowned
- GObject

#### Implements

- AtkImplementorIface
- GtkBuildable

#### Constructors

###### hdy_search_bar_new

Creates a new `HdySearchBar.

Available since: 1.0

#### Instance methods

###### hdy_search_bar_connect_entry

Sets the entry widget passed as the one to be used in this search bar.

Available since: 1.0

###### hdy_search_bar_get_search_mode

Gets whether the search mode is on.

Available since: 1.0

###### hdy_search_bar_get_show_close_button

Gets whether the close button is shown.

Available since: 1.0

###### hdy_search_bar_handle_event

Handles key press events.

Available since: 1.0

###### hdy_search_bar_set_search_mode

Switches the search mode on or off.

Available since: 1.0

###### hdy_search_bar_set_show_close_button

Shows or hides the close button.

Available since: 1.0

#### Properties

###### Handy.SearchBar:search-mode-enabled

Whether the search mode is on and the search bar shown.

Available since: 1.0

###### Handy.SearchBar:show-close-button

Whether to show the close button in the toolbar.

Available since: 1.0

#### Class structure

    struct HandySearchBarClass {
      GtkBinClass parent_class;

    }

###### Class members

`parent_class` |
    GtkBinClass
| No description available.