SearchBar

GtkSearchBar 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 gtk_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 gtk_search_bar_connect_entry(). The following example shows you how to create a more complex search entry.

Constructors

this
this(GtkSearchBar* gtkSearchBar)

Sets our main struct and passes it to the parent class

this
this()

Creates a GtkSearchBar. You will need to tell it about which widget is going to be your text entry using gtk_search_bar_set_entry().

Members

Functions

connectEntry
void connectEntry(Entry entry)

Connects the GtkEntry widget passed as the one to be used in this search bar. The entry should be a descendant of the search bar. This is only required if the entry isn't the direct child of the search bar (as in our main example).

getSearchBarStruct
GtkSearchBar* getSearchBarStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getSearchMode
int getSearchMode()

Returns whether the search mode is on or off.

getShowCloseButton
int getShowCloseButton()

Returns whether the close button is shown.

getStruct
void* getStruct()

the main Gtk struct as a void*

handleEvent
int handleEvent(Event event)

This function should be called when the top-level window which contains the search bar received a key event. If the key event is handled by the search bar, the bar will be shown, the entry populated with the entered text and GDK_EVENT_STOP will be returned. The caller should ensure that events are not propagated further. If no entry has been connected to the search bar, using gtk_search_bar_connect_entry(), this function will return immediately with a warning.

setSearchMode
void setSearchMode(int searchMode)

Switches the search mode on or off.

setShowCloseButton
void setShowCloseButton(int visible)

Shows or hides the close button. Applications that already have a "search" toggle button should not show a close button in their search bar, as it duplicates the role of the toggle button.

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

gtkSearchBar
GtkSearchBar* gtkSearchBar;

the main Gtk struct

Inherited Members

From Bin

gtkBin
GtkBin* gtkBin;

the main Gtk struct

getBinStruct
GtkBin* getBinStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
getChild
Widget getChild()

Gets the child of the GtkBin, or NULL if the bin contains no child widget. The returned widget does not have a reference added, so you do not need to unref it.

Meta