[gtkmm] Gtk::Popover: wrap new constructor and public method



commit 7f5ff9390eadf6997409b2b87e7a1de466e6af14
Author: Juan R. GarcĂ­a Blanco <juanrgar gmail com>
Date:   Mon Feb 17 00:31:49 2014 +0100

    Gtk::Popover: wrap new constructor and public method
    
        * Wrap gtk_popover_bind_model() object method.
        * Wrap gtk_popover_new_from_model() constructor.

 gtk/src/popover.ccg |   15 +++++++++++++++
 gtk/src/popover.hg  |   45 ++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 59 insertions(+), 1 deletions(-)
---
diff --git a/gtk/src/popover.ccg b/gtk/src/popover.ccg
index 0b15ffe..0f2cacd 100644
--- a/gtk/src/popover.ccg
+++ b/gtk/src/popover.ccg
@@ -21,5 +21,20 @@
 
 namespace Gtk
 {
+
+Popover::Popover(const Widget& relative_to, const Glib::RefPtr<Gio::MenuModel>& model)
+:
+  _CONSTRUCT("relative_to", relative_to.gobj())
+{
+  bind_model(model);
+}
+
+Popover::Popover(const Glib::RefPtr<Gio::MenuModel>& model)
+:
+  _CONSTRUCT("relative_to", 0)
+{
+  bind_model(model);
+}
+
 } // namespace Gtk
 
diff --git a/gtk/src/popover.hg b/gtk/src/popover.hg
index db797ed..918afbf 100644
--- a/gtk/src/popover.hg
+++ b/gtk/src/popover.hg
@@ -17,6 +17,7 @@
  */
 
 #include <gtkmm/bin.h>
+#include <giomm/menumodel.h>
 
 _DEFS(gtkmm,gtk)
 _PINCLUDE(gtkmm/private/bin_p.h)
@@ -56,7 +57,47 @@ public:
    *
    * @param relative_to The Gtk::Widget the popover is related to
    */
-  _WRAP_CTOR(Popover(const Widget& relative_to), gtk_popover_new)
+  _WRAP_CTOR(Popover(const Widget& relative_to{?}), gtk_popover_new)
+
+  //This is custom-implemented because the gtk_popover_new_from_model() does more
+  //than just call g_object_new. MenuBar and Menu have both them same issue.
+  //See https://bugzilla.gnome.org/show_bug.cgi?id=704671
+  /** Creates a Popover and populates it according to
+   * @a model. The popover is pointed to the @a relative_to widget.
+   *
+   * The created buttons are connected to actions found in the
+   * ApplicationWindow to which the popover belongs - typically
+   * by means of being attached to a widget that is contained within
+   * the ApplicationWindow widget hierarchy.
+   *
+   * Actions can also be added using Widget::insert_action_group()
+   * on the menu's attached widget or on any of its parent widgets.
+   *
+   * @param relative_to: Widget the popover is related to
+   * @param model: a Gio::MenuModel
+   *
+   * @newin{3,12}
+   */
+  explicit Popover(const Widget& relative_to, const Glib::RefPtr<Gio::MenuModel>& model);
+
+  /** Creates a Popover and populates it according to
+   * @a model.
+   *
+   * The created buttons are connected to actions found in the
+   * ApplicationWindow to which the popover belongs - typically
+   * by means of being attached to a widget that is contained within
+   * the ApplicationWindow widget hierarchy.
+   *
+   * Actions can also be added using Widget::insert_action_group()
+   * on the menu's attached widget or on any of its parent widgets.
+   *
+   * @param model: a Gio::MenuModel
+   *
+   * @newin{3,12}
+   */
+  explicit Popover(const Glib::RefPtr<Gio::MenuModel>& model);
+
+  _IGNORE(gtk_popover_new_from_model)
 
 
   _WRAP_METHOD(void set_relative_to(const Widget& relative_to), gtk_popover_set_relative_to)
@@ -76,6 +117,8 @@ public:
   _WRAP_METHOD(void set_modal(bool modal = true), gtk_popover_set_modal)
   _WRAP_METHOD(bool get_modal() const, gtk_popover_get_modal)
 
+  _WRAP_METHOD(void bind_model(const Glib::RefPtr<Gio::MenuModel>& model, const Glib::ustring& 
action_namespace{?}), gtk_popover_bind_model)
+
 
   _WRAP_PROPERTY("relative-to", Widget*)
 // TODO


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