On Fri, 2017-04-28 at 13:25 +0200, Kjell Ahlstedt wrote:
> On 2017-04-28 09:08, Murray Cumming wrote:
> > On Fri, 2017-04-28 at 08:31 +0200, Kjell Ahlstedt wrote:
> > >  Why does Gtk::PackOptions affect only horizontal expansion and
> > > alignment? Look for instance at one of the 3  TreeView demo
> > > programs.
> > > The ScrolledWindow is expanded horizontally but not vertically.
> > > Before the expand and fill parameters were removed from
> > > gtk_box_pack_start() the ScrolledWindow was expanded in both
> > > directions.
> > 
> > Maybe our pack_start/end() implementation should set hexpand/halign
> > or
> > vexpand/valign depending on the orientation, or always set both.
> > 
>  I vote for always setting both, if we will keep Gtk::PackOptions.

This fixes that problem with the ScrolledWindow:
https://git.gnome.org/browse/gtkmm/commit/?id=ece3794336e7216c4d25484be
432d5d142ebab1b

but it causes the left-hand treeview (list of examples) in the demo to
not expand vertically, and the "Add item" and "Remove item" buttons in
the "Editable Cells" example now appear to the left instead of filling
up the whole horizontal space.

With the attached patch, things seem better, but then those buttons
expand vertically too.

I guess we need to find out exactly what
halign/hexpand/valign/vexpand/whatever values are really meant to
provide the same behaviour as the previous pack_start(child, expand,
fill):
https://developer.gnome.org/gtk3/stable/GtkBox.html#gtk-box-pack-start

It doesn't look like our old pack_start(child, SHRINK) is the same as
the new gtk_box_pack_start(child).

-- 
Murray Cumming
murr...@murrayc.com
www.murrayc.com
From 278b3116ded62f111cb5858239696e95547dcfe4 Mon Sep 17 00:00:00 2001
From: Murray Cumming <murr...@murrayc.com>
Date: Fri, 28 Apr 2017 14:15:25 +0200
Subject: [PATCH] Box::pack_start/pack_end(options): Avoid setting child
 properties when possible.

PackOptions::SHRINK seems to correspond with the default behaviour of
the new gtk_box_pack_start()/pack_end(), so in this case it seems wise
to avoid the complication of setting the child properties unnecessarily.
---
 gtk/src/box.ccg | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gtk/src/box.ccg b/gtk/src/box.ccg
index 218ca437..94a1abc8 100644
--- a/gtk/src/box.ccg
+++ b/gtk/src/box.ccg
@@ -25,6 +25,10 @@ namespace Gtk
 
 void Box::pack_start(Widget& child, PackOptions options)
 {
+  if (options == PackOptions::SHRINK) {
+    return pack_start();
+  }
+
   const bool expand = (options == PackOptions::EXPAND_PADDING) || (options == PackOptions::EXPAND_WIDGET);
   const bool fill = (options == PackOptions::EXPAND_WIDGET);
 
@@ -38,6 +42,10 @@ void Box::pack_start(Widget& child, PackOptions options)
 
 void Box::pack_end(Widget& child, PackOptions options)
 {
+  if (options == PackOptions::SHRINK) {
+    return pack_start();
+  }
+
   const bool expand = (options == PackOptions::EXPAND_PADDING) || (options == PackOptions::EXPAND_WIDGET);
   const bool fill = (options == PackOptions::EXPAND_WIDGET);
 
-- 
2.11.0

_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to