[gtkmm] Wrap GtkSearchBar



commit 36a14b1aa7652a26cde1655f121154f601899cfb
Author: Juan Rafael Garcia Blanco <juanrgar gmail com>
Date:   Sat Sep 7 11:34:51 2013 +0200

    Wrap GtkSearchBar

 gtk/gtkmm.h                               |    1 +
 gtk/src/filelist.am                       |    1 +
 gtk/src/searchbar.ccg                     |   25 +++++++++
 gtk/src/searchbar.hg                      |   78 +++++++++++++++++++++++++++++
 tools/extra_defs_gen/generate_defs_gtk.cc |    1 +
 tools/m4/convert_gtk.m4                   |    1 +
 6 files changed, 107 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index df2ca6c..3aba3de 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -229,6 +229,7 @@ extern const int gtkmm_micro_version;
 #include <gtkmm/scalebutton.h>
 #include <gtkmm/scrollbar.h>
 #include <gtkmm/scrolledwindow.h>
+#include <gtkmm/searchbar.h>
 #include <gtkmm/searchentry.h>
 #include <gtkmm/separator.h>
 #include <gtkmm/separatormenuitem.h>
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index 32da356..f82a512 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -134,6 +134,7 @@ gtkmm_files_any_hg =                \
        scrollable.hg           \
        scrollbar.hg            \
        scrolledwindow.hg       \
+       searchbar.hg            \
        searchentry.hg          \
        selectiondata.hg        \
        separator.hg            \
diff --git a/gtk/src/searchbar.ccg b/gtk/src/searchbar.ccg
new file mode 100644
index 0000000..0b15ffe
--- /dev/null
+++ b/gtk/src/searchbar.ccg
@@ -0,0 +1,25 @@
+/*
+ * Copyright 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <gtk/gtk.h>
+
+
+namespace Gtk
+{
+} // namespace Gtk
+
diff --git a/gtk/src/searchbar.hg b/gtk/src/searchbar.hg
new file mode 100644
index 0000000..4038d15
--- /dev/null
+++ b/gtk/src/searchbar.hg
@@ -0,0 +1,78 @@
+/*
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <gtkmm/bin.h>
+#include <gtkmm/entry.h>
+_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 SearchBar
+  : public Bin
+{
+  _CLASS_GTKOBJECT(SearchBar, GtkSearchBar, GTK_SEARCH_BAR, Gtk::Bin, GtkBin)
+public:
+
+  /** Creates a Gtk::SearchBar.
+   *
+   * You will need to tell it about which widget is going to be your 
+   * text entry using Gtk::SearchBar::set_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)
+
+  _WRAP_METHOD(bool handle_event(GdkEvent* 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
diff --git a/tools/extra_defs_gen/generate_defs_gtk.cc b/tools/extra_defs_gen/generate_defs_gtk.cc
index 2577070..d9d1549 100644
--- a/tools/extra_defs_gen/generate_defs_gtk.cc
+++ b/tools/extra_defs_gen/generate_defs_gtk.cc
@@ -174,6 +174,7 @@ int main(int argc, char** argv)
             << get_defs( GTK_TYPE_SCROLLABLE )
             << get_defs( GTK_TYPE_SCROLLBAR )
             << get_defs( GTK_TYPE_SCROLLED_WINDOW )
+            << get_defs( GTK_TYPE_SEARCH_BAR )
             << get_defs( GTK_TYPE_SEARCH_ENTRY )
             << get_defs( GTK_TYPE_SEPARATOR )
             << get_defs( GTK_TYPE_SEPARATOR_TOOL_ITEM )
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index a21e3f6..b87b33e 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -324,6 +324,7 @@ _CONVERSION(`const CellRenderer&',`GtkCellRenderer*',__FCR2P)
 _CONVERSION(`ToolItem&',`GtkToolItem*',__FR2P)
 _CONVERSION(`const ToolItem&',`GtkToolItem*',__FCR2P)
 _CONVERSION(`ToolItemGroup&',`GtkToolItemGroup*',__FR2P)
+_CONVERSION(`Gtk::Entry&',`GtkEntry*',__FR2P)
 
 # Glib::ListHandle<> (gtkmm) -> GList (gtk+)
 _CONVERSION(`const Glib::ListHandle<Glib::ustring>&',`GList*',`$3.data()')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]