[gtkmm] demos: Adapt to changed Box::pack_start() behaviour.



commit a14b83f7ecbd44c4dad51edcc52d8f931175e548
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Apr 28 18:24:44 2017 +0200

    demos: Adapt to changed Box::pack_start() behaviour.
    
    pack_start(EXPAND_WIDGET) or pack_start(EXPAND_PADDING), or the same
    with pack_end(), sets the child's hexpand and vexpand to true.
    But that also affects the parent widget (the old fill/expand GTK+ API
    didn't do that), so sometimes we need to unset that.
    
    Well, that explains most of these changes. I found the need for these
    changes by comparing the appearance (and behaviour when resizing) of
    gtkmm-demo for both gtkmm 3 and gtkmm 4.

 demos/gtk-demo/demowindow.cc                      |    1 +
 demos/gtk-demo/example_buttonbox.cc               |    2 ++
 demos/gtk-demo/example_menus.cc                   |    2 ++
 demos/gtk-demo/example_treeview_editable_cells.cc |    2 ++
 4 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/demos/gtk-demo/demowindow.cc b/demos/gtk-demo/demowindow.cc
index 542fde5..6ebc863 100644
--- a/demos/gtk-demo/demowindow.cc
+++ b/demos/gtk-demo/demowindow.cc
@@ -94,6 +94,7 @@ DemoWindow::DemoWindow()
   m_Notebook.child_property_tab_expand(m_TextWidget_Info) = true;
   m_Notebook.child_property_tab_expand(m_TextWidget_Source) = true;
   m_HBox.pack_start(m_Notebook, Gtk::PackOptions::EXPAND_WIDGET);
+  m_HBox.set_vexpand(true);
 
   set_default_size (800, 600);
 
diff --git a/demos/gtk-demo/example_buttonbox.cc b/demos/gtk-demo/example_buttonbox.cc
index dd3a62d..2374c82 100644
--- a/demos/gtk-demo/example_buttonbox.cc
+++ b/demos/gtk-demo/example_buttonbox.cc
@@ -99,6 +99,8 @@ Gtk::Frame* Example_ButtonBox::create_button_box(bool horizontal, const Glib::us
   pButton->set_icon_name("help-browser");
   pButtonBox->add(*pButton);
 
+  pFrame->set_hexpand();
+  pFrame->set_vexpand();
   return pFrame;
 }
 
diff --git a/demos/gtk-demo/example_menus.cc b/demos/gtk-demo/example_menus.cc
index 475efcf..41bf3f2 100644
--- a/demos/gtk-demo/example_menus.cc
+++ b/demos/gtk-demo/example_menus.cc
@@ -120,6 +120,8 @@ Example_Menus::Example_Menus()
   m_Button.signal_clicked().connect(sigc::mem_fun(*this, &Example_Menus::on_button_clicked));
 
   m_VBox_Sub2.pack_start(m_Button, Gtk::PackOptions::EXPAND_WIDGET);
+  m_VBox_Sub2.set_vexpand(false);
+
   m_Button.property_can_default() = true;
   m_Button.grab_default();
 }
diff --git a/demos/gtk-demo/example_treeview_editable_cells.cc 
b/demos/gtk-demo/example_treeview_editable_cells.cc
index 4cdc3ba..90b0294 100644
--- a/demos/gtk-demo/example_treeview_editable_cells.cc
+++ b/demos/gtk-demo/example_treeview_editable_cells.cc
@@ -129,6 +129,8 @@ Example_TreeView_EditableCells::Example_TreeView_EditableCells()
   m_VBox.pack_start(m_HBox, Gtk::PackOptions::SHRINK);
 
   m_HBox.pack_start(m_Button_Add, Gtk::PackOptions::EXPAND_WIDGET);
+  m_HBox.set_vexpand(false);
+
   m_Button_Add.signal_clicked().connect(
     sigc::mem_fun(*this, &Example_TreeView_EditableCells::on_button_add_clicked));
 


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