/* Copyright (C) 2012 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
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/entry_p.h)
namespace Gtk
{
/** This is a subclass of Gtk::Entry that has
* been tailored for use as a search entry.
*
* It will show an inactive symbolic "find" icon when the
* search entry is empty, and a symbolic "clear" icon when
* there is text. Clicking on the "clear" icon will empty
* the search entry.
*
* Note that the search/clear icon is shown using a secondary
* icon, and thus does not work if you are using the secondary
* icon position for some other purpose.
*
* To make filtering appear more reactive, it is a good idea to
* not react to every change in the entry text immediately, but
* only after a short delay. To support this, Gtk::SearchEntry
* emits the signal_search_changed() signal which can
* be used instead of the Gtk::Editable::signal_changed() signal.
*
* The signal_previous_match(), signal_next_match()
* and signal_stop_search() signals can be uesd to implement
* moving between search results and ending the search.
*
* Often, Gtk::SearchEntry will be fed events by means of being
* placed inside a Gtk::SearchBar. If that is not the case,
* you can use handle_event() to pass events.
*
* @ingroup Widgets
* @newin{3,6}
*/
class GTKMM_API SearchEntry
: public Entry
{
_CLASS_GTKOBJECT(SearchEntry, GtkSearchEntry, GTK_SEARCH_ENTRY, Gtk::Entry, GtkEntry, , , GTKMM_API)
public:
_CTOR_DEFAULT
//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_entry_handle_event)
//TODO: Remove no_default_handler when we can break ABI:
_WRAP_SIGNAL(void search_changed(), "search-changed", no_default_handler)
// Although next-match, previous-match and stop-search are keybinding signals,
// applications shall connect to them.
_WRAP_SIGNAL(void next_match(), "next-match", no_default_handler)
_WRAP_SIGNAL(void previous_match(), "previous-match", no_default_handler)
_WRAP_SIGNAL(void stop_search(), "stop-search", no_default_handler)
// Gtk::SearchEntry has no properties nor vfuncs as of 3.16.
};
} /* namespace Gtk */