[gtkmm] Gtk: Adapt Box, Container, Label to changes in gtk+



commit 916c1596268cac9256c8162313e725476ad47754
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Thu Apr 27 11:05:21 2017 +0200

    Gtk: Adapt Box, Container, Label to changes in gtk+
    
    * gtk/src/bin.ccg: add_pixlabel(): Fix call to Box::pack_start().
    * gtk/src/box.[ccg|hg]: Remove enum PackOptions and pack_start/end() overloads
    that take a PackOptions parameter. Remove the "expand" and "fill" parameters
    in the other pack_start() and pack_end(). Remove set/get_center_widget().
    Remove property_expand() and property_fill().
    * gtk/src/container.[ccg|hg]: forall_vfunc(): Remove the "include_internal"
    parameter.
    * gtk/src/label.hg: Remove set/get_angle() and property_angle().

 gtk/src/bin.ccg       |    3 ++-
 gtk/src/box.ccg       |   24 ------------------------
 gtk/src/box.hg        |   47 +++--------------------------------------------
 gtk/src/container.ccg |    8 ++++----
 gtk/src/container.hg  |   13 ++++++-------
 gtk/src/label.hg      |    3 ---
 6 files changed, 15 insertions(+), 83 deletions(-)
---
diff --git a/gtk/src/bin.ccg b/gtk/src/bin.ccg
index 023c301..913d4ad 100644
--- a/gtk/src/bin.ccg
+++ b/gtk/src/bin.ccg
@@ -50,10 +50,11 @@ Bin::add_pixlabel(const std::string& pixfile,
   //Create Image and Label widgets:
   auto pmap = manage(new Image(pixfile));
   auto label = manage(new Label(str, x_align, y_align));
+  label->set_hexpand(true);
 
   //Put them in a Box:
   auto hbox = manage(new Box(Orientation::HORIZONTAL, 5));
-  hbox->pack_start(*pmap, PACK_SHRINK);
+  hbox->pack_start(*pmap);
   hbox->pack_start(*label);
 
   //And put that Box in this:
diff --git a/gtk/src/box.ccg b/gtk/src/box.ccg
index 4c78ba4..ea8ab9e 100644
--- a/gtk/src/box.ccg
+++ b/gtk/src/box.ccg
@@ -17,31 +17,7 @@
  */
 
 #include <gtk/gtk.h>
-#include <glibmm/wrap.h>
-
 
 namespace Gtk
 {
-
-void Box::pack_start(Widget& child, PackOptions options)
-{
-  bool expand = (options == PACK_EXPAND_PADDING) || (options == PACK_EXPAND_WIDGET);
-  bool fill = (options == PACK_EXPAND_WIDGET);
-
-  gtk_box_pack_start(gobj(), child.gobj(), (gboolean)expand, (gboolean)fill);
-}
-
-void Box::pack_end(Widget& child, PackOptions options)
-{
-  bool expand = (options == PACK_EXPAND_PADDING) || (options == PACK_EXPAND_WIDGET);
-  bool fill = (options == PACK_EXPAND_WIDGET);
-
-  gtk_box_pack_end(gobj(), child.gobj(), (gboolean)expand, (gboolean)fill);
-}
-
-void Box::unset_center_widget()
-{
-  gtk_box_set_center_widget(gobj(), nullptr);
-}
-
 } //namespace Gtk
diff --git a/gtk/src/box.hg b/gtk/src/box.hg
index e64e488..aebdc45 100644
--- a/gtk/src/box.hg
+++ b/gtk/src/box.hg
@@ -20,22 +20,10 @@ _PINCLUDE(gtkmm/private/container_p.h)
 
 #include <gtkmm/container.h>
 #include <gtkmm/orientable.h>
-#include <gtk/gtk.h>  /* For _GtkBoxChild */
-
 
 namespace Gtk
 {
 
-/** Packing options for adding child widgets to a Box with pack_start() and pack_end().
- * @ingroup gtkmmEnums
- */
-enum PackOptions
-{
-  PACK_SHRINK, /**< Space is contracted to the child widget size. */
-  PACK_EXPAND_PADDING, /**< Space is expanded, with extra space filled with padding. */
-  PACK_EXPAND_WIDGET /**< Space is expanded, with extra space filled by increasing the child widget size. */
-};
-
 /** The Box widget organizes child widgets into a rectangular area.
  *
  * The rectangular area of a Box is organized into either a single row
@@ -63,16 +51,10 @@ enum PackOptions
  *
  * Use set_spacing() to determine the minimum
  * space placed between all children in the Gtk::Box.  Note that
- * spacing is added between the children, while
- * padding added by gtk_box_pack_start() or gtk_box_pack_end() is added
- * on either side of the widget it belongs to.
+ * spacing is added between the children.
  *
  * Use reorder_child() to
  * move a child widget to a different place in the box.
- *
- * Use
- * set_child_packing() to reset the pack options and padding attributes of any
- * Gtk::Box child. Use query_child_packing() to query these fields.
  */
 class Box
   : public Container,
@@ -90,21 +72,9 @@ public:
    */
   _WRAP_CTOR(Box(Orientation orientation = Orientation::HORIZONTAL, int spacing = 0), gtk_box_new)
 
-  _WRAP_METHOD(void pack_start(Widget& child, bool expand, bool fill), gtk_box_pack_start)
+  _WRAP_METHOD(void pack_start(Widget& child), gtk_box_pack_start)
 
-  /** Left side insert a widget to a box.
-   * @param child A Widget to be added to box.
-   * @param options Controls how the widget expands to fill space, and how the space around them is used.
-   */
-  void pack_start(Widget& child, PackOptions options = PACK_EXPAND_WIDGET);
-
-  _WRAP_METHOD(void pack_end(Widget& child, bool expand, bool fill), gtk_box_pack_end)
-
-  /** Right side insert a widget to a box.
-   * @param child A Widget to be added to box.
-   * @param options Controls how the widget expands to fill space, and how the space around them is used.
-   */
-  void pack_end(Widget& child, PackOptions options = PACK_EXPAND_WIDGET);
+  _WRAP_METHOD(void pack_end(Widget& child), gtk_box_pack_end)
 
   _WRAP_METHOD(void set_homogeneous(bool homogeneous = true), gtk_box_set_homogeneous)
   _WRAP_METHOD(bool get_homogeneous() const, gtk_box_get_homogeneous)
@@ -117,21 +87,10 @@ public:
 
   _WRAP_METHOD(void reorder_child(Widget& child, int position), gtk_box_reorder_child)
 
-  _WRAP_METHOD(void set_center_widget(Widget& widget), gtk_box_set_center_widget)
-
-  /** Unset the center_widget.
-   * See set_center_widget().
-   */
-  void unset_center_widget();
-  _WRAP_METHOD(Widget* get_center_widget(), gtk_box_get_center_widget) //transfer none
-  _WRAP_METHOD(const Widget* get_center_widget() const, gtk_box_get_center_widget, constversion) //transfer 
none
-
   _WRAP_PROPERTY("spacing", int)
   _WRAP_PROPERTY("homogeneous", bool)
   _WRAP_PROPERTY("baseline-position", BaselinePosition)
 
-  _WRAP_CHILD_PROPERTY("expand", bool)
-  _WRAP_CHILD_PROPERTY("fill", bool)
   _WRAP_CHILD_PROPERTY("pack-type", PackType)
   _WRAP_CHILD_PROPERTY("position", int)
 };
diff --git a/gtk/src/container.ccg b/gtk/src/container.ccg
index 1d525c7..b3ea4fe 100644
--- a/gtk/src/container.ccg
+++ b/gtk/src/container.ccg
@@ -169,7 +169,7 @@ void Container_Class::remove_callback(GtkContainer* self, GtkWidget* p0)
 
 // Custom hand-coded callback:
 void Container_Class::forall_vfunc_callback(GtkContainer* self,
-  gboolean include_internals, GtkCallback callback, gpointer callback_data)
+  GtkCallback callback, gpointer callback_data)
 {
   const auto obj_base = static_cast<Glib::ObjectBase*>(
       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
@@ -194,7 +194,7 @@ void Container_Class::forall_vfunc_callback(GtkContainer* self,
           const auto slot = static_cast<Container::ForeachSlot*>(callback_data);
 
           // Call the virtual member method, which derived classes might override.
-          obj->forall_vfunc(include_internals, *slot);
+          obj->forall_vfunc(*slot);
         }
         else
         {
@@ -203,7 +203,7 @@ void Container_Class::forall_vfunc_callback(GtkContainer* self,
                                         { callback(widget.gobj(), callback_data); };
 
           // Call the virtual member method, which derived classes might override.
-          obj->forall_vfunc(include_internals, slot);
+          obj->forall_vfunc(slot);
         }
         return;
       }
@@ -220,7 +220,7 @@ void Container_Class::forall_vfunc_callback(GtkContainer* self,
 
   // Call the original underlying C function:
   if(base && base->forall)
-    (*base->forall)(self, include_internals, callback, callback_data);
+    (*base->forall)(self, callback, callback_data);
 }
 
 void Container::foreach(const Container::ForeachSlot& slot)
diff --git a/gtk/src/container.hg b/gtk/src/container.hg
index bc6a251..f13eaac 100644
--- a/gtk/src/container.hg
+++ b/gtk/src/container.hg
@@ -171,19 +171,18 @@ protected:
    */
   _WRAP_VFUNC(GType child_type() const, child_type)
 
-  /** Invokes a callback on all children of the container.
+  /** Invokes a callback on all non-internal children of the container.
    *
-   * The callback may optionally be invoked also on 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.
+   * "Internal" children generally weren't added by the user of the container,
+   * but were added by the container implementation itself.
    *
+   * %forall_vfunc() resembles foreach(): They don't invokes the callback for
+   * internal children. forall() invokes it for all kinds of children.
    * Most applications should use foreach(), rather than forall().
    *
-   * @param include_internals
    * @param slot A slot to call for each child.
    */
-  _WRAP_VFUNC(void forall(bool include_internals, const ForeachSlot& slot{callback}), forall,
+  _WRAP_VFUNC(void forall(const ForeachSlot& slot{callback}), forall,
     custom_vfunc_callback, slot_name slot, slot_callback container_foreach_callback, no_slot_copy)
 
   /** Sets a child property for this container and its child.
diff --git a/gtk/src/label.hg b/gtk/src/label.hg
index d93391c..8ba4360 100644
--- a/gtk/src/label.hg
+++ b/gtk/src/label.hg
@@ -102,8 +102,6 @@ public:
   _WRAP_METHOD(Pango::WrapMode get_line_wrap_mode() const, gtk_label_get_line_wrap_mode)
   _WRAP_METHOD(void set_selectable(bool setting = true), gtk_label_set_selectable)
   _WRAP_METHOD(bool get_selectable() const, gtk_label_get_selectable)
-  _WRAP_METHOD(void set_angle(double angle), gtk_label_set_angle)
-  _WRAP_METHOD(double get_angle() const, gtk_label_get_angle)
   _WRAP_METHOD(void select_region(int start_offset, int end_offset), gtk_label_select_region)
 
   /** Selects a range of characters in the label, from @a start_offset to the end,
@@ -160,7 +158,6 @@ public:
   _WRAP_PROPERTY("ellipsize", Pango::EllipsizeMode)
   _WRAP_PROPERTY("width-chars", int)
   _WRAP_PROPERTY("single-line-mode", bool)
-  _WRAP_PROPERTY("angle", double)
   _WRAP_PROPERTY("max_width_chars", int)
   _WRAP_PROPERTY("track-visited-links", bool)
   _WRAP_PROPERTY("lines", int)


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