Class: Gtk::SearchBar
- Inherits:
-
Object
- Object
- Gtk::SearchBar
- Defined in:
- (unknown)
Instance Method Summary collapse
-
#connect_entry(entry) ⇒ nil
Connects the Gtk::Entry widget passed as the one to be used in this search bar.
-
#handle_event(event) ⇒ TrueClass
This function should be called when the top-level window which contains the search bar received a key event.
-
#new ⇒ Gtk::Widget
Creates a Gtk::SearchBar.
-
#search_mode ⇒ TrueClass
Returns whether the search mode is on or off.
-
#search_mode=(search_mode) ⇒ nil
Switches the search mode on or off.
- #search_mode_enabled=(search_mode_enabled) ⇒ TrueClass
-
#search_mode_enabled? ⇒ TrueClass
Search-mode-enabled.
-
#show_close_button ⇒ TrueClass
Returns whether the close button is shown.
- #show_close_button=(show_close_button) ⇒ TrueClass
-
#show_close_button? ⇒ TrueClass
Show-close-button.
Instance Method Details
#connect_entry(entry) ⇒ nil
Connects the Gtk::Entry 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).
#handle_event(event) ⇒ TrueClass
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.
## Showing the search bar on key presses
static gboolean
on_key_press_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
GtkSearchBar *bar = GTK_SEARCH_BAR (user_data);
return gtk_search_bar_handle_event (bar, event);
}
static void
create_toplevel (void)
{
GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
GtkWindow *search_bar = gtk_search_bar_new ();
// Add more widgets to the window...
g_signal_connect (window,
"key-press-event",
G_CALLBACK (on_key_press_event),
search_bar);
}
#new ⇒ Gtk::Widget
Creates a Gtk::SearchBar. You will need to tell it about which widget is going to be your text entry using gtk_search_bar_connect_entry().
#search_mode ⇒ TrueClass
Returns whether the search mode is on or off.
#search_mode=(search_mode) ⇒ nil
Switches the search mode on or off.
#search_mode_enabled=(search_mode_enabled) ⇒ TrueClass
#search_mode_enabled? ⇒ TrueClass
Returns search-mode-enabled.
#show_close_button ⇒ TrueClass
Returns whether the close button is shown.
#show_close_button=(show_close_button) ⇒ TrueClass
#show_close_button? ⇒ TrueClass
Returns show-close-button.