A Hildon::FindToolbar
is a special toolbar that offers a search feature. Maemo applications may have several toolbars, which are then attached above each other. The find toolbar is generally placed on the top of the main toolbar, as in the example below.
The Hildon::FindToolbar
has two interesting signals:
signal_seach: This signal is emitted, when the user enters some search term and hits the search button.
signal_close: This signal is emitted, when the user presses the close button.
To integrate the Hildon::FindToolbar
in your application, you must add a button to your
main toolbar which is used to show the toolbar, like this:
// ... Gtk::ToolButton* tool_find = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::FIND)); main_toolbar.append(tool_find); tool_find->show(); tool_find->signal_clicked().connect( sigc::mem_fun(*this, &ExampleWindow::on_find_close) ); // ... void ExampleWindow::on_find_close() { // Show or hide find toolbar if (m_find_visible) { m_find_toolbar.hide(); m_find_visible = false; } else { m_find_toolbar.show_all(); m_find_visible = true; } }
Then you must connect a signal handler for the search
signal to actually perform the search:
find_toolbar.signal_search().connect( sigc::mem_fun(*this, &ExampleWindow::on_search) ); // ... void ExampleWindow::on_search() { Glib::ustring prefix; find_toolbar.get_property("prefix", prefix); // Search for prefix now... }