/* 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 <https://www.gnu.org/licenses/>.
 */

#include <gtkmm/widget.h>
#include <gtkmm/editable.h>
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/widget_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, the search bar must be told
 * of a widget to capture key events from through
 * set_key_capture_widget(). This widget will typically
 * be the top-level window, or a parent container of the search bar. 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 connect_entry().
 *
 * @ingroup Widgets
 * @newin{3,10}
 */
class GTKMM_API SearchBar
  : public Widget
{
  _CLASS_GTKOBJECT(SearchBar, GtkSearchBar, GTK_SEARCH_BAR, Gtk::Widget, GtkWidget, , , 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(Editable& 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)

  _WRAP_METHOD(void set_key_capture_widget(Widget& widget), gtk_search_bar_set_key_capture_widget)
  _WRAP_METHOD(Widget* get_key_capture_widget(), gtk_search_bar_get_key_capture_widget)
  _WRAP_METHOD(const Widget* get_key_capture_widget() const, gtk_search_bar_get_key_capture_widget, constversion)
  void unset_key_capture_widget();

  _WRAP_METHOD(void set_child(Widget& child), gtk_search_bar_set_child)
  void unset_child();
  _WRAP_METHOD(Widget* get_child(), gtk_search_bar_get_child)
  _WRAP_METHOD(const Widget* get_child() const, gtk_search_bar_get_child, constversion)

  _WRAP_PROPERTY("search-mode-enabled", bool)
  _WRAP_PROPERTY("show-close-button", bool)
  _WRAP_PROPERTY("child", Widget*)
  _WRAP_PROPERTY("key-capture-widget", Widget*)

  // Gtk::SearchBar has no signals nor vfuncs as of 3.10.
};

} // namespace Gtk
