/* Copyright (C) 2013 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see .
*/
#include
#include
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/bin_p.h)
namespace Gtk
{
/** A toolbar to integrate a search entry with.
*
* Gtk::SearchBar 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::SearchBar::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::SearchBar::connect_entry().
*
* @ingroup Widgets
* @newin{3,10}
*/
class GTKMM_API SearchBar
: public Bin
{
_CLASS_GTKOBJECT(SearchBar, GtkSearchBar, GTK_SEARCH_BAR, Gtk::Bin, GtkBin, , , GTKMM_API)
public:
/** Creates a Gtk::SearchBar.
*
* You will need to tell it about which widget is going to be your
* text entry using Gtk::SearchBar::connect_entry().
*/
_CTOR_DEFAULT
_WRAP_METHOD(void connect_entry(Gtk::Entry& entry), gtk_search_bar_connect_entry)
_WRAP_METHOD(bool get_search_mode() const, gtk_search_bar_get_search_mode)
_WRAP_METHOD(void set_search_mode(bool search_mode=true), gtk_search_bar_set_search_mode)
_WRAP_METHOD(bool get_show_close_button() const, gtk_search_bar_get_show_close_button)
_WRAP_METHOD(void set_show_close_button(bool visible=true), gtk_search_bar_set_show_close_button)
//TODO: Use Gdk::EventKey, if we ever use Gdk::Event elsewhere in the API:
//We use GdkEventKey* rather than GdkEvent*. See GTK+ bug https://bugzilla.gnome.org/show_bug.cgi?id=709544
#m4 _CONVERSION(`GdkEventKey*',`GdkEvent*',`(($2)($3))')
_WRAP_METHOD(bool handle_event(GdkEventKey* gdk_event), gtk_search_bar_handle_event)
_WRAP_PROPERTY("search-mode-enabled", bool)
_WRAP_PROPERTY("show-close-button", bool)
// Gtk::SearchBar has no signals nor vfuncs as of 3.10.
};
} // namespace Gtk