[gtkmm] Container: Add some methods.



commit a96a3f6e33c522d6827e3e474ee28bfe79d9f918
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Sep 25 22:47:21 2012 +0200

    Container: Add some methods.
    
            * gtk/src/container.[hg|ccg]: Add forall(), propagate_draw(),
    get_focus_child() and get_path_for_child(), none of which seem
    to be very new in GTK+.
    Also updated the foreach() documentation from the GTK+
    documentation.

 ChangeLog                 |   10 ++++++++++
 gtk/src/colorselection.hg |    3 +++
 gtk/src/container.ccg     |    6 ++++++
 gtk/src/container.hg      |   36 +++++++++++++++++++++++++++---------
 4 files changed, 46 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6bbb21c..bd67e6c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2012-09-25  Murray Cumming  <murrayc murrayc com>
 
+	Container: Add some methods.
+
+        * gtk/src/container.[hg|ccg]: Add forall(), propagate_draw(),
+	get_focus_child() and get_path_for_child(), none of which seem
+	to be very new in GTK+.
+	Also updated the foreach() documentation from the GTK+
+	documentation.
+
+2012-09-25  Murray Cumming  <murrayc murrayc com>
+
         ApplicationWindow: Add get_id() and documentation.
 
         * gtk/src/applicationwindow.hg: Wrap the new method and add 
diff --git a/gtk/src/colorselection.hg b/gtk/src/colorselection.hg
index c78443c..29af098 100644
--- a/gtk/src/colorselection.hg
+++ b/gtk/src/colorselection.hg
@@ -67,6 +67,8 @@ public:
   Gdk::Color get_previous_color() const;
   _WRAP_METHOD(guint16 get_previous_alpha() const, gtk_color_selection_get_previous_alpha)
 
+  _IGNORE(gtk_color_selection_get_previous_rgba, gtk_color_selection_get_current_rgba)
+
 
   Gdk::RGBA get_current_rgba() const;
   Gdk::RGBA get_previous_rgba() const;
@@ -90,6 +92,7 @@ public:
   _WRAP_PROPERTY("has-opacity-control", bool)
   _WRAP_PROPERTY("current-color", Gdk::Color)
   _WRAP_PROPERTY("current-alpha", guint)
+  //The whole class was deprecated before this was added: _WRAP_PROPERTY("current-rgba", Gdk::RGBA)
 };
 
 /** This dialog allows the user to select a color.
diff --git a/gtk/src/container.ccg b/gtk/src/container.ccg
index 4502861..1428d5f 100644
--- a/gtk/src/container.ccg
+++ b/gtk/src/container.ccg
@@ -166,6 +166,12 @@ void Container::foreach(const Container::ForeachSlot& slot)
   gtk_container_foreach(gobj(), &container_foreach_callback, &slot_copy);
 }
 
+void Container::forall(const Container::ForeachSlot& slot)
+{
+  ForeachSlot slot_copy (slot);
+  gtk_container_forall(gobj(), &container_foreach_callback, &slot_copy);
+}
+
 void  Container::add(Widget& widget)
 {
   gtk_container_add(gobj(), widget.gobj());
diff --git a/gtk/src/container.hg b/gtk/src/container.hg
index fb4b793..9d57a86 100644
--- a/gtk/src/container.hg
+++ b/gtk/src/container.hg
@@ -88,16 +88,30 @@ public:
    */
   typedef sigc::slot<void, Widget&> ForeachSlot;
 
-  /** Operate on contained items
-   * This is largely an internal used mainly for things like
-   * creating duplicates of internal lists and other such
-   * operations.  The result is lossy as it only gets the
-   * the main child and not its external pieces.
+  /** Operate on contained items.
    *
-   * For example notebook pages contain a page, a label, and
-   * a menu item.  But this only operates on the pages.
+   * Invokes the @a slot on each non-internal child of the container. See
+   * forall() for details on what constitutes an
+   * "internal" child.  Most applications should use foreach()
+   * rather than forall().
    */
   void foreach(const ForeachSlot& slot);
+  _IGNORE(gtk_container_foreach)
+
+
+  /** Operate on contained items, including internal children.
+   *
+   * Invokes the @ slot on each child of the container, including children
+   * that are considered "internal" (implementation details of the
+   * container). "Internal" children generally weren't added by the user
+   * of the container, but were added by the container implementation
+   * itself.  Most applications should use foreach(),
+   * rather than forall().
+   *
+   * @newin{3,6}
+   */
+  void forall(const ForeachSlot& slot);
+  _IGNORE(gtk_container_forall)
 
   /// (internal) Operate on contained items (see foreach())
   //_WRAP_METHOD(void foreach_(GtkCallback callback,gpointer data),gtk_container_foreach)
@@ -110,8 +124,7 @@ public:
 #m4 _CONVERSION(`GList*',`std::vector<const Widget*>',`Glib::ListHandler<const Widget*>::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)')
   _WRAP_METHOD(std::vector<const Widget*> get_children() const, gtk_container_get_children)
 
-  //TODO: See https://bugzilla.gnome.org/show_bug.cgi?id=630800
-  //_WRAP_METHOD(void propagate_expose(Widget& child, GdkEventExpose* event), gtk_container_propagate_expose)
+  _WRAP_METHOD(void propagate_draw(Widget& child, const ::Cairo::RefPtr< ::Cairo::Context>& cr), gtk_container_propagate_draw)
 
 #m4 _CONVERSION(`const std::vector<Widget*>&',`GList*',`Glib::ListHandler<Widget*>::vector_to_list($3).data ()')
   _WRAP_METHOD(void set_focus_chain(const std::vector<Widget*>& focusable_widgets),
@@ -136,6 +149,9 @@ public:
   /// Sets the focus on a child
   _WRAP_METHOD(void set_focus_child(Widget& widget),gtk_container_set_focus_child)
 
+  _WRAP_METHOD(Widget* get_focus_child(), gtk_container_get_focus_child)
+  _WRAP_METHOD(const Widget* get_focus_child() const, gtk_container_get_focus_child, constversion)
+
   _WRAP_METHOD(void set_focus_vadjustment(const Glib::RefPtr<Adjustment>& adjustment),
                gtk_container_set_focus_vadjustment)
 
@@ -157,6 +173,8 @@ public:
 
   _WRAP_METHOD(GType child_type() const, gtk_container_child_type)
 
+  _WRAP_METHOD(WidgetPath get_path_for_child(const Widget& child) const, gtk_container_get_path_for_child)
+
   // Ignore functions such as gtk_container_class_install_child_property(),  which I think are for themes, like the GtkWidget style properties.
   _IGNORE(gtk_container_class_install_child_property, gtk_container_class_find_child_property, gtk_container_class_list_child_properties,
           gtk_container_add_with_properties, gtk_container_child_set, gtk_container_child_get, gtk_container_child_get_valist, gtk_container_child_get_property)



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