[gtkmm] Added Gtk::MenuButton.



commit 9dc684a397b437d6cd02c306a9acfb2d5b4708df
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Jul 11 10:45:16 2012 +0200

    Added Gtk::MenuButton.
    
    * gtk/gtkmm.h:
    * gtk/src/filelist.am:
    * gtk/src/menubutton.[hg|ccg]: A new wrapper of GtkMenuButton.

 ChangeLog              |    8 +++++
 gtk/gtkmm.h            |    1 +
 gtk/src/filelist.am    |    1 +
 gtk/src/menubutton.ccg |   34 ++++++++++++++++++++
 gtk/src/menubutton.hg  |   80 ++++++++++++++++++++++++++++++++++++++++++++++++
 gtk/src/searchentry.hg |    2 -
 6 files changed, 124 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6b7963c..826b15b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2012-07-11  Murray Cumming  <murrayc murrayc com>
 
+	Added Gtk::MenuButton.
+
+	* gtk/gtkmm.h:
+	* gtk/src/filelist.am:
+	* gtk/src/menubutton.[hg|ccg]: A new wrapper of GtkMenuButton.
+
+2012-07-11  Murray Cumming  <murrayc murrayc com>
+
 	Regenerate some GTK+ defs and docs files.
 
 	* tools/extra_defs_gen/generate_defs_gtk.cc: Add 
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index 4a86ae4..3927f8a 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -180,6 +180,7 @@ extern const int gtkmm_micro_version;
 #include <gtkmm/main.h>
 #include <gtkmm/menu.h>
 #include <gtkmm/menubar.h>
+#include <gtkmm/menubutton.h>
 #include <gtkmm/menuitem.h>
 #include <gtkmm/menushell.h>
 #include <gtkmm/messagedialog.h>
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index 4a67c8e..690a0a9 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -103,6 +103,7 @@ gtkmm_files_any_hg =		\
 	main.hg			\
 	menu.hg			\
 	menubar.hg		\
+	menubutton.hg		\
 	menuitem.hg		\
 	menushell.hg		\
 	menutoolbutton.hg	\
diff --git a/gtk/src/menubutton.ccg b/gtk/src/menubutton.ccg
new file mode 100644
index 0000000..a74d64f
--- /dev/null
+++ b/gtk/src/menubutton.ccg
@@ -0,0 +1,34 @@
+/* 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <gtk/gtk.h>
+
+namespace Gtk
+{
+
+void MenuButton::unset_menu()
+{
+  gtk_menu_button_set_menu(gobj(), 0);
+}
+
+void MenuButton::unset_menu_model()
+{
+  gtk_menu_button_set_menu_model(gobj(), 0);
+}
+
+
+} //namespace Gtk
diff --git a/gtk/src/menubutton.hg b/gtk/src/menubutton.hg
new file mode 100644
index 0000000..4b2143f
--- /dev/null
+++ b/gtk/src/menubutton.hg
@@ -0,0 +1,80 @@
+/* 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <gtkmm/togglebutton.h>
+#include <gtkmm/menu.h>
+#include <giomm/menumodel.h>
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/togglebutton_p.h)
+
+namespace Gtk
+{
+
+/** A widget that shows a menu when clicked on.
+ *
+ * This menu can be provided either as a Gtk::Menu, or an abstract Gio::MenuModel.
+ *
+ * This widget can hold any valid child widget. That is, it can hold
+ * almost any other standard Gtk::Widget. The most commonly used child is the
+ * provided Gtk::Arrow.
+ *
+ * @ingroup Widgets
+ * @newin{3.6}
+ */
+class MenuButton : public ToggleButton
+{
+  _CLASS_GTKOBJECT(MenuButton, GtkMenuButton, GTK_MENU_BUTTON, Gtk::ToggleButton, GtkToggleButton)
+public:
+
+  _CTOR_DEFAULT
+
+ 
+  _WRAP_METHOD(void set_menu(Menu& menu), gtk_menu_button_set_menu)
+
+  /** Disables the button.
+   */
+  void unset_menu();
+
+  _WRAP_METHOD(Menu* get_menu(), gtk_menu_button_get_menu)
+  _WRAP_METHOD(const Menu* get_menu() const, gtk_menu_button_get_menu, constversion)
+
+  _WRAP_METHOD(void set_direction(ArrowType   direction), gtk_menu_button_set_direction)
+  _WRAP_METHOD(ArrowType get_direction() const, gtk_menu_button_get_direction)
+
+  _WRAP_METHOD(void set_menu_model(const Glib::RefPtr<const Gio::MenuModel>& menu_model), gtk_menu_button_set_menu_model)
+
+  /** Disables the button.
+   */
+  void unset_menu_model();
+
+  _WRAP_METHOD(Glib::RefPtr<Gio::MenuModel> get_menu_model(), gtk_menu_button_get_menu_model, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<const Gio::MenuModel> get_menu_model() const, gtk_menu_button_get_menu_model, refreturn, constversion)
+
+
+  _WRAP_METHOD(void set_align_widget(Widget& align_widget), gtk_menu_button_set_align_widget)
+  _WRAP_METHOD(Widget* get_align_widget(), gtk_menu_button_get_align_widget)
+  _WRAP_METHOD(const Widget* get_align_widget() const, gtk_menu_button_get_align_widget)
+
+  _WRAP_PROPERTY("menu", Menu*)
+  _WRAP_PROPERTY("menu-model", Glib::RefPtr<Gio::MenuModel>)
+  _WRAP_PROPERTY("align-widget", Widget*)
+  _WRAP_PROPERTY("direction", ArrowType)
+
+};
+
+} /* namespace Gtk */
+
diff --git a/gtk/src/searchentry.hg b/gtk/src/searchentry.hg
index b278434..4ae5a7d 100644
--- a/gtk/src/searchentry.hg
+++ b/gtk/src/searchentry.hg
@@ -23,8 +23,6 @@ _PINCLUDE(gtkmm/private/entry_p.h)
 namespace Gtk
 {
 
-_WRAP_ENUM(SearchEntryIconPosition, GtkSearchEntryIconPosition)
-
 /** This is a subclass of Gtk::Entry that has
  * been tailored for use as a search entry.
  *



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