Debian Codegraph @

gtk/src/searchbar.hg

raw
1 /* Copyright (C) 2013 The gtkmm Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
15 */
16
17 #include <gtkmm/bin.h>
18 #include <gtkmm/entry.h>
19 _DEFS(gtkmm,gtk)
20 _PINCLUDE(gtkmm/private/bin_p.h)
21
22 namespace Gtk
23 {
24
25 /** A toolbar to integrate a search entry with.
26 *
27 * Gtk::SearchBar is a container made to have a search entry (possibly
28 * with additional connex widgets, such as drop-down menus, or buttons)
29 * built-in. The search bar would appear when a search is started through
30 * typing on the keyboard, or the application's search mode is toggled on.
31 *
32 * For keyboard presses to start a search, events will need to be
33 * forwarded from the top-level window that contains the search bar.
34 * See Gtk::SearchBar::handle_event() for example code. Common shortcuts
35 * such as Ctrl+F should be handled as an application action, or through
36 * the menu items.
37 *
38 * You will also need to tell the search bar about which entry you
39 * are using as your search entry using Gtk::SearchBar::connect_entry().
40 *
41 * @ingroup Widgets
42 * @newin{3,10}
43 */
44 class GTKMM_API SearchBar
45 : public Bin
46 {
47 _CLASS_GTKOBJECT(SearchBar, GtkSearchBar, GTK_SEARCH_BAR, Gtk::Bin, GtkBin, , , GTKMM_API)
48 public:
49
50 /** Creates a Gtk::SearchBar.
51 *
52 * You will need to tell it about which widget is going to be your
53 * text entry using Gtk::SearchBar::connect_entry().
54 */
55 _CTOR_DEFAULT
56
57
58 _WRAP_METHOD(void connect_entry(Gtk::Entry& entry), gtk_search_bar_connect_entry)
59
60 _WRAP_METHOD(bool get_search_mode() const, gtk_search_bar_get_search_mode)
61 _WRAP_METHOD(void set_search_mode(bool search_mode=true), gtk_search_bar_set_search_mode)
62
63 _WRAP_METHOD(bool get_show_close_button() const, gtk_search_bar_get_show_close_button)
64 _WRAP_METHOD(void set_show_close_button(bool visible=true), gtk_search_bar_set_show_close_button)
65
66 //TODO: Use Gdk::EventKey, if we ever use Gdk::Event elsewhere in the API:
67 //We use GdkEventKey* rather than GdkEvent*. See GTK+ bug https://bugzilla.gnome.org/show_bug.cgi?id=709544
68 #m4 _CONVERSION(`GdkEventKey*',`GdkEvent*',`(($2)($3))')
69 _WRAP_METHOD(bool handle_event(GdkEventKey* gdk_event), gtk_search_bar_handle_event)
70
71 _WRAP_PROPERTY("search-mode-enabled", bool)
72 _WRAP_PROPERTY("show-close-button", bool)
73
74 // Gtk::SearchBar has no signals nor vfuncs as of 3.10.
75 };
76
77 } // namespace Gtk