[gtkmm-documentation] examples: Use Gtk::Container::add() instead of Gtk::Box::pack_start()
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm-documentation] examples: Use Gtk::Container::add() instead of Gtk::Box::pack_start()
- Date: Wed, 6 Feb 2019 15:37:44 +0000 (UTC)
commit 31a7f5685992499a3c1200b26edc2286e1279c9c
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Wed Feb 6 16:34:57 2019 +0100
examples: Use Gtk::Container::add() instead of Gtk::Box::pack_start()
examples/book/actionbar/examplewindow.cc | 11 +--
examples/book/assistant/exampleassistant.cc | 6 +-
examples/book/box/examplewindow.cc | 84 +++++++++++-----------
examples/book/box/packbox.cc | 55 +++++++-------
examples/book/box/packbox.h | 7 +-
examples/book/builder/derived/deriveddialog.cc | 3 +-
examples/book/buttonbox/examplebuttonbox.cc | 2 +-
examples/book/buttonbox/examplewindow.cc | 50 ++++++-------
examples/book/buttons/radiobutton/radiobuttons.cc | 19 +++--
examples/book/clipboard/ideal/examplewindow.cc | 11 +--
examples/book/clipboard/simple/examplewindow.cc | 11 +--
.../book/custom/custom_container/examplewindow.cc | 7 +-
.../book/custom/custom_widget/examplewindow.cc | 2 +-
examples/book/dialogs/aboutdialog/examplewindow.cc | 9 ++-
.../dialogs/colorchooserdialog/examplewindow.cc | 7 +-
.../dialogs/filechooserdialog/examplewindow.cc | 6 +-
.../dialogs/filechoosernative/examplewindow.cc | 6 +-
.../dialogs/fontchooserdialog/examplewindow.cc | 6 +-
.../book/dialogs/messagedialog/examplewindow.cc | 6 +-
examples/book/drag_and_drop/dndwindow.cc | 6 +-
examples/book/entry/completion/examplewindow.cc | 7 +-
examples/book/entry/icon/examplewindow.cc | 4 +-
examples/book/entry/progress/examplewindow.cc | 4 +-
examples/book/entry/simple/examplewindow.cc | 13 ++--
examples/book/helloworld2/helloworld.cc | 29 ++++----
examples/book/iconview/examplewindow.cc | 7 +-
examples/book/idle/idleexample.cc | 23 +++---
examples/book/infobar/examplewindow.cc | 11 +--
examples/book/label/examplewindow.cc | 18 ++---
examples/book/listbox/examplewindow.cc | 42 +++++------
examples/book/menus/main_menu/examplewindow.cc | 2 +-
examples/book/menus/popup/examplewindow.cc | 3 +-
examples/book/menus_and_toolbars/examplewindow.cc | 4 +-
examples/book/multithread/examplewindow.cc | 13 ++--
examples/book/notebook/examplewindow.cc | 7 +-
examples/book/popover/examplewindow.cc | 18 ++---
examples/book/printing/advanced/examplewindow.cc | 13 ++--
examples/book/printing/advanced/previewdialog.cc | 10 +--
.../book/printing/advanced/printformoperation.cc | 6 +-
examples/book/printing/simple/examplewindow.cc | 10 +--
examples/book/progressbar/examplewindow.cc | 9 +--
examples/book/range_widgets/examplewindow.cc | 48 +++++++------
examples/book/recent_files/examplewindow.cc | 4 +-
examples/book/revealer/examplewindow.cc | 7 +-
examples/book/scrolledwindow/examplewindow.cc | 3 +-
examples/book/searchbar/examplewindow.cc | 17 ++---
examples/book/spinbutton/examplewindow.cc | 69 ++++++++++--------
examples/book/textview/examplewindow.cc | 11 +--
examples/book/timeout/timerexample.cc | 8 ++-
examples/book/toolbar/examplewindow.cc | 6 +-
examples/book/tooltips/examplewindow.cc | 9 +--
.../book/treeview/combo_renderer/examplewindow.cc | 7 +-
.../book/treeview/drag_and_drop/examplewindow.cc | 7 +-
.../book/treeview/editable_cells/examplewindow.cc | 7 +-
examples/book/treeview/filter/examplewindow.cc | 7 +-
.../book/treeview/filter_modify/examplewindow.cc | 7 +-
examples/book/treeview/list/examplewindow.cc | 7 +-
.../book/treeview/listviewtext/examplewindow.cc | 7 +-
examples/book/treeview/modelsort/examplewindow.cc | 10 +--
examples/book/treeview/popup/examplewindow.cc | 7 +-
examples/book/treeview/tree/examplewindow.cc | 7 +-
examples/book/update_ui/examplewindow.cc | 8 +--
examples/others/calendar/calendar.cc | 38 +++++-----
examples/others/cellrenderercustom/popupentry.cc | 5 +-
examples/others/idle/idle.cc | 21 +++---
examples/others/statusbar/statusbar.cc | 9 ++-
examples/others/treemodelcustom/examplewindow.cc | 7 +-
67 files changed, 494 insertions(+), 416 deletions(-)
---
diff --git a/examples/book/actionbar/examplewindow.cc b/examples/book/actionbar/examplewindow.cc
index 76516ed..89946ac 100644
--- a/examples/book/actionbar/examplewindow.cc
+++ b/examples/book/actionbar/examplewindow.cc
@@ -38,9 +38,9 @@ ExampleWindow::ExampleWindow()
m_prev_button.set_image_from_icon_name("go-previous-symbolic", Gtk::IconSize::INHERIT, true);
m_next_button.set_image_from_icon_name("go-next-symbolic", Gtk::IconSize::INHERIT, true);
m_photo_button.set_image_from_icon_name("media-record-symbolic", Gtk::IconSize::INHERIT, true);
- m_photo_box.pack_start(m_prev_button, Gtk::PackOptions::SHRINK);
- m_photo_box.pack_start(m_photo_button, Gtk::PackOptions::SHRINK);
- m_photo_box.pack_start(m_next_button, Gtk::PackOptions::SHRINK);
+ m_photo_box.add(m_prev_button);
+ m_photo_box.add(m_photo_button);
+ m_photo_box.add(m_next_button);
auto style_context = m_photo_box.get_style_context();
style_context->add_class("raised");
style_context->add_class("linked");
@@ -52,8 +52,9 @@ ExampleWindow::ExampleWindow()
// Layout
m_box.set_homogeneous(false);
- m_box.pack_start(m_face_image, Gtk::PackOptions::EXPAND_WIDGET);
- m_box.pack_end(m_action_bar, Gtk::PackOptions::SHRINK);
+ m_face_image.set_expand();
+ m_box.add(m_face_image);
+ m_box.add(m_action_bar);
add(m_box);
}
diff --git a/examples/book/assistant/exampleassistant.cc b/examples/book/assistant/exampleassistant.cc
index 77b650e..47ea80b 100644
--- a/examples/book/assistant/exampleassistant.cc
+++ b/examples/book/assistant/exampleassistant.cc
@@ -26,8 +26,10 @@ ExampleAssistant::ExampleAssistant()
set_title("Gtk::Assistant example");
set_default_size(400, 300);
- m_box.pack_start(m_label1, Gtk::PackOptions::EXPAND_WIDGET);
- m_box.pack_start(m_entry, Gtk::PackOptions::EXPAND_WIDGET);
+ m_box.add(m_label1);
+ m_box.add(m_entry);
+ m_label1.set_expand();
+ m_entry.set_expand();
append_page(m_box);
append_page(m_check);
diff --git a/examples/book/box/examplewindow.cc b/examples/book/box/examplewindow.cc
index 2454014..42c6208 100644
--- a/examples/book/box/examplewindow.cc
+++ b/examples/book/box/examplewindow.cc
@@ -29,8 +29,6 @@ ExampleWindow::ExampleWindow(int which)
m_separator2.set_margin_top(5);
m_separator2.set_margin_bottom(5);
- PackBox *pPackBox1, *pPackBox2, *pPackBox3, *pPackBox4, *pPackBox5;
-
switch(which)
{
case 1:
@@ -44,43 +42,44 @@ ExampleWindow::ExampleWindow(int which)
// Pack the label into the vertical box (vbox box1). Remember that
// widgets added to a vbox will be packed one on top of the other in
// order.
- m_box1.pack_start(m_Label1, Gtk::PackOptions::SHRINK);
+ m_box1.add(m_Label1);
// Create a PackBox - homogeneous = false, spacing = 0,
- // options = Gtk::PackOptions::SHRINK, margin = 0
- pPackBox1 = Gtk::make_managed<PackBox>(false, 0, Gtk::PackOptions::SHRINK);
- m_box1.pack_start(*pPackBox1, Gtk::PackOptions::SHRINK);
+ // expand = false, Gtk::Align::FILL, margin = 0
+ // These are the default values.
+ auto pPackBox = Gtk::make_managed<PackBox>();
+ m_box1.add(*pPackBox);
// Create a PackBox - homogeneous = false, spacing = 0,
- // options = Gtk::PackOptions::EXPAND_PADDING, margin = 0
- pPackBox2 = Gtk::make_managed<PackBox>(false, 0, Gtk::PackOptions::EXPAND_PADDING);
- m_box1.pack_start(*pPackBox2, Gtk::PackOptions::SHRINK);
+ // expand = true, Gtk::Align::CENTER, margin = 0
+ pPackBox = Gtk::make_managed<PackBox>(false, 0, true, Gtk::Align::CENTER);
+ m_box1.add(*pPackBox);
// Create a PackBox - homogeneous = false, spacing = 0,
- // options = Gtk::PackOptions::EXPAND_WIDGET, margin = 0
- pPackBox3 = Gtk::make_managed<PackBox>(false, 0, Gtk::PackOptions::EXPAND_WIDGET);
- m_box1.pack_start(*pPackBox3, Gtk::PackOptions::SHRINK);
+ // expand = true, Gtk::Align::FILL, margin = 0
+ pPackBox = Gtk::make_managed<PackBox>(false, 0, true);
+ m_box1.add(*pPackBox);
// pack the separator into the vbox. Remember each of these
// widgets are being packed into a vbox, so they'll be stacked
// vertically.
- m_box1.pack_start(m_separator1, Gtk::PackOptions::SHRINK);
+ m_box1.add(m_separator1);
// create another new label, and show it.
m_Label2.set_text("Gtk::Box(Gtk::Orientation::HORIZONTAL, 0); set_homogeneous(true);");
m_Label2.set_halign(Gtk::Align::START);
m_Label2.set_valign(Gtk::Align::START);
- m_box1.pack_start(m_Label2, Gtk::PackOptions::SHRINK);
+ m_box1.add(m_Label2);
- // Args are: homogeneous, spacing, options, margin
- pPackBox4 = Gtk::make_managed<PackBox>(true, 0, Gtk::PackOptions::EXPAND_PADDING);
- m_box1.pack_start(*pPackBox4, Gtk::PackOptions::SHRINK);
+ // Args are: homogeneous, spacing, expand, align, margin
+ pPackBox = Gtk::make_managed<PackBox>(true, 0, true, Gtk::Align::CENTER);
+ m_box1.add(*pPackBox);
- // Args are: homogeneous, spacing, options, margin
- pPackBox5 = Gtk::make_managed<PackBox>(true, 0, Gtk::PackOptions::EXPAND_WIDGET);
- m_box1.pack_start(*pPackBox5, Gtk::PackOptions::SHRINK);
+ // Args are: homogeneous, spacing, expand, align, margin
+ pPackBox = Gtk::make_managed<PackBox>(true, 0, true);
+ m_box1.add(*pPackBox);
- m_box1.pack_start(m_separator2, Gtk::PackOptions::SHRINK);
+ m_box1.add(m_separator2);
break;
}
@@ -90,46 +89,48 @@ ExampleWindow::ExampleWindow(int which)
m_Label1.set_text("Gtk::Box(Gtk::Orientation::HORIZONTAL, 10); set_homogeneous(false);");
m_Label1.set_halign(Gtk::Align::START);
m_Label1.set_valign(Gtk::Align::START);
- m_box1.pack_start(m_Label1, Gtk::PackOptions::SHRINK);
+ m_box1.add(m_Label1);
- pPackBox1 = Gtk::make_managed<PackBox>(false, 10, Gtk::PackOptions::EXPAND_PADDING);
- m_box1.pack_start(*pPackBox1, Gtk::PackOptions::SHRINK);
+ auto pPackBox = Gtk::make_managed<PackBox>(false, 10, true, Gtk::Align::CENTER);
+ m_box1.add(*pPackBox);
- pPackBox2 = Gtk::make_managed<PackBox>(false, 10, Gtk::PackOptions::EXPAND_WIDGET);
- m_box1.pack_start(*pPackBox2, Gtk::PackOptions::SHRINK);
+ pPackBox = Gtk::make_managed<PackBox>(false, 10, true);
+ m_box1.add(*pPackBox);
- m_box1.pack_start(m_separator1, Gtk::PackOptions::SHRINK);
+ m_box1.add(m_separator1);
m_Label2.set_text("Gtk::Box(Gtk::Orientation::HORIZONTAL, 0); set_homogeneous(false);");
m_Label2.set_halign(Gtk::Align::START);
m_Label2.set_valign(Gtk::Align::START);
- m_box1.pack_start(m_Label2, Gtk::PackOptions::SHRINK);
+ m_box1.add(m_Label2);
- pPackBox3 = Gtk::make_managed<PackBox>(false, 0, Gtk::PackOptions::SHRINK, 10);
- m_box1.pack_start(*pPackBox3, Gtk::PackOptions::SHRINK);
+ pPackBox = Gtk::make_managed<PackBox>(false, 0, false, Gtk::Align::FILL, 10);
+ m_box1.add(*pPackBox);
- pPackBox4 = Gtk::make_managed<PackBox>(false, 0, Gtk::PackOptions::EXPAND_WIDGET, 10);
- m_box1.pack_start(*pPackBox4, Gtk::PackOptions::SHRINK);
+ pPackBox = Gtk::make_managed<PackBox>(false, 0, true, Gtk::Align::FILL, 10);
+ m_box1.add(*pPackBox);
- m_box1.pack_start(m_separator2, Gtk::PackOptions::SHRINK);
+ m_box1.add(m_separator2);
break;
}
case 3:
{
- // This demonstrates the ability to use Gtk::Box::pack_end() to
+ // This demonstrates the ability to use Gtk::Align::END to
// right justify widgets. First, we create a new box as before.
- pPackBox1 = Gtk::make_managed<PackBox>(false, 0, Gtk::PackOptions::SHRINK);
+ auto pPackBox = Gtk::make_managed<PackBox>();
// create the label that will be put at the end.
m_Label1.set_text("end");
- // pack it using pack_end(), so it is put on the right side
+ // pack it using Gtk::Align::END, so it is put on the right side
// of the PackBox.
- pPackBox1->pack_end(m_Label1, Gtk::PackOptions::SHRINK);
+ m_Label1.set_halign(Gtk::Align::END);
+ m_Label1.set_hexpand(true);
+ pPackBox->add(m_Label1);
- m_box1.pack_start(*pPackBox1, Gtk::PackOptions::SHRINK);
+ m_box1.add(*pPackBox);
// This explicitly sets the separator to 700 pixels wide by 5 pixels
// high. This is so the hbox we created will also be 700 pixels wide,
@@ -139,7 +140,7 @@ ExampleWindow::ExampleWindow(int which)
m_separator1.set_size_request(700, 5);
// pack the separator into the vbox.
- m_box1.pack_start(m_separator1, Gtk::PackOptions::SHRINK);
+ m_box1.add(m_separator1);
break;
}
@@ -156,9 +157,10 @@ ExampleWindow::ExampleWindow(int which)
&ExampleWindow::on_button_quit_clicked) );
// pack the button into the quitbox.
- m_boxQuit.pack_start(m_buttonQuit, Gtk::PackOptions::EXPAND_PADDING);
+ m_boxQuit.add(m_buttonQuit);
+ m_buttonQuit.set_hexpand(true);
m_buttonQuit.set_halign(Gtk::Align::CENTER);
- m_box1.pack_start(m_boxQuit, Gtk::PackOptions::SHRINK);
+ m_box1.add(m_boxQuit);
// pack the vbox (box1) which now contains all our widgets, into the
// main window.
diff --git a/examples/book/box/packbox.cc b/examples/book/box/packbox.cc
index e403ac3..912c09c 100644
--- a/examples/book/box/packbox.cc
+++ b/examples/book/box/packbox.cc
@@ -15,38 +15,35 @@
*/
#include "packbox.h"
+#include <map>
-PackBox::PackBox(bool homogeneous, int spacing, Gtk::PackOptions options,
- int margin)
-: Gtk::Box(Gtk::Orientation::HORIZONTAL, spacing),
- m_button1("box.pack_start("),
- m_button2("button,"),
- m_button3((options == Gtk::PackOptions::SHRINK) ? "Gtk::PackOptions::SHRINK);" :
- ((options == Gtk::PackOptions::EXPAND_PADDING) ?
- "Gtk::PackOptions::EXPAND_PADDING);" : "Gtk::PackOptions::EXPAND_WIDGET);"))
+namespace
{
- set_homogeneous(homogeneous);
-
- m_button1.set_margin_start(margin);
- m_button1.set_margin_end(margin);
- pack_start(m_button1, options);
-
- m_button2.set_margin_start(margin);
- m_button2.set_margin_end(margin);
- pack_start(m_button2, options);
-
- m_button3.set_margin_start(margin);
- m_button3.set_margin_end(margin);
- pack_start(m_button3, options);
-
- m_pbutton4 = new Gtk::Button("margin=" + Glib::ustring::format(margin));
- m_pbutton4->set_margin_start(margin);
- m_pbutton4->set_margin_end(margin);
- pack_start(*m_pbutton4, options);
+ const std::map<Gtk::Align, Glib::ustring> align_string = {
+ {Gtk::Align::FILL, "Gtk::Align::FILL"},
+ {Gtk::Align::START, "Gtk::Align::START"},
+ {Gtk::Align::END, "Gtk::Align::END"},
+ {Gtk::Align::CENTER, "Gtk::Align::CENTER"},
+ {Gtk::Align::BASELINE, "Gtk::Align::BASELINE"},
+ };
}
-PackBox::~PackBox()
+PackBox::PackBox(bool homogeneous, int spacing, bool expand, Gtk::Align align, int margin)
+: Gtk::Box(Gtk::Orientation::HORIZONTAL, spacing)
{
- delete m_pbutton4;
-}
+ set_homogeneous(homogeneous);
+ m_buttons[0].set_label("box.add(button);");
+ m_buttons[1].set_label("expand=" + Glib::ustring(expand ? "true" : "false"));
+ m_buttons[2].set_label(align_string.at(align));
+ m_buttons[3].set_label("margin=" + Glib::ustring::format(margin));
+
+ for (auto& button : m_buttons)
+ {
+ add(button);
+ button.set_hexpand(expand);
+ button.set_halign(align);
+ button.set_margin_start(margin);
+ button.set_margin_end(margin);
+ }
+}
diff --git a/examples/book/box/packbox.h b/examples/book/box/packbox.h
index 0383de3..3412030 100644
--- a/examples/book/box/packbox.h
+++ b/examples/book/box/packbox.h
@@ -22,12 +22,11 @@
class PackBox : public Gtk::Box
{
public:
- PackBox(bool homogeneous, int spacing, Gtk::PackOptions options, int margin = 0);
- virtual ~PackBox();
+ PackBox(bool homogeneous = false, int spacing = 0, bool expand = false,
+ Gtk::Align align = Gtk::Align::FILL, int margin = 0);
protected:
- Gtk::Button m_button1, m_button2, m_button3;
- Gtk::Button* m_pbutton4;
+ Gtk::Button m_buttons[4];
};
#endif //GTKMM_EXAMPLE_PACKBOX_H
diff --git a/examples/book/builder/derived/deriveddialog.cc b/examples/book/builder/derived/deriveddialog.cc
index 7e18417..b37c119 100644
--- a/examples/book/builder/derived/deriveddialog.cc
+++ b/examples/book/builder/derived/deriveddialog.cc
@@ -41,7 +41,8 @@ DerivedDialog::DerivedDialog(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Bu
auto pImage = Gtk::make_managed<Gtk::Image>();
pImage->set_from_icon_name(is_glad ? "face-smile" : "face-sad");
pImage->set_icon_size(Gtk::IconSize::LARGE);
- get_content_area()->pack_start(*pImage, Gtk::PackOptions::EXPAND_WIDGET);
+ pImage->set_expand();
+ get_content_area()->add(*pImage);
}
DerivedDialog::~DerivedDialog()
diff --git a/examples/book/buttonbox/examplebuttonbox.cc b/examples/book/buttonbox/examplebuttonbox.cc
index 10c89be..33827e7 100644
--- a/examples/book/buttonbox/examplebuttonbox.cc
+++ b/examples/book/buttonbox/examplebuttonbox.cc
@@ -33,7 +33,7 @@ ExampleButtonBox::ExampleButtonBox(bool horizontal,
set_margin_start(5);
set_margin_end(5);
}
- bbox->property_margin() = 5;
+ bbox->set_margin(5);
add(*bbox);
diff --git a/examples/book/buttonbox/examplewindow.cc b/examples/book/buttonbox/examplewindow.cc
index 4dac080..22658fb 100644
--- a/examples/book/buttonbox/examplewindow.cc
+++ b/examples/book/buttonbox/examplewindow.cc
@@ -28,53 +28,49 @@ ExampleWindow::ExampleWindow()
m_VBox_Main.set_spacing(10);
add(m_VBox_Main);
- m_VBox_Main.pack_start(m_Frame_Horizontal, Gtk::PackOptions::EXPAND_WIDGET);
- m_VBox_Main.set_margin_start(10);
+ m_VBox_Main.add(m_Frame_Horizontal);
//The horizontal ButtonBoxes:
m_VBox.set_margin(10);
m_Frame_Horizontal.add(m_VBox);
m_VBox.set_spacing(5);
- m_VBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
- (true, "Spread (spacing 40)", 40, Gtk::ButtonBoxStyle::SPREAD),
- Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.add(*Gtk::make_managed<ExampleButtonBox>
+ (true, "Spread (spacing 40)", 40, Gtk::ButtonBoxStyle::SPREAD));
- m_VBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
- (true, "Edge (spacing 30)", 30, Gtk::ButtonBoxStyle::EDGE),
- Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.add(*Gtk::make_managed<ExampleButtonBox>
+ (true, "Edge (spacing 30)", 30, Gtk::ButtonBoxStyle::EDGE));
- m_VBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
- (true, "Start (spacing 20)", 20, Gtk::ButtonBoxStyle::START),
- Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.add(*Gtk::make_managed<ExampleButtonBox>
+ (true, "Start (spacing 20)", 20, Gtk::ButtonBoxStyle::START));
- m_VBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
- (true, "End (spacing 10)", 10, Gtk::ButtonBoxStyle::END),
- Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.add(*Gtk::make_managed<ExampleButtonBox>
+ (true, "End (spacing 10)", 10, Gtk::ButtonBoxStyle::END));
+ for (auto child : m_VBox.get_children())
+ child->set_expand();
//The vertical ButtonBoxes:
- m_VBox_Main.pack_start(m_Frame_Vertical, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox_Main.add(m_Frame_Vertical);
m_HBox.set_margin(10);
m_Frame_Vertical.add(m_HBox);
m_HBox.set_spacing(5);
- m_HBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
- (false, "Spread (spacing 5)", 5, Gtk::ButtonBoxStyle::SPREAD),
- Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox.add(*Gtk::make_managed<ExampleButtonBox>
+ (false, "Spread (spacing 5)", 5, Gtk::ButtonBoxStyle::SPREAD));
- m_HBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
- (false, "Edge (spacing 30)", 30, Gtk::ButtonBoxStyle::EDGE),
- Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox.add(*Gtk::make_managed<ExampleButtonBox>
+ (false, "Edge (spacing 30)", 30, Gtk::ButtonBoxStyle::EDGE));
- m_HBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
- (false, "Start (spacing 20)", 20, Gtk::ButtonBoxStyle::START),
- Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox.add(*Gtk::make_managed<ExampleButtonBox>
+ (false, "Start (spacing 20)", 20, Gtk::ButtonBoxStyle::START));
- m_HBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
- (false, "End (spacing 10)", 10, Gtk::ButtonBoxStyle::END),
- Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox.add(*Gtk::make_managed<ExampleButtonBox>
+ (false, "End (spacing 10)", 10, Gtk::ButtonBoxStyle::END));
+
+ for (auto child : m_HBox.get_children())
+ child->set_expand();
}
ExampleWindow::~ExampleWindow()
diff --git a/examples/book/buttons/radiobutton/radiobuttons.cc
b/examples/book/buttons/radiobutton/radiobuttons.cc
index e9b65f0..ed9880d 100644
--- a/examples/book/buttons/radiobutton/radiobuttons.cc
+++ b/examples/book/buttons/radiobutton/radiobuttons.cc
@@ -38,24 +38,29 @@ RadioButtons::RadioButtons() :
add(m_Box_Top);
//Put the inner boxes and the separator in the outer box:
- m_Box_Top.pack_start(m_Box1, Gtk::PackOptions::EXPAND_WIDGET);
- m_Box_Top.pack_start(m_Separator, Gtk::PackOptions::EXPAND_WIDGET);
- m_Box_Top.pack_start(m_Box2, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Box_Top.add(m_Box1);
+ m_Box_Top.add(m_Separator);
+ m_Box_Top.add(m_Box2);
+ m_Separator.set_expand();
// Set the inner boxes' margins
m_Box1.set_margin(10);
m_Box2.set_margin(10);
// Put the radio buttons in Box1:
- m_Box1.pack_start(m_RadioButton1, Gtk::PackOptions::EXPAND_WIDGET);
- m_Box1.pack_start(m_RadioButton2, Gtk::PackOptions::EXPAND_WIDGET);
- m_Box1.pack_start(m_RadioButton3, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Box1.add(m_RadioButton1);
+ m_Box1.add(m_RadioButton2);
+ m_Box1.add(m_RadioButton3);
+ m_RadioButton1.set_expand();
+ m_RadioButton2.set_expand();
+ m_RadioButton3.set_expand();
// Set the second button active
m_RadioButton2.set_active();
// Put Close button in Box2:
- m_Box2.pack_start(m_Button_Close, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Box2.add(m_Button_Close);
+ m_Button_Close.set_expand();
// Make the button the default widget
m_Button_Close.set_can_default();
diff --git a/examples/book/clipboard/ideal/examplewindow.cc b/examples/book/clipboard/ideal/examplewindow.cc
index 25bf3f3..8cbf7e6 100644
--- a/examples/book/clipboard/ideal/examplewindow.cc
+++ b/examples/book/clipboard/ideal/examplewindow.cc
@@ -39,10 +39,11 @@ ExampleWindow::ExampleWindow()
m_VBox.set_margin(12);
add(m_VBox);
- m_VBox.pack_start(m_Label, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Label);
//Fill Grid:
- m_VBox.pack_start(m_Grid, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.add(m_Grid);
+ m_Grid.set_expand(true);
m_Grid.set_row_homogeneous(true);
m_Grid.set_column_homogeneous(true);
m_Grid.attach(m_ButtonA1, 0, 0);
@@ -51,15 +52,15 @@ ExampleWindow::ExampleWindow()
m_Grid.attach(m_ButtonB2, 1, 1);
//Add ButtonBox to bottom:
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ButtonBox);
m_VBox.set_spacing(6);
//Fill ButtonBox:
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
- m_ButtonBox.pack_start(m_Button_Copy, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Copy);
m_Button_Copy.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_copy) );
- m_ButtonBox.pack_start(m_Button_Paste, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Paste);
m_Button_Paste.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_paste) );
diff --git a/examples/book/clipboard/simple/examplewindow.cc b/examples/book/clipboard/simple/examplewindow.cc
index 6405034..7bc3a6c 100644
--- a/examples/book/clipboard/simple/examplewindow.cc
+++ b/examples/book/clipboard/simple/examplewindow.cc
@@ -29,10 +29,11 @@ ExampleWindow::ExampleWindow()
m_VBox.set_margin(12);
add(m_VBox);
- m_VBox.pack_start(m_Label, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Label);
//Fill Grid:
- m_VBox.pack_start(m_Grid, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.add(m_Grid);
+ m_Grid.set_expand(true);
m_Grid.set_row_homogeneous(true);
m_Grid.set_column_homogeneous(true);
m_Grid.attach(m_ButtonA1, 0, 0);
@@ -41,15 +42,15 @@ ExampleWindow::ExampleWindow()
m_Grid.attach(m_ButtonB2, 1, 1);
//Add ButtonBox to bottom:
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ButtonBox);
m_VBox.set_spacing(6);
//Fill ButtonBox:
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
- m_ButtonBox.pack_start(m_Button_Copy, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Copy);
m_Button_Copy.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_copy) );
- m_ButtonBox.pack_start(m_Button_Paste, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Paste);
m_Button_Paste.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_paste) );
}
diff --git a/examples/book/custom/custom_container/examplewindow.cc
b/examples/book/custom/custom_container/examplewindow.cc
index 289bf18..8ffdf94 100644
--- a/examples/book/custom/custom_container/examplewindow.cc
+++ b/examples/book/custom/custom_container/examplewindow.cc
@@ -31,11 +31,12 @@ ExampleWindow::ExampleWindow()
//Add the child widgets to the custom container:
m_MyContainer.set_child_widgets(m_Button_One, m_Label_Two);
+ m_MyContainer.set_expand();
- m_VBox.pack_start(m_MyContainer, Gtk::PackOptions::EXPAND_WIDGET);
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_MyContainer);
+ m_VBox.add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Quit);
m_ButtonBox.set_margin(6);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
m_Button_Quit.signal_clicked().connect( sigc::mem_fun(*this,
diff --git a/examples/book/custom/custom_widget/examplewindow.cc
b/examples/book/custom/custom_widget/examplewindow.cc
index e999ded..800ee50 100644
--- a/examples/book/custom/custom_widget/examplewindow.cc
+++ b/examples/book/custom/custom_widget/examplewindow.cc
@@ -33,7 +33,7 @@ ExampleWindow::ExampleWindow()
m_Grid.attach(m_ButtonBox, 0, 2, 2, 1);
- m_ButtonBox.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Quit);
m_ButtonBox.set_margin(6);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
m_Button_Quit.signal_clicked().connect( sigc::mem_fun(*this, &ExampleWindow::on_button_quit) );
diff --git a/examples/book/dialogs/aboutdialog/examplewindow.cc
b/examples/book/dialogs/aboutdialog/examplewindow.cc
index 98d1117..e3831fb 100644
--- a/examples/book/dialogs/aboutdialog/examplewindow.cc
+++ b/examples/book/dialogs/aboutdialog/examplewindow.cc
@@ -28,12 +28,15 @@ ExampleWindow::ExampleWindow()
add(m_VBox);
- m_VBox.pack_start(m_Label, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.add(m_Label);
+ m_Label.set_expand(true);
m_Label.set_line_wrap(true);
m_Label.set_selectable(true);
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::EXPAND_WIDGET);
- m_ButtonBox.pack_start(m_Button, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.add(m_ButtonBox);
+ m_ButtonBox.set_expand(true);
+ m_ButtonBox.add(m_Button);
+ m_Button.set_expand(true);
m_Button.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_clicked) );
diff --git a/examples/book/dialogs/colorchooserdialog/examplewindow.cc
b/examples/book/dialogs/colorchooserdialog/examplewindow.cc
index c5b2e18..acdc8d2 100644
--- a/examples/book/dialogs/colorchooserdialog/examplewindow.cc
+++ b/examples/book/dialogs/colorchooserdialog/examplewindow.cc
@@ -26,11 +26,11 @@ ExampleWindow::ExampleWindow()
add(m_VBox);
- m_VBox.pack_start(m_ColorButton, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ColorButton);
m_ColorButton.signal_color_set().connect(sigc::mem_fun(*this,
&ExampleWindow::on_color_button_color_set) );
- m_VBox.pack_start(m_Button_Dialog, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Button_Dialog);
m_Button_Dialog.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_dialog_clicked) );
@@ -41,7 +41,8 @@ ExampleWindow::ExampleWindow()
m_Color.set_alpha(1.0); //opaque
m_ColorButton.set_rgba(m_Color);
- m_VBox.pack_start(m_DrawingArea, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.add(m_DrawingArea);
+ m_DrawingArea.set_expand(true);
m_DrawingArea.set_draw_func(sigc::mem_fun(*this, &ExampleWindow::on_drawing_area_draw));
}
diff --git a/examples/book/dialogs/filechooserdialog/examplewindow.cc
b/examples/book/dialogs/filechooserdialog/examplewindow.cc
index 1263cc5..b34e617 100644
--- a/examples/book/dialogs/filechooserdialog/examplewindow.cc
+++ b/examples/book/dialogs/filechooserdialog/examplewindow.cc
@@ -27,11 +27,13 @@ ExampleWindow::ExampleWindow()
add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_File, Gtk::PackOptions::EXPAND_WIDGET);
+ m_ButtonBox.add(m_Button_File);
+ m_Button_File.set_expand(true);
m_Button_File.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_file_clicked) );
- m_ButtonBox.pack_start(m_Button_Folder, Gtk::PackOptions::EXPAND_WIDGET);
+ m_ButtonBox.add(m_Button_Folder);
+ m_Button_Folder.set_expand(true);
m_Button_Folder.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_folder_clicked) );
}
diff --git a/examples/book/dialogs/filechoosernative/examplewindow.cc
b/examples/book/dialogs/filechoosernative/examplewindow.cc
index eef07c7..f6c7f8a 100644
--- a/examples/book/dialogs/filechoosernative/examplewindow.cc
+++ b/examples/book/dialogs/filechoosernative/examplewindow.cc
@@ -25,11 +25,13 @@ ExampleWindow::ExampleWindow()
add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_File_Open, Gtk::PackOptions::EXPAND_WIDGET);
+ m_ButtonBox.add(m_Button_File_Open);
+ m_Button_File_Open.set_expand(true);
m_Button_File_Open.signal_clicked().connect(sigc::bind(sigc::mem_fun(*this,
&ExampleWindow::on_button_file_clicked), Gtk::FileChooser::Action::OPEN));
- m_ButtonBox.pack_start(m_Button_File_Save, Gtk::PackOptions::EXPAND_WIDGET);
+ m_ButtonBox.add(m_Button_File_Save);
+ m_Button_File_Save.set_expand(true);
m_Button_File_Save.signal_clicked().connect(sigc::bind(sigc::mem_fun(*this,
&ExampleWindow::on_button_file_clicked), Gtk::FileChooser::Action::SAVE));
}
diff --git a/examples/book/dialogs/fontchooserdialog/examplewindow.cc
b/examples/book/dialogs/fontchooserdialog/examplewindow.cc
index be917ad..2c99945 100644
--- a/examples/book/dialogs/fontchooserdialog/examplewindow.cc
+++ b/examples/book/dialogs/fontchooserdialog/examplewindow.cc
@@ -26,13 +26,15 @@ ExampleWindow::ExampleWindow()
add(m_ButtonBox);
- m_ButtonBox.pack_start(m_FontButton, Gtk::PackOptions::EXPAND_WIDGET);
+ m_ButtonBox.add(m_FontButton);
+ m_FontButton.set_expand(true);
m_FontButton.set_use_font(true);
m_FontButton.set_use_size(true);
m_FontButton.signal_font_set().connect(sigc::mem_fun(*this,
&ExampleWindow::on_font_button_font_set) );
- m_ButtonBox.pack_start(m_Button_Dialog, Gtk::PackOptions::EXPAND_WIDGET);
+ m_ButtonBox.add(m_Button_Dialog);
+ m_Button_Dialog.set_expand(true);
m_Button_Dialog.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_dialog_clicked) );
}
diff --git a/examples/book/dialogs/messagedialog/examplewindow.cc
b/examples/book/dialogs/messagedialog/examplewindow.cc
index 88839c2..1d2943d 100644
--- a/examples/book/dialogs/messagedialog/examplewindow.cc
+++ b/examples/book/dialogs/messagedialog/examplewindow.cc
@@ -28,11 +28,13 @@ ExampleWindow::ExampleWindow()
add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_Info, Gtk::PackOptions::EXPAND_WIDGET);
+ m_ButtonBox.add(m_Button_Info);
+ m_Button_Info.set_expand(true);
m_Button_Info.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_info_clicked) );
- m_ButtonBox.pack_start(m_Button_Question, Gtk::PackOptions::EXPAND_WIDGET);
+ m_ButtonBox.add(m_Button_Question);
+ m_Button_Question.set_expand(true);
m_Button_Question.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_question_clicked) );
}
diff --git a/examples/book/drag_and_drop/dndwindow.cc b/examples/book/drag_and_drop/dndwindow.cc
index ee3d4c8..36c650b 100644
--- a/examples/book/drag_and_drop/dndwindow.cc
+++ b/examples/book/drag_and_drop/dndwindow.cc
@@ -35,7 +35,8 @@ DnDWindow::DnDWindow()
m_Button_Drag.signal_drag_data_get().connect(sigc::mem_fun(*this,
&DnDWindow::on_button_drag_data_get));
- m_HBox.pack_start(m_Button_Drag, Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox.add(m_Button_Drag);
+ m_Button_Drag.set_expand(true);
//Drop site:
@@ -50,7 +51,8 @@ DnDWindow::DnDWindow()
m_Label_Drop.signal_drag_data_received().connect(sigc::mem_fun(*this,
&DnDWindow::on_label_drop_drag_data_received) );
- m_HBox.pack_start(m_Label_Drop, Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox.add(m_Label_Drop);
+ m_Label_Drop.set_expand(true);
}
DnDWindow::~DnDWindow()
diff --git a/examples/book/entry/completion/examplewindow.cc b/examples/book/entry/completion/examplewindow.cc
index ec3f281..3082c2d 100644
--- a/examples/book/entry/completion/examplewindow.cc
+++ b/examples/book/entry/completion/examplewindow.cc
@@ -26,13 +26,14 @@ ExampleWindow::ExampleWindow()
set_title("Gtk::EntryCompletion");
add(m_VBox);
- m_VBox.pack_start(m_Entry, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Entry);
- m_VBox.pack_start(m_Label, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.add(m_Label);
+ m_Label.set_expand(true);
m_Button_Close.signal_clicked().connect( sigc::mem_fun(*this,
&ExampleWindow::on_button_close) );
- m_VBox.pack_start(m_Button_Close, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Button_Close);
m_Button_Close.set_can_default();
m_Button_Close.grab_default();
diff --git a/examples/book/entry/icon/examplewindow.cc b/examples/book/entry/icon/examplewindow.cc
index 826e95b..355e6ec 100644
--- a/examples/book/entry/icon/examplewindow.cc
+++ b/examples/book/entry/icon/examplewindow.cc
@@ -27,7 +27,7 @@ ExampleWindow::ExampleWindow()
m_Entry.set_max_length(50);
m_Entry.set_text("Hello world");
- m_VBox.pack_start(m_Entry, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Entry);
m_Entry.set_icon_from_icon_name("edit-find");
m_Entry.signal_icon_press().connect( sigc::mem_fun(*this, &ExampleWindow::on_icon_pressed) );
@@ -35,7 +35,7 @@ ExampleWindow::ExampleWindow()
m_Button_Close.signal_clicked().connect( sigc::mem_fun(*this,
&ExampleWindow::on_button_close) );
- m_VBox.pack_start(m_Button_Close, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Button_Close);
m_Button_Close.set_can_default();
m_Button_Close.grab_default();
}
diff --git a/examples/book/entry/progress/examplewindow.cc b/examples/book/entry/progress/examplewindow.cc
index 615cab8..e95cce3 100644
--- a/examples/book/entry/progress/examplewindow.cc
+++ b/examples/book/entry/progress/examplewindow.cc
@@ -27,7 +27,7 @@ ExampleWindow::ExampleWindow()
m_Entry.set_max_length(50);
m_Entry.set_text("Hello world");
- m_VBox.pack_start(m_Entry, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Entry);
//Change the progress fraction every 0.1 second:
Glib::signal_timeout().connect(
@@ -37,7 +37,7 @@ ExampleWindow::ExampleWindow()
m_Button_Close.signal_clicked().connect( sigc::mem_fun(*this,
&ExampleWindow::on_button_close) );
- m_VBox.pack_start(m_Button_Close, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Button_Close);
m_Button_Close.set_can_default();
m_Button_Close.grab_default();
}
diff --git a/examples/book/entry/simple/examplewindow.cc b/examples/book/entry/simple/examplewindow.cc
index 704a27d..a555dcf 100644
--- a/examples/book/entry/simple/examplewindow.cc
+++ b/examples/book/entry/simple/examplewindow.cc
@@ -32,24 +32,27 @@ ExampleWindow::ExampleWindow()
m_Entry.set_text("hello");
m_Entry.set_text(m_Entry.get_text() + " world");
m_Entry.select_region(0, m_Entry.get_text_length());
- m_VBox.pack_start(m_Entry, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Entry.set_expand(true);
+ m_VBox.add(m_Entry);
- // Note that add() can also be used instead of pack_xxx()
m_VBox.add(m_HBox);
- m_HBox.pack_start(m_CheckButton_Editable, Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox.add(m_CheckButton_Editable);
+ m_CheckButton_Editable.set_expand(true);
m_CheckButton_Editable.signal_toggled().connect( sigc::mem_fun(*this,
&ExampleWindow::on_checkbox_editable_toggled) );
m_CheckButton_Editable.set_active(true);
- m_HBox.pack_start(m_CheckButton_Visible, Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox.add(m_CheckButton_Visible);
+ m_CheckButton_Visible.set_expand(true);
m_CheckButton_Visible.signal_toggled().connect( sigc::mem_fun(*this,
&ExampleWindow::on_checkbox_visibility_toggled) );
m_CheckButton_Visible.set_active(true);
m_Button_Close.signal_clicked().connect( sigc::mem_fun(*this,
&ExampleWindow::on_button_close) );
- m_VBox.pack_start(m_Button_Close, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.add(m_Button_Close);
+ m_Button_Close.set_expand();
m_Button_Close.set_can_default();
m_Button_Close.grab_default();
}
diff --git a/examples/book/helloworld2/helloworld.cc b/examples/book/helloworld2/helloworld.cc
index 29d6f28..29b44e5 100644
--- a/examples/book/helloworld2/helloworld.cc
+++ b/examples/book/helloworld2/helloworld.cc
@@ -25,36 +25,33 @@ HelloWorld::HelloWorld()
set_title("Hello Buttons!");
// Sets the margin around the box.
- m_box1.property_margin() = 10;
+ m_box1.set_margin(10);
// put the box into the main window.
add(m_box1);
- // Now when the button is clicked, we call the "on_button_clicked" function
- // with a pointer to "button 1" as its argument
+ // Now when the button is clicked, we call the on_button_clicked() function
+ // with a pointer to "button 1" as its argument.
m_button1.signal_clicked().connect(sigc::bind(
sigc::mem_fun(*this, &HelloWorld::on_button_clicked), "button 1"));
- // instead of gtk_container_add, we pack this button into the invisible
- // box, which has been packed into the window.
- // note that the pack_start default arguments are Gtk::EXPAND | Gtk::FILL, 0
- m_box1.pack_start(m_button1, Gtk::PackOptions::EXPAND_WIDGET);
-
- // always remember this step, this tells GTK that our preparation
- // for this button is complete, and it can be displayed now.
- m_button1.show();
+ // We use Gtk::Container::add() to pack this button into the box,
+ // which has been packed into the window.
+ // A widget's default behaviour is not to expand if extra space is available.
+ // A container widget by default expands if any of the contained widgets
+ // wants to expand.
+ m_box1.add(m_button1);
+ m_button1.set_expand();
// call the same signal handler with a different argument,
// passing a pointer to "button 2" instead.
m_button2.signal_clicked().connect(sigc::bind(
sigc::mem_fun(*this, &HelloWorld::on_button_clicked), "button 2"));
- m_box1.pack_start(m_button2, Gtk::PackOptions::EXPAND_WIDGET);
+ m_box1.add(m_button2);
+ m_button2.set_expand();
- // Show the widgets.
- // They will not really be shown until this Window is shown.
- m_button2.show();
- m_box1.show();
+ // Gtk::Widget::show() is seldom needed. All widgets are visible by default.
}
HelloWorld::~HelloWorld()
diff --git a/examples/book/iconview/examplewindow.cc b/examples/book/iconview/examplewindow.cc
index d0813ff..63c4584 100644
--- a/examples/book/iconview/examplewindow.cc
+++ b/examples/book/iconview/examplewindow.cc
@@ -51,11 +51,12 @@ ExampleWindow::ExampleWindow()
// Only show the scrollbars when they are necessary:
m_ScrolledWindow.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC);
+ m_ScrolledWindow.set_expand();
- m_VBox.pack_start(m_ScrolledWindow, Gtk::PackOptions::EXPAND_WIDGET);
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ScrolledWindow);
+ m_VBox.add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Quit);
m_ButtonBox.set_margin(6);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
m_Button_Quit.signal_clicked().connect(sigc::mem_fun(*this,
diff --git a/examples/book/idle/idleexample.cc b/examples/book/idle/idleexample.cc
index 92a9366..090d5e5 100644
--- a/examples/book/idle/idleexample.cc
+++ b/examples/book/idle/idleexample.cc
@@ -26,19 +26,24 @@ IdleExample::IdleExample() :
// Adding a few widgets:
add(m_Box);
- m_Box.pack_start(*Gtk::make_managed<Gtk::Label>("Formatting Windows drive C:"));
- m_Box.pack_start(*Gtk::make_managed<Gtk::Label>("100 MB"));
- m_Box.pack_start(m_ProgressBar_c, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Box.add(*Gtk::make_managed<Gtk::Label>("Formatting Windows drive C:"));
+ m_Box.add(*Gtk::make_managed<Gtk::Label>("100 MB"));
+ m_Box.add(m_ProgressBar_c);
+ m_ProgressBar_c.set_expand();
- m_Box.pack_start(*Gtk::make_managed<Gtk::Label>(""));
+ m_Box.add(*Gtk::make_managed<Gtk::Label>(""));
- m_Box.pack_start(*Gtk::make_managed<Gtk::Label>("Formatting Windows drive D:"));
- m_Box.pack_start(*Gtk::make_managed<Gtk::Label>("5000 MB"));
- m_Box.pack_start(m_ProgressBar_d, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Box.add(*Gtk::make_managed<Gtk::Label>("Formatting Windows drive D:"));
+ m_Box.add(*Gtk::make_managed<Gtk::Label>("5000 MB"));
+ m_Box.add(m_ProgressBar_d);
+ m_ProgressBar_d.set_expand();
auto hbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL,10);
- m_Box.pack_start(*hbox, Gtk::PackOptions::EXPAND_WIDGET);
- hbox->pack_start(m_ButtonQuit, Gtk::PackOptions::EXPAND_PADDING);
+ m_Box.add(*hbox);
+ hbox->add(m_ButtonQuit);
+ m_ButtonQuit.set_expand();
+ m_ButtonQuit.set_halign(Gtk::Align::END);
+ m_ButtonQuit.set_valign(Gtk::Align::END);
// Connect the signal handlers:
m_ButtonQuit.signal_clicked().connect( sigc::mem_fun(*this,
diff --git a/examples/book/infobar/examplewindow.cc b/examples/book/infobar/examplewindow.cc
index 16197b8..f7f390b 100644
--- a/examples/book/infobar/examplewindow.cc
+++ b/examples/book/infobar/examplewindow.cc
@@ -37,7 +37,7 @@ ExampleWindow::ExampleWindow()
m_InfoBar.add_button("_OK", 0);
// Add the InfoBar to the vbox:
- m_VBox.pack_start(m_InfoBar, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_InfoBar);
// Create the buffer and set it for the TextView:
m_refTextBuffer = Gtk::TextBuffer::create();
@@ -48,14 +48,15 @@ ExampleWindow::ExampleWindow()
// Show the scrollbars only when they are necessary:
m_ScrolledWindow.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC);
+ m_ScrolledWindow.set_expand();
- m_VBox.pack_start(m_ScrolledWindow, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.add(m_ScrolledWindow);
// Add button box:
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_Clear, Gtk::PackOptions::SHRINK);
- m_ButtonBox.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Clear);
+ m_ButtonBox.add(m_Button_Quit);
m_ButtonBox.set_spacing(6);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
diff --git a/examples/book/label/examplewindow.cc b/examples/book/label/examplewindow.cc
index f722cf4..d344c5d 100644
--- a/examples/book/label/examplewindow.cc
+++ b/examples/book/label/examplewindow.cc
@@ -41,23 +41,23 @@ ExampleWindow::ExampleWindow()
m_HBox.set_margin(5);
add(m_HBox);
- m_HBox.pack_start(m_VBox, Gtk::PackOptions::SHRINK);
+ m_HBox.add(m_VBox);
m_Frame_Normal.add(m_Label_Normal);
- m_VBox.pack_start(m_Frame_Normal, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Frame_Normal);
m_Frame_Multi.add(m_Label_Multi);
- m_VBox.pack_start(m_Frame_Multi, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Frame_Multi);
m_Label_Left.set_justify(Gtk::Justification::LEFT);
m_Frame_Left.add(m_Label_Left);
- m_VBox.pack_start(m_Frame_Left, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Frame_Left);
m_Label_Right.set_justify(Gtk::Justification::RIGHT);
m_Frame_Right.add(m_Label_Right);
- m_VBox.pack_start(m_Frame_Right, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Frame_Right);
- m_HBox.pack_start(m_VBox2, Gtk::PackOptions::SHRINK);
+ m_HBox.add(m_VBox2);
m_Label_LineWrapped.set_text(
"This is an example of a line-wrapped label. It "
@@ -73,7 +73,7 @@ ExampleWindow::ExampleWindow()
"many extra spaces. ");
m_Label_LineWrapped.set_line_wrap();
m_Frame_LineWrapped.add(m_Label_LineWrapped);
- m_VBox2.pack_start(m_Frame_LineWrapped, Gtk::PackOptions::SHRINK);
+ m_VBox2.add(m_Frame_LineWrapped);
m_Label_FilledWrapped.set_text(
"This is an example of a line-wrapped, filled label. "
@@ -89,14 +89,14 @@ ExampleWindow::ExampleWindow()
m_Label_FilledWrapped.set_justify(Gtk::Justification::FILL);
m_Label_FilledWrapped.set_line_wrap();
m_Frame_FilledWrapped.add(m_Label_FilledWrapped);
- m_VBox2.pack_start(m_Frame_FilledWrapped, Gtk::PackOptions::SHRINK);
+ m_VBox2.add(m_Frame_FilledWrapped);
m_Label_Underlined.set_justify(Gtk::Justification::LEFT);
m_Label_Underlined.set_pattern (
"_________________________ _ _________ _ ______"
" __ _______ ___");
m_Frame_Underlined.add(m_Label_Underlined);
- m_VBox2.pack_start(m_Frame_Underlined, Gtk::PackOptions::SHRINK);
+ m_VBox2.add(m_Frame_Underlined);
}
ExampleWindow::~ExampleWindow()
diff --git a/examples/book/listbox/examplewindow.cc b/examples/book/listbox/examplewindow.cc
index f44c8c7..6899196 100644
--- a/examples/book/listbox/examplewindow.cc
+++ b/examples/book/listbox/examplewindow.cc
@@ -64,14 +64,14 @@ ExampleWindow::ExampleWindow() :
m_HBox.set_margin(5);
add(m_HBox);
- m_HBox.pack_start(m_VBox1, Gtk::PackOptions::SHRINK);
+ m_HBox.add(m_VBox1);
// ComboBox for selection mode.
for (std::size_t i = 0; i < G_N_ELEMENTS(selectionModes); ++i)
m_ComboBox.append(selectionModes[i].text);
m_ComboBox.signal_changed().connect(sigc::mem_fun(*this, &ExampleWindow::on_selection_mode_changed));
- m_VBox1.pack_start(m_ComboBox, Gtk::PackOptions::SHRINK);
+ m_VBox1.add(m_ComboBox);
const auto mode = m_ListBox.get_selection_mode();
int index = 0;
@@ -88,12 +88,12 @@ ExampleWindow::ExampleWindow() :
// Check button for single click.
m_CheckButton_SingleClick.set_active(m_ListBox.get_activate_on_single_click());
m_CheckButton_SingleClick.signal_toggled().connect(sigc::mem_fun(*this,
&ExampleWindow::on_single_click_toggled));
- m_VBox1.pack_start(m_CheckButton_SingleClick, Gtk::PackOptions::SHRINK);
+ m_VBox1.add(m_CheckButton_SingleClick);
// Put the ListBox in a ScrolledWindow.
m_ScrolledWindow.set_policy(Gtk::PolicyType::NEVER, Gtk::PolicyType::AUTOMATIC);
m_ScrolledWindow.add(m_ListBox);
- m_HBox.pack_start(m_ScrolledWindow, Gtk::PackOptions::SHRINK);
+ m_HBox.add(m_ScrolledWindow);
m_ListBox.signal_row_selected().connect(sigc::mem_fun(*this, &ExampleWindow::on_row_selected));
m_ListBox.signal_row_activated().connect(sigc::mem_fun(*this, &ExampleWindow::on_row_activated));
@@ -108,11 +108,11 @@ ExampleWindow::ExampleWindow() :
m_ListBox.append(*row);
row = Gtk::make_managed<ExampleRow>("", 0);
- m_HBox_Row.pack_start(m_Label_Row, Gtk::PackOptions::SHRINK);
- m_HBox_Row.pack_start(m_CheckButton_Row1, Gtk::PackOptions::SHRINK);
- m_HBox_Row.pack_start(m_Button_Row1, Gtk::PackOptions::SHRINK);
- m_VBox_Row.pack_start(m_HBox_Row, Gtk::PackOptions::SHRINK);
- m_VBox_Row.pack_start(m_CheckButton_Row2, Gtk::PackOptions::SHRINK);
+ m_HBox_Row.add(m_Label_Row);
+ m_HBox_Row.add(m_CheckButton_Row1);
+ m_HBox_Row.add(m_Button_Row1);
+ m_VBox_Row.add(m_HBox_Row);
+ m_VBox_Row.add(m_CheckButton_Row2);
row->add(m_VBox_Row);
m_ListBox.append(*row);
@@ -123,24 +123,24 @@ ExampleWindow::ExampleWindow() :
m_ListBox.append(*row);
// Put buttons in a vertical box, and connect signal handlers.
- m_HBox.pack_start(m_VBox2, Gtk::PackOptions::SHRINK);
- m_VBox2.pack_start(m_Button_Sort, Gtk::PackOptions::SHRINK);
+ m_HBox.add(m_VBox2);
+ m_VBox2.add(m_Button_Sort);
m_Button_Sort.signal_clicked().connect(sigc::mem_fun(*this, &ExampleWindow::on_sort_clicked));
- m_VBox2.pack_start(m_Button_ReverseSort, Gtk::PackOptions::SHRINK);
+ m_VBox2.add(m_Button_ReverseSort);
m_Button_ReverseSort.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_reverse_sort_clicked));
- m_VBox2.pack_start(m_Button_Change, Gtk::PackOptions::SHRINK);
+ m_VBox2.add(m_Button_Change);
m_Button_Change.signal_clicked().connect(sigc::mem_fun(*this, &ExampleWindow::on_change_clicked));
- m_VBox2.pack_start(m_Button_Filter, Gtk::PackOptions::SHRINK);
+ m_VBox2.add(m_Button_Filter);
m_Button_Filter.signal_clicked().connect(sigc::mem_fun(*this, &ExampleWindow::on_filter_clicked));
- m_VBox2.pack_start(m_Button_Unfilter, Gtk::PackOptions::SHRINK);
+ m_VBox2.add(m_Button_Unfilter);
m_Button_Unfilter.signal_clicked().connect(sigc::mem_fun(*this, &ExampleWindow::on_unfilter_clicked));
- m_VBox2.pack_start(m_Button_Add, Gtk::PackOptions::SHRINK);
+ m_VBox2.add(m_Button_Add);
m_Button_Add.signal_clicked().connect(sigc::mem_fun(*this, &ExampleWindow::on_add_clicked));
- m_VBox2.pack_start(m_Button_Separate, Gtk::PackOptions::SHRINK);
+ m_VBox2.add(m_Button_Separate);
m_Button_Separate.signal_clicked().connect(sigc::mem_fun(*this, &ExampleWindow::on_separate_clicked));
- m_VBox2.pack_start(m_Button_Unseparate, Gtk::PackOptions::SHRINK);
+ m_VBox2.add(m_Button_Unseparate);
m_Button_Unseparate.signal_clicked().connect(sigc::mem_fun(*this, &ExampleWindow::on_unseparate_clicked));
- m_VBox2.pack_start(m_Button_Visibility, Gtk::PackOptions::SHRINK);
+ m_VBox2.add(m_Button_Visibility);
m_Button_Visibility.signal_clicked().connect(sigc::mem_fun(*this, &ExampleWindow::on_visibility_clicked));
}
@@ -250,9 +250,9 @@ void ExampleWindow::update_header_func(Gtk::ListBoxRow* row, Gtk::ListBoxRow* be
{
auto hbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL);
auto label = Gtk::make_managed<Gtk::Label>("Header");
- hbox->pack_start(*label, Gtk::PackOptions::SHRINK);
+ hbox->add(*label);
auto button = Gtk::make_managed<Gtk::Button>("button");
- hbox->pack_start(*button, Gtk::PackOptions::SHRINK);
+ hbox->add(*button);
row->set_header(*hbox);
}
diff --git a/examples/book/menus/main_menu/examplewindow.cc b/examples/book/menus/main_menu/examplewindow.cc
index 7e6dbf9..b5e55b1 100644
--- a/examples/book/menus/main_menu/examplewindow.cc
+++ b/examples/book/menus/main_menu/examplewindow.cc
@@ -107,7 +107,7 @@ ExampleWindow::ExampleWindow()
if (!toolbar)
g_warning("GtkToolbar not found");
else
- m_Box.pack_start(*toolbar, Gtk::PackOptions::SHRINK);
+ m_Box.add(*toolbar);
}
ExampleWindow::~ExampleWindow()
diff --git a/examples/book/menus/popup/examplewindow.cc b/examples/book/menus/popup/examplewindow.cc
index 676e3ff..865b5d8 100644
--- a/examples/book/menus/popup/examplewindow.cc
+++ b/examples/book/menus/popup/examplewindow.cc
@@ -28,7 +28,8 @@ ExampleWindow::ExampleWindow()
add(m_Box);
// Catch button_press events:
- m_Box.pack_start(m_Label, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Box.add(m_Label);
+ m_Label.set_expand();
m_refGesture = Gtk::GestureMultiPress::create();
m_refGesture->set_button(GDK_BUTTON_SECONDARY);
m_refGesture->signal_pressed().connect(
diff --git a/examples/book/menus_and_toolbars/examplewindow.cc
b/examples/book/menus_and_toolbars/examplewindow.cc
index 8fa710d..f18771f 100644
--- a/examples/book/menus_and_toolbars/examplewindow.cc
+++ b/examples/book/menus_and_toolbars/examplewindow.cc
@@ -139,7 +139,7 @@ ExampleWindow::ExampleWindow(const Glib::RefPtr<Gtk::Application>& app)
auto pMenuBar = Gtk::make_managed<Gtk::MenuBar>(gmenu);
//Add the MenuBar to the window:
- m_Box.pack_start(*pMenuBar, Gtk::PackOptions::SHRINK);
+ m_Box.add(*pMenuBar);
}
//Get the toolbar and add it to a container widget:
@@ -148,7 +148,7 @@ ExampleWindow::ExampleWindow(const Glib::RefPtr<Gtk::Application>& app)
if (!toolbar)
g_warning("GtkToolbar not found");
else
- m_Box.pack_start(*toolbar, Gtk::PackOptions::SHRINK);
+ m_Box.add(*toolbar);
}
ExampleWindow::~ExampleWindow()
diff --git a/examples/book/multithread/examplewindow.cc b/examples/book/multithread/examplewindow.cc
index 27398e4..c8c3dd4 100644
--- a/examples/book/multithread/examplewindow.cc
+++ b/examples/book/multithread/examplewindow.cc
@@ -36,7 +36,7 @@ ExampleWindow::ExampleWindow() :
add(m_VBox);
// Add the ProgressBar.
- m_VBox.pack_start(m_ProgressBar, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ProgressBar);
m_ProgressBar.set_text("Fraction done");
m_ProgressBar.set_show_text();
@@ -46,17 +46,18 @@ ExampleWindow::ExampleWindow() :
// Only show the scrollbars when they are necessary.
m_ScrolledWindow.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC);
+ m_ScrolledWindow.set_expand();
- m_VBox.pack_start(m_ScrolledWindow, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.add(m_ScrolledWindow);
m_TextView.set_editable(false);
// Add the buttons to the ButtonBox.
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ButtonBox);
- m_ButtonBox.pack_start(m_ButtonStart, Gtk::PackOptions::SHRINK);
- m_ButtonBox.pack_start(m_ButtonStop, Gtk::PackOptions::SHRINK);
- m_ButtonBox.pack_start(m_ButtonQuit, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_ButtonStart);
+ m_ButtonBox.add(m_ButtonStop);
+ m_ButtonBox.add(m_ButtonQuit);
m_ButtonBox.set_margin(5);
m_ButtonBox.set_spacing(5);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
diff --git a/examples/book/notebook/examplewindow.cc b/examples/book/notebook/examplewindow.cc
index 51c53b7..9a8fa6d 100644
--- a/examples/book/notebook/examplewindow.cc
+++ b/examples/book/notebook/examplewindow.cc
@@ -31,10 +31,11 @@ ExampleWindow::ExampleWindow()
//Add the Notebook, with the button underneath:
m_Notebook.set_margin(10);
- m_VBox.pack_start(m_Notebook, Gtk::PackOptions::EXPAND_WIDGET);
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_Notebook.set_expand();
+ m_VBox.add(m_Notebook);
+ m_VBox.add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Quit);
m_Button_Quit.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_quit) );
diff --git a/examples/book/popover/examplewindow.cc b/examples/book/popover/examplewindow.cc
index 3e6d191..7fd16e3 100644
--- a/examples/book/popover/examplewindow.cc
+++ b/examples/book/popover/examplewindow.cc
@@ -36,8 +36,7 @@ ExampleWindow::ExampleWindow()
configure_form_popover();
// Calendar
- m_calendar.set_hexpand();
- m_calendar.set_vexpand();
+ m_calendar.set_expand();
// Calendar popover
configure_cal_popover();
@@ -84,18 +83,15 @@ void ExampleWindow::configure_form_buttons()
m_toggle_form_buttons[1].set_image_from_icon_name("format-justify-center-symbolic",
Gtk::IconSize::INHERIT, true);
m_toggle_form_buttons[2].set_image_from_icon_name("format-justify-right-symbolic", Gtk::IconSize::INHERIT,
true);
- m_toggle_form_buttons[0].set_draw_indicator(false);
- m_toggle_form_buttons[1].set_draw_indicator(false);
- m_toggle_form_buttons[2].set_draw_indicator(false);
-
m_toggle_form_buttons[1].join_group(m_toggle_form_buttons[0]);
m_toggle_form_buttons[2].join_group(m_toggle_form_buttons[0]);
- m_format_buttons_box.pack_start(m_toggle_form_buttons[0], Gtk::PackOptions::EXPAND_WIDGET);
- m_format_buttons_box.pack_start(m_toggle_form_buttons[1], Gtk::PackOptions::EXPAND_WIDGET);
- m_format_buttons_box.pack_start(m_toggle_form_buttons[2], Gtk::PackOptions::EXPAND_WIDGET);
-
- m_format_buttons_box.set_hexpand();
+ for (auto& button : m_toggle_form_buttons)
+ {
+ button.set_draw_indicator(false);
+ button.set_expand(true);
+ m_format_buttons_box.add(button);
+ }
// Group format buttons so that they appear that they belong together
auto style_context = m_format_buttons_box.get_style_context();
diff --git a/examples/book/printing/advanced/examplewindow.cc
b/examples/book/printing/advanced/examplewindow.cc
index 8c63b04..d5e27bb 100644
--- a/examples/book/printing/advanced/examplewindow.cc
+++ b/examples/book/printing/advanced/examplewindow.cc
@@ -40,9 +40,10 @@ ExampleWindow::ExampleWindow(const Glib::RefPtr<Gtk::Application>& app)
build_main_menu(app);
- m_VBox.pack_start(m_Grid, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.add(m_Grid);
//Arrange the widgets inside the grid:
+ m_Grid.set_expand(true);
m_Grid.set_row_spacing(5);
m_Grid.set_column_spacing(5);
m_Grid.attach(m_NameLabel, 0, 0);
@@ -59,13 +60,13 @@ ExampleWindow::ExampleWindow(const Glib::RefPtr<Gtk::Application>& app)
m_Grid.attach(m_CommentsLabel, 0, 2);
m_Grid.attach(m_ScrolledWindow, 1, 2);
- m_ScrolledWindow.set_hexpand(true);
- m_ScrolledWindow.set_vexpand(true);
+ m_ScrolledWindow.set_expand(true);
m_refTextBuffer = Gtk::TextBuffer::create();
m_TextView.set_buffer(m_refTextBuffer);
- m_VBox.pack_start(m_Statusbar, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Statusbar.set_expand(true);
+ m_VBox.add(m_Statusbar);
}
ExampleWindow::~ExampleWindow()
@@ -229,7 +230,7 @@ void ExampleWindow::build_main_menu(const Glib::RefPtr<Gtk::Application>& app)
auto pMenuBar = Gtk::make_managed<Gtk::MenuBar>(gmenu);
// Add the MenuBar to the window:
- m_VBox.pack_start(*pMenuBar, Gtk::PackOptions::SHRINK);
+ m_VBox.add(*pMenuBar);
}
// Get the toolbar and add it to a container widget:
@@ -238,7 +239,7 @@ void ExampleWindow::build_main_menu(const Glib::RefPtr<Gtk::Application>& app)
if (!toolbar)
g_warning("GtkToolbar not found");
else
- m_VBox.pack_start(*toolbar, Gtk::PackOptions::SHRINK);
+ m_VBox.add(*toolbar);
}
void ExampleWindow::on_printoperation_status_changed()
diff --git a/examples/book/printing/advanced/previewdialog.cc
b/examples/book/printing/advanced/previewdialog.cc
index 562383e..7bc582c 100644
--- a/examples/book/printing/advanced/previewdialog.cc
+++ b/examples/book/printing/advanced/previewdialog.cc
@@ -42,13 +42,15 @@ PreviewDialog::PreviewDialog(
m_VBox.set_margin(2);
add(m_VBox);
- m_HBox.pack_start(m_PageSpin, Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox.add(m_PageSpin);
+ m_PageSpin.set_hexpand(true);
m_PageSpin.set_vexpand(false);
- m_HBox.pack_start(m_CloseButton, Gtk::PackOptions::SHRINK);
- m_VBox.pack_start(m_HBox, Gtk::PackOptions::SHRINK);
+ m_HBox.add(m_CloseButton);
+ m_VBox.add(m_HBox);
m_ScrolledWindow.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC);
- m_VBox.pack_start(m_ScrolledWindow, Gtk::PackOptions::EXPAND_WIDGET);
+ m_ScrolledWindow.set_expand(true);
+ m_VBox.add(m_ScrolledWindow);
m_DrawingArea.set_content_width(300);
m_DrawingArea.set_content_height(600);
m_ScrolledWindow.add(m_DrawingArea);
diff --git a/examples/book/printing/advanced/printformoperation.cc
b/examples/book/printing/advanced/printformoperation.cc
index ff48fe6..2f216bd 100644
--- a/examples/book/printing/advanced/printformoperation.cc
+++ b/examples/book/printing/advanced/printformoperation.cc
@@ -158,14 +158,14 @@ Gtk::Widget* PrintFormOperation::on_create_custom_widget()
vbox->set_margin(12);
auto hbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL, 8);
- vbox->pack_start(*hbox, Gtk::PackOptions::SHRINK);
+ vbox->add(*hbox);
hbox->set_margin(6);
auto label = Gtk::make_managed<Gtk::Label>("Choose a font: ");
- hbox->pack_start(*label, Gtk::PackOptions::SHRINK);
+ hbox->add(*label);
m_FontButton.set_font(m_Font);
- hbox->pack_start(m_FontButton, Gtk::PackOptions::SHRINK);
+ hbox->add(m_FontButton);
return vbox;
}
diff --git a/examples/book/printing/simple/examplewindow.cc b/examples/book/printing/simple/examplewindow.cc
index 8c63b04..b46e94d 100644
--- a/examples/book/printing/simple/examplewindow.cc
+++ b/examples/book/printing/simple/examplewindow.cc
@@ -40,9 +40,10 @@ ExampleWindow::ExampleWindow(const Glib::RefPtr<Gtk::Application>& app)
build_main_menu(app);
- m_VBox.pack_start(m_Grid, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.add(m_Grid);
//Arrange the widgets inside the grid:
+ m_Grid.set_expand(true);
m_Grid.set_row_spacing(5);
m_Grid.set_column_spacing(5);
m_Grid.attach(m_NameLabel, 0, 0);
@@ -65,7 +66,8 @@ ExampleWindow::ExampleWindow(const Glib::RefPtr<Gtk::Application>& app)
m_refTextBuffer = Gtk::TextBuffer::create();
m_TextView.set_buffer(m_refTextBuffer);
- m_VBox.pack_start(m_Statusbar, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Statusbar.set_expand(true);
+ m_VBox.add(m_Statusbar);
}
ExampleWindow::~ExampleWindow()
@@ -229,7 +231,7 @@ void ExampleWindow::build_main_menu(const Glib::RefPtr<Gtk::Application>& app)
auto pMenuBar = Gtk::make_managed<Gtk::MenuBar>(gmenu);
// Add the MenuBar to the window:
- m_VBox.pack_start(*pMenuBar, Gtk::PackOptions::SHRINK);
+ m_VBox.add(*pMenuBar);
}
// Get the toolbar and add it to a container widget:
@@ -238,7 +240,7 @@ void ExampleWindow::build_main_menu(const Glib::RefPtr<Gtk::Application>& app)
if (!toolbar)
g_warning("GtkToolbar not found");
else
- m_VBox.pack_start(*toolbar, Gtk::PackOptions::SHRINK);
+ m_VBox.add(*toolbar);
}
void ExampleWindow::on_printoperation_status_changed()
diff --git a/examples/book/progressbar/examplewindow.cc b/examples/book/progressbar/examplewindow.cc
index 171781e..d336163 100644
--- a/examples/book/progressbar/examplewindow.cc
+++ b/examples/book/progressbar/examplewindow.cc
@@ -31,7 +31,7 @@ ExampleWindow::ExampleWindow()
m_VBox.set_margin(10);
add(m_VBox);
- m_VBox.pack_start(m_ProgressBar, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ProgressBar);
m_ProgressBar.set_margin_end(5);
m_ProgressBar.set_halign(Gtk::Align::CENTER);
m_ProgressBar.set_valign(Gtk::Align::CENTER);
@@ -43,8 +43,9 @@ ExampleWindow::ExampleWindow()
m_connection_timeout = Glib::signal_timeout().connect(sigc::mem_fun(*this,
&ExampleWindow::on_timeout), 50 );
- m_VBox.pack_start(m_Separator, Gtk::PackOptions::SHRINK);
- m_VBox.pack_start(m_Grid, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.add(m_Separator);
+ m_VBox.add(m_Grid);
+ m_Grid.set_expand(true);
m_Grid.set_row_homogeneous(true);
//Add a check button to select displaying of the trough text:
@@ -66,7 +67,7 @@ ExampleWindow::ExampleWindow()
&ExampleWindow::on_checkbutton_inverted) );
//Add a button to exit the program.
- m_VBox.pack_start(m_Button_Close, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Button_Close);
m_Button_Close.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_close) );
m_Button_Close.set_can_default();
diff --git a/examples/book/range_widgets/examplewindow.cc b/examples/book/range_widgets/examplewindow.cc
index 0bccefc..1f8b16a 100644
--- a/examples/book/range_widgets/examplewindow.cc
+++ b/examples/book/range_widgets/examplewindow.cc
@@ -65,24 +65,30 @@ ExampleWindow::ExampleWindow()
m_HScale.set_draw_value();
add(m_VBox_Top);
- m_VBox_Top.pack_start(m_VBox2, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox_Top.add(m_VBox2);
+ m_VBox2.set_expand(true);
m_VBox2.set_margin(10);
- m_VBox2.pack_start(m_HBox_Scales, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox2.add(m_HBox_Scales);
+ m_HBox_Scales.set_expand(true);
//Put VScale and HScale (above scrollbar) side-by-side.
- m_HBox_Scales.pack_start(m_VScale, Gtk::PackOptions::EXPAND_WIDGET);
- m_HBox_Scales.pack_start(m_VBox_HScale, Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox_Scales.add(m_VScale);
+ m_VScale.set_expand(true);
+ m_HBox_Scales.add(m_VBox_HScale);
+ m_VBox_HScale.set_expand(true);
- m_VBox_HScale.pack_start(m_HScale, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox_HScale.add(m_HScale);
+ m_HScale.set_expand(true);
//Scrollbar:
- m_VBox_HScale.pack_start(m_Scrollbar, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox_HScale.add(m_Scrollbar);
+ m_Scrollbar.set_expand(true);
//CheckButton:
m_CheckButton.set_active();
m_CheckButton.signal_toggled().connect( sigc::mem_fun(*this,
&ExampleWindow::on_checkbutton_toggled) );
- m_VBox2.pack_start(m_CheckButton, Gtk::PackOptions::SHRINK);
+ m_VBox2.add(m_CheckButton);
//Position ComboBox:
//Create the Tree model:
@@ -104,33 +110,33 @@ ExampleWindow::ExampleWindow()
row[m_Columns.m_col_position_type] = Gtk::PositionType::RIGHT;
row[m_Columns.m_col_title] = "Right";
- m_VBox2.pack_start(m_HBox_Combo, Gtk::PackOptions::SHRINK);
- m_HBox_Combo.pack_start(
- *Gtk::make_managed<Gtk::Label>("Scale Value Position:", 0), Gtk::PackOptions::SHRINK);
- m_HBox_Combo.pack_start(m_ComboBox_Position, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox2.add(m_HBox_Combo);
+ m_HBox_Combo.add(*Gtk::make_managed<Gtk::Label>("Scale Value Position:", 0));
+ m_HBox_Combo.add(m_ComboBox_Position);
m_ComboBox_Position.signal_changed().connect( sigc::mem_fun(*this, &ExampleWindow::on_combo_position) );
m_ComboBox_Position.set_active(0); // Top
+ m_ComboBox_Position.set_expand(true);
//Digits:
- m_HBox_Digits.pack_start(
- *Gtk::make_managed<Gtk::Label>("Scale Digits:", 0), Gtk::PackOptions::SHRINK);
+ m_HBox_Digits.add(*Gtk::make_managed<Gtk::Label>("Scale Digits:", 0));
m_Scale_Digits.set_digits(0);
+ m_Scale_Digits.set_expand(true);
m_adjustment_digits->signal_value_changed().connect(sigc::mem_fun(*this,
&ExampleWindow::on_adjustment1_value_changed));
- m_HBox_Digits.pack_start(m_Scale_Digits, Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox_Digits.add(m_Scale_Digits);
//Page Size:
- m_HBox_PageSize.pack_start(
- *Gtk::make_managed<Gtk::Label>("Scrollbar Page Size:", 0), Gtk::PackOptions::SHRINK);
+ m_HBox_PageSize.add(*Gtk::make_managed<Gtk::Label>("Scrollbar Page Size:", 0));
m_Scale_PageSize.set_digits(0);
+ m_Scale_PageSize.set_expand(true);
m_adjustment_pagesize->signal_value_changed().connect(sigc::mem_fun(*this,
&ExampleWindow::on_adjustment2_value_changed));
- m_HBox_PageSize.pack_start(m_Scale_PageSize, Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox_PageSize.add(m_Scale_PageSize);
- m_VBox2.pack_start(m_HBox_Digits, Gtk::PackOptions::SHRINK);
- m_VBox2.pack_start(m_HBox_PageSize, Gtk::PackOptions::SHRINK);
- m_VBox_Top.pack_start(m_Separator, Gtk::PackOptions::SHRINK);
- m_VBox_Top.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
+ m_VBox2.add(m_HBox_Digits);
+ m_VBox2.add(m_HBox_PageSize);
+ m_VBox_Top.add(m_Separator);
+ m_VBox_Top.add(m_Button_Quit);
m_Button_Quit.set_can_default();
m_Button_Quit.grab_default();
diff --git a/examples/book/recent_files/examplewindow.cc b/examples/book/recent_files/examplewindow.cc
index b1523a7..dd98c97 100644
--- a/examples/book/recent_files/examplewindow.cc
+++ b/examples/book/recent_files/examplewindow.cc
@@ -125,7 +125,7 @@ ExampleWindow::ExampleWindow(const Glib::RefPtr<Gtk::Application>& app)
{
//Menubar:
auto pMenubar = Gtk::make_managed<Gtk::MenuBar>(gmenu);
- m_Box.pack_start(*pMenubar, Gtk::PackOptions::SHRINK);
+ m_Box.add(*pMenubar);
}
else
g_warning("GMenu not found");
@@ -134,7 +134,7 @@ ExampleWindow::ExampleWindow(const Glib::RefPtr<Gtk::Application>& app)
m_refBuilder->get_widget("toolbar", pToolbar);
if (pToolbar)
//Toolbar:
- m_Box.pack_start(*pToolbar, Gtk::PackOptions::SHRINK);
+ m_Box.add(*pToolbar);
else
g_warning("GtkToolbar not found");
}
diff --git a/examples/book/revealer/examplewindow.cc b/examples/book/revealer/examplewindow.cc
index 068b8aa..a4b299d 100644
--- a/examples/book/revealer/examplewindow.cc
+++ b/examples/book/revealer/examplewindow.cc
@@ -52,11 +52,12 @@ ExampleWindow::ExampleWindow()
// Layout
m_controls.set_row_spacing(6);
m_controls.set_column_spacing(12);
- m_vbox.pack_start(m_controls, Gtk::PackOptions::SHRINK);
- m_vbox.pack_start(m_separator, Gtk::PackOptions::SHRINK);
+ m_vbox.add(m_controls);
+ m_vbox.add(m_separator);
m_separator.set_margin_start(12);
m_separator.set_margin_end(18);
- m_vbox.pack_start(m_revealer, Gtk::PackOptions::EXPAND_WIDGET);
+ m_vbox.add(m_revealer);
+ m_revealer.set_expand(true);
m_vbox.set_margin(12);
add(m_vbox);
}
diff --git a/examples/book/scrolledwindow/examplewindow.cc b/examples/book/scrolledwindow/examplewindow.cc
index 2240628..323f706 100644
--- a/examples/book/scrolledwindow/examplewindow.cc
+++ b/examples/book/scrolledwindow/examplewindow.cc
@@ -30,8 +30,9 @@ ExampleWindow::ExampleWindow()
* there. The first one is the horizontal scrollbar, the second,
* the vertical. */
m_ScrolledWindow.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::ALWAYS);
+ m_ScrolledWindow.set_expand();
- get_content_area()->pack_start(m_ScrolledWindow, Gtk::PackOptions::EXPAND_WIDGET);
+ get_content_area()->add(m_ScrolledWindow);
/* set the spacing to 10 on x and 10 on y */
m_Grid.set_row_spacing(10);
diff --git a/examples/book/searchbar/examplewindow.cc b/examples/book/searchbar/examplewindow.cc
index 721aa88..a36a725 100644
--- a/examples/book/searchbar/examplewindow.cc
+++ b/examples/book/searchbar/examplewindow.cc
@@ -57,10 +57,11 @@ ExampleWindow::ExampleWindow()
m_options_grid.attach(m_close_button_switch, 1, 1);
// Searchbar Layout
- m_up_down_box.pack_start(m_go_down_button, Gtk::PackOptions::SHRINK);
- m_up_down_box.pack_start(m_go_up_button, Gtk::PackOptions::SHRINK);
- m_search_box.pack_end(m_up_down_box, Gtk::PackOptions::SHRINK);
- m_search_box.pack_start(m_entry, Gtk::PackOptions::EXPAND_WIDGET);
+ m_search_box.add(m_entry);
+ m_entry.set_expand();
+ m_up_down_box.add(m_go_down_button);
+ m_up_down_box.add(m_go_up_button);
+ m_search_box.add(m_up_down_box);
m_search_box.set_spacing(6);
m_search_bar.add(m_search_box);
@@ -73,12 +74,12 @@ ExampleWindow::ExampleWindow()
m_go_down_button.set_image_from_icon_name("go-down-symbolic", Gtk::IconSize::INHERIT, true);
m_vbox.set_spacing(6);
- m_vbox.pack_start(m_search_bar, Gtk::PackOptions::SHRINK);
- m_vbox.pack_start(m_label, Gtk::PackOptions::SHRINK);
- m_vbox.pack_start(m_separator, Gtk::PackOptions::SHRINK);
+ m_vbox.add(m_search_bar);
+ m_vbox.add(m_label);
+ m_vbox.add(m_separator);
m_separator.set_margin_start(6);
m_separator.set_margin_end(6);
- m_vbox.pack_start(m_options_grid, Gtk::PackOptions::SHRINK);
+ m_vbox.add(m_options_grid);
m_options_grid.set_margin_start(6);
m_options_grid.set_margin_end(6);
m_vbox.set_margin(12);
diff --git a/examples/book/spinbutton/examplewindow.cc b/examples/book/spinbutton/examplewindow.cc
index 2f15186..18bae97 100644
--- a/examples/book/spinbutton/examplewindow.cc
+++ b/examples/book/spinbutton/examplewindow.cc
@@ -56,7 +56,7 @@ ExampleWindow::ExampleWindow()
m_VBox_Main.set_margin(10);
add(m_VBox_Main);
- m_VBox_Main.pack_start(m_Frame_NotAccelerated, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox_Main.add(m_Frame_NotAccelerated);
m_VBox.set_margin(5);
m_Frame_NotAccelerated.add(m_VBox);
@@ -64,91 +64,104 @@ ExampleWindow::ExampleWindow()
/* Day, month, year spinners */
m_VBox.set_spacing(5);
- m_VBox.pack_start(m_HBox_NotAccelerated, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.add(m_HBox_NotAccelerated);
- m_VBox_Day.pack_start(m_Label_Day, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Label_Day.set_expand();
+ m_VBox_Day.add(m_Label_Day);
m_SpinButton_Day.set_wrap();
-
- m_VBox_Day.pack_start(m_SpinButton_Day, Gtk::PackOptions::EXPAND_WIDGET);
+ m_SpinButton_Day.set_expand();
+ m_VBox_Day.add(m_SpinButton_Day);
m_HBox_NotAccelerated.set_spacing(5);
- m_HBox_NotAccelerated.pack_start(m_VBox_Day, Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox_NotAccelerated.add(m_VBox_Day);
- m_VBox_Month.pack_start(m_Label_Month, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Label_Month.set_expand();
+ m_VBox_Month.add(m_Label_Month);
m_SpinButton_Month.set_wrap();
- m_VBox_Month.pack_start(m_SpinButton_Month, Gtk::PackOptions::EXPAND_WIDGET);
+ m_SpinButton_Month.set_expand();
+ m_VBox_Month.add(m_SpinButton_Month);
- m_HBox_NotAccelerated.pack_start(m_VBox_Month, Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox_NotAccelerated.add(m_VBox_Month);
- m_VBox_Year.pack_start(m_Label_Year, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Label_Year.set_expand();
+ m_VBox_Year.add(m_Label_Year);
m_SpinButton_Year.set_wrap();
+ m_SpinButton_Year.set_expand();
m_SpinButton_Year.set_size_request(55, -1);
- m_VBox_Year.pack_start(m_SpinButton_Year, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox_Year.add(m_SpinButton_Year);
- m_HBox_NotAccelerated.pack_start(m_VBox_Year, Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox_NotAccelerated.add(m_VBox_Year);
//Accelerated:
- m_VBox_Main.pack_start(m_Frame_Accelerated, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox_Main.add(m_Frame_Accelerated);
m_VBox_Accelerated.set_margin(5);
m_Frame_Accelerated.add(m_VBox_Accelerated);
m_VBox_Accelerated.set_spacing(5);
- m_VBox_Accelerated.pack_start(m_HBox_Accelerated, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox_Accelerated.add(m_HBox_Accelerated);
- m_HBox_Accelerated.pack_start(m_VBox_Value, Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox_Accelerated.add(m_VBox_Value);
- m_VBox_Value.pack_start(m_Label_Value, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Label_Value.set_expand();
+ m_VBox_Value.add(m_Label_Value);
m_SpinButton_Value.set_wrap();
+ m_SpinButton_Value.set_expand();
m_SpinButton_Value.set_size_request(100, -1);
- m_VBox_Value.pack_start(m_SpinButton_Value, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox_Value.add(m_SpinButton_Value);
- m_HBox_Accelerated.pack_start(m_VBox_Digits, Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox_Accelerated.add(m_VBox_Digits);
- m_VBox_Digits.pack_start(m_Label_Digits, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox_Digits.add(m_Label_Digits);
+ m_Label_Digits.set_expand();
m_SpinButton_Digits.set_wrap();
m_adjustment_digits->signal_value_changed().connect( sigc::mem_fun(*this,
&ExampleWindow::on_spinbutton_digits_changed) );
- m_VBox_Digits.pack_start(m_SpinButton_Digits, Gtk::PackOptions::EXPAND_WIDGET);
-
+ m_VBox_Digits.add(m_SpinButton_Digits);
+ m_SpinButton_Digits.set_expand();
//CheckButtons:
- m_VBox_Accelerated.pack_start(m_CheckButton_Snap, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox_Accelerated.add(m_CheckButton_Snap);
+ m_CheckButton_Snap.set_expand();
m_CheckButton_Snap.set_active();
m_CheckButton_Snap.signal_clicked().connect( sigc::mem_fun(*this,
&ExampleWindow::on_checkbutton_snap) );
- m_VBox_Accelerated.pack_start(m_CheckButton_Numeric, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox_Accelerated.add(m_CheckButton_Numeric);
+ m_CheckButton_Numeric.set_expand();
m_CheckButton_Numeric.set_active();
m_CheckButton_Numeric.signal_clicked().connect( sigc::mem_fun(*this,
&ExampleWindow::on_checkbutton_numeric) );
//Buttons:
- m_VBox_Accelerated.pack_start (m_HBox_Buttons, Gtk::PackOptions::SHRINK);
+ m_VBox_Accelerated.add(m_HBox_Buttons);
m_Button_Int.signal_clicked().connect( sigc::bind( sigc::mem_fun(*this,
&ExampleWindow::on_button_getvalue), VALUE_FORMAT_INT) );
m_HBox_Buttons.set_spacing(5);
- m_HBox_Buttons.pack_start(m_Button_Int, Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox_Buttons.add(m_Button_Int);
+ m_Button_Int.set_expand();
m_Button_Float.signal_clicked().connect( sigc::bind( sigc::mem_fun(*this,
&ExampleWindow::on_button_getvalue), VALUE_FORMAT_FLOAT) );
- m_HBox_Buttons.pack_start(m_Button_Float, Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox_Buttons.add(m_Button_Float);
+ m_Button_Float.set_expand();
- m_VBox_Accelerated.pack_start(m_Label_ShowValue, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox_Accelerated.add(m_Label_ShowValue);
+ m_Label_ShowValue.set_expand();
m_Label_ShowValue.set_text("0");
//Close button:
m_Button_Close.signal_clicked().connect( sigc::mem_fun(*this,
&ExampleWindow::on_button_close) );
- m_VBox_Main.pack_start(m_Button_Close, Gtk::PackOptions::SHRINK);
+ m_VBox_Main.add(m_Button_Close);
}
ExampleWindow::~ExampleWindow()
diff --git a/examples/book/textview/examplewindow.cc b/examples/book/textview/examplewindow.cc
index 13a03ca..48a346a 100644
--- a/examples/book/textview/examplewindow.cc
+++ b/examples/book/textview/examplewindow.cc
@@ -33,15 +33,16 @@ ExampleWindow::ExampleWindow()
//Only show the scrollbars when they are necessary:
m_ScrolledWindow.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC);
+ m_ScrolledWindow.set_expand();
- m_VBox.pack_start(m_ScrolledWindow, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.add(m_ScrolledWindow);
//Add buttons:
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_Buffer1, Gtk::PackOptions::SHRINK);
- m_ButtonBox.pack_start(m_Button_Buffer2, Gtk::PackOptions::SHRINK);
- m_ButtonBox.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Buffer1);
+ m_ButtonBox.add(m_Button_Buffer2);
+ m_ButtonBox.add(m_Button_Quit);
m_ButtonBox.set_margin(5);
m_ButtonBox.set_spacing(5);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
diff --git a/examples/book/timeout/timerexample.cc b/examples/book/timeout/timerexample.cc
index f33d1d5..dc18e5d 100644
--- a/examples/book/timeout/timerexample.cc
+++ b/examples/book/timeout/timerexample.cc
@@ -27,9 +27,11 @@ TimerExample::TimerExample() :
{
m_Box.set_margin(10);
add(m_Box);
- m_Box.pack_start(m_ButtonAddTimer, Gtk::PackOptions::EXPAND_WIDGET);
- m_Box.pack_start(m_ButtonDeleteTimer, Gtk::PackOptions::EXPAND_WIDGET);
- m_Box.pack_start(m_ButtonQuit, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Box.add(m_ButtonAddTimer);
+ m_Box.add(m_ButtonDeleteTimer);
+ m_Box.add(m_ButtonQuit);
+ for (auto child : m_Box.get_children())
+ child->set_expand();
// Connect the three buttons:
m_ButtonQuit.signal_clicked().connect(sigc::mem_fun(*this,
diff --git a/examples/book/toolbar/examplewindow.cc b/examples/book/toolbar/examplewindow.cc
index d17c703..dbc552a 100644
--- a/examples/book/toolbar/examplewindow.cc
+++ b/examples/book/toolbar/examplewindow.cc
@@ -28,12 +28,12 @@ ExampleWindow::ExampleWindow()
add(m_VBox);
//Put a toolbar at the top, and a button underneath:
- m_VBox.pack_start(m_Toolbar, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Toolbar);
m_ButtonBox.set_margin(5);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
- m_VBox.pack_end(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_Close, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Close);
m_Button_Close.signal_clicked().connect( sigc::mem_fun(*this,
&ExampleWindow::on_button_close) );
diff --git a/examples/book/tooltips/examplewindow.cc b/examples/book/tooltips/examplewindow.cc
index 59df6be..b15538a 100644
--- a/examples/book/tooltips/examplewindow.cc
+++ b/examples/book/tooltips/examplewindow.cc
@@ -38,11 +38,11 @@ ExampleWindow::ExampleWindow()
//Check button with markup in tooltip:
m_checkbutton.set_tooltip_text(non_markedup_tip);
- m_vbox.pack_start(m_checkbutton, Gtk::PackOptions::SHRINK);
+ m_vbox.add(m_checkbutton);
//Label:
m_label.set_tooltip_text("Another tooltip");
- m_vbox.pack_start(m_label, Gtk::PackOptions::SHRINK);
+ m_vbox.add(m_label);
//Textview:
prepare_textview();
@@ -51,7 +51,7 @@ ExampleWindow::ExampleWindow()
// set_tooltip_window(), like set_tooltip_text(),
// will call set_has_tooltip() for us.
m_button.set_tooltip_window(m_button_tooltip_window);
- m_vbox.pack_start(m_button, Gtk::PackOptions::SHRINK);
+ m_vbox.add(m_button);
//Button's custom tooltip window:
m_button_tooltip_window.set_default_size(250, 30);
@@ -74,7 +74,8 @@ void ExampleWindow::prepare_textview()
//Set up a scrolled window:
m_scrolled_window.add(m_text_view);
m_scrolled_window.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC);
- m_vbox.pack_start(m_scrolled_window, Gtk::PackOptions::EXPAND_WIDGET);
+ m_scrolled_window.set_expand();
+ m_vbox.add(m_scrolled_window);
//Create a text buffer with some text:
m_ref_text_buffer = Gtk::TextBuffer::create();
diff --git a/examples/book/treeview/combo_renderer/examplewindow.cc
b/examples/book/treeview/combo_renderer/examplewindow.cc
index cb04172..2f9b03d 100644
--- a/examples/book/treeview/combo_renderer/examplewindow.cc
+++ b/examples/book/treeview/combo_renderer/examplewindow.cc
@@ -32,11 +32,12 @@ ExampleWindow::ExampleWindow()
//Only show the scrollbars when they are necessary:
m_ScrolledWindow.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC);
+ m_ScrolledWindow.set_expand();
- m_VBox.pack_start(m_ScrolledWindow, Gtk::PackOptions::EXPAND_WIDGET);
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ScrolledWindow);
+ m_VBox.add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Quit);
m_ButtonBox.set_margin(5);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
m_Button_Quit.signal_clicked().connect( sigc::mem_fun(*this,
diff --git a/examples/book/treeview/drag_and_drop/examplewindow.cc
b/examples/book/treeview/drag_and_drop/examplewindow.cc
index 4c7fce5..b630043 100644
--- a/examples/book/treeview/drag_and_drop/examplewindow.cc
+++ b/examples/book/treeview/drag_and_drop/examplewindow.cc
@@ -32,11 +32,12 @@ ExampleWindow::ExampleWindow()
//Only show the scrollbars when they are necessary:
m_ScrolledWindow.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC);
+ m_ScrolledWindow.set_expand();
- m_VBox.pack_start(m_ScrolledWindow, Gtk::PackOptions::EXPAND_WIDGET);
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ScrolledWindow);
+ m_VBox.add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Quit);
m_ButtonBox.set_margin(5);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
m_Button_Quit.signal_clicked().connect(sigc::mem_fun(*this,
diff --git a/examples/book/treeview/editable_cells/examplewindow.cc
b/examples/book/treeview/editable_cells/examplewindow.cc
index efda765..3d4cc36 100644
--- a/examples/book/treeview/editable_cells/examplewindow.cc
+++ b/examples/book/treeview/editable_cells/examplewindow.cc
@@ -38,11 +38,12 @@ ExampleWindow::ExampleWindow()
//Only show the scrollbars when they are necessary:
m_ScrolledWindow.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC);
+ m_ScrolledWindow.set_expand();
- m_VBox.pack_start(m_ScrolledWindow, Gtk::PackOptions::EXPAND_WIDGET);
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ScrolledWindow);
+ m_VBox.add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Quit);
m_ButtonBox.set_margin(5);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
m_Button_Quit.signal_clicked().connect( sigc::mem_fun(*this,
diff --git a/examples/book/treeview/filter/examplewindow.cc b/examples/book/treeview/filter/examplewindow.cc
index bf6830a..fbeaee8 100644
--- a/examples/book/treeview/filter/examplewindow.cc
+++ b/examples/book/treeview/filter/examplewindow.cc
@@ -32,11 +32,12 @@ ExampleWindow::ExampleWindow()
//Only show the scrollbars when they are necessary:
m_ScrolledWindow.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC);
+ m_ScrolledWindow.set_expand();
- m_VBox.pack_start(m_ScrolledWindow, Gtk::PackOptions::EXPAND_WIDGET);
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ScrolledWindow);
+ m_VBox.add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Quit);
m_ButtonBox.set_margin(5);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
m_Button_Quit.signal_clicked().connect( sigc::mem_fun(*this,
diff --git a/examples/book/treeview/filter_modify/examplewindow.cc
b/examples/book/treeview/filter_modify/examplewindow.cc
index 340b4ea..bdb76fe 100644
--- a/examples/book/treeview/filter_modify/examplewindow.cc
+++ b/examples/book/treeview/filter_modify/examplewindow.cc
@@ -32,11 +32,12 @@ ExampleWindow::ExampleWindow()
//Only show the scrollbars when they are necessary:
m_ScrolledWindow.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC);
+ m_ScrolledWindow.set_expand();
- m_VBox.pack_start(m_ScrolledWindow, Gtk::PackOptions::EXPAND_WIDGET);
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ScrolledWindow);
+ m_VBox.add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Quit);
m_ButtonBox.set_margin(5);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
m_Button_Quit.signal_clicked().connect( sigc::mem_fun(*this,
diff --git a/examples/book/treeview/list/examplewindow.cc b/examples/book/treeview/list/examplewindow.cc
index 052c329..89ce3d2 100644
--- a/examples/book/treeview/list/examplewindow.cc
+++ b/examples/book/treeview/list/examplewindow.cc
@@ -32,11 +32,12 @@ ExampleWindow::ExampleWindow()
//Only show the scrollbars when they are necessary:
m_ScrolledWindow.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC);
+ m_ScrolledWindow.set_expand();
- m_VBox.pack_start(m_ScrolledWindow, Gtk::PackOptions::EXPAND_WIDGET);
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ScrolledWindow);
+ m_VBox.add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Quit);
m_ButtonBox.set_margin(5);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
m_Button_Quit.signal_clicked().connect( sigc::mem_fun(*this,
diff --git a/examples/book/treeview/listviewtext/examplewindow.cc
b/examples/book/treeview/listviewtext/examplewindow.cc
index 168f4e5..300d839 100644
--- a/examples/book/treeview/listviewtext/examplewindow.cc
+++ b/examples/book/treeview/listviewtext/examplewindow.cc
@@ -33,11 +33,12 @@ ExampleWindow::ExampleWindow()
//Only show the scrollbars when they are necessary:
m_ScrolledWindow.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC);
+ m_ScrolledWindow.set_expand();
- m_VBox.pack_start(m_ScrolledWindow, Gtk::PackOptions::EXPAND_WIDGET);
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ScrolledWindow);
+ m_VBox.add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Quit);
m_ButtonBox.set_margin(5);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
m_Button_Quit.signal_clicked().connect( sigc::mem_fun(*this,
diff --git a/examples/book/treeview/modelsort/examplewindow.cc
b/examples/book/treeview/modelsort/examplewindow.cc
index 8c37da6..0d4d2c8 100644
--- a/examples/book/treeview/modelsort/examplewindow.cc
+++ b/examples/book/treeview/modelsort/examplewindow.cc
@@ -35,12 +35,14 @@ ExampleWindow::ExampleWindow()
//Only show the scrollbars when they are necessary:
m_ScrolledWindow1.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC);
m_ScrolledWindow2.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC);
+ m_ScrolledWindow1.set_expand();
+ m_ScrolledWindow2.set_expand();
- m_VBox.pack_start(m_ScrolledWindow1, Gtk::PackOptions::EXPAND_WIDGET);
- m_VBox.pack_start(m_ScrolledWindow2, Gtk::PackOptions::EXPAND_WIDGET);
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ScrolledWindow1);
+ m_VBox.add(m_ScrolledWindow2);
+ m_VBox.add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Quit);
m_ButtonBox.set_margin(5);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
m_Button_Quit.signal_clicked().connect( sigc::mem_fun(*this,
diff --git a/examples/book/treeview/popup/examplewindow.cc b/examples/book/treeview/popup/examplewindow.cc
index 2a342f7..8a05f63 100644
--- a/examples/book/treeview/popup/examplewindow.cc
+++ b/examples/book/treeview/popup/examplewindow.cc
@@ -32,11 +32,12 @@ ExampleWindow::ExampleWindow()
//Only show the scrollbars when they are necessary:
m_ScrolledWindow.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC);
+ m_ScrolledWindow.set_expand();
- m_VBox.pack_start(m_ScrolledWindow, Gtk::PackOptions::EXPAND_WIDGET);
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ScrolledWindow);
+ m_VBox.add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Quit);
m_ButtonBox.set_margin(5);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
m_Button_Quit.signal_clicked().connect( sigc::mem_fun(*this,
diff --git a/examples/book/treeview/tree/examplewindow.cc b/examples/book/treeview/tree/examplewindow.cc
index f112d05..4264120 100644
--- a/examples/book/treeview/tree/examplewindow.cc
+++ b/examples/book/treeview/tree/examplewindow.cc
@@ -32,11 +32,12 @@ ExampleWindow::ExampleWindow()
//Only show the scrollbars when they are necessary:
m_ScrolledWindow.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC);
+ m_ScrolledWindow.set_expand();
- m_VBox.pack_start(m_ScrolledWindow, Gtk::PackOptions::EXPAND_WIDGET);
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ScrolledWindow);
+ m_VBox.add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Quit);
m_ButtonBox.set_margin(5);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
m_Button_Quit.signal_clicked().connect(sigc::mem_fun(*this,
diff --git a/examples/book/update_ui/examplewindow.cc b/examples/book/update_ui/examplewindow.cc
index 09bc121..8504e8a 100644
--- a/examples/book/update_ui/examplewindow.cc
+++ b/examples/book/update_ui/examplewindow.cc
@@ -28,11 +28,11 @@ ExampleWindow::ExampleWindow()
m_VBox.set_margin(6);
add(m_VBox);
- m_VBox.pack_start(m_ProgressBar, Gtk::PackOptions::SHRINK);
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ProgressBar);
+ m_VBox.add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
- m_ButtonBox.pack_start(m_Button_Start, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Quit);
+ m_ButtonBox.add(m_Button_Start);
m_ButtonBox.set_margin(6);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
m_Button_Quit.signal_clicked().connect(sigc::mem_fun(*this,
diff --git a/examples/others/calendar/calendar.cc b/examples/others/calendar/calendar.cc
index 71ff7e6..28b7b5c 100644
--- a/examples/others/calendar/calendar.cc
+++ b/examples/others/calendar/calendar.cc
@@ -184,16 +184,16 @@ CalendarExample::CalendarExample()
*/
auto hbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL, DEF_PAD);
- vbox->pack_start(*hbox, Gtk::PackOptions::EXPAND_WIDGET);
+ vbox->add(*hbox);
auto hbbox = Gtk::make_managed<Gtk::ButtonBox>();
- hbox->pack_start(*hbbox, Gtk::PackOptions::SHRINK);
+ hbox->add(*hbbox);
hbbox->set_margin_end(DEF_PAD);
hbbox->set_layout(Gtk::ButtonBoxStyle::SPREAD);
hbbox->set_spacing(5);
/* Calendar widget */
auto frame = Gtk::make_managed<Gtk::Frame>("Calendar");
- hbbox->pack_start(*frame, Gtk::PackOptions::EXPAND_WIDGET);
+ hbbox->add(*frame);
frame->set_margin_start(DEF_PAD);
frame->set_margin_end(DEF_PAD);
calendar_ = new Gtk::Calendar();
@@ -205,17 +205,17 @@ CalendarExample::CalendarExample()
calendar_->signal_day_selected_double_click().connect(sigc::mem_fun(*this,
&CalendarExample::day_selected_double_click));
auto separator = Gtk::make_managed<Gtk::Separator>(Gtk::Orientation::VERTICAL);
- hbox->pack_start (*separator, Gtk::PackOptions::SHRINK);
+ hbox->add(*separator);
auto vbox2 = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL, DEF_PAD);
- hbox->pack_start(*vbox2, Gtk::PackOptions::SHRINK);
+ hbox->add(*vbox2);
vbox2->set_margin_start(DEF_PAD);
vbox2->set_margin_end(DEF_PAD);
/* Build the Right frame with the flags in */
auto frameFlags = Gtk::make_managed<Gtk::Frame>("Flags");
- vbox2->pack_start(*frameFlags, Gtk::PackOptions::EXPAND_WIDGET);
+ vbox2->add(*frameFlags);
frameFlags->set_margin_end(DEF_PAD);
auto vbox3 = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL, DEF_PAD_SMALL);
frameFlags->add(*vbox3);
@@ -235,14 +235,14 @@ CalendarExample::CalendarExample()
{
auto toggle = new Gtk::CheckButton(flags[i].label);
toggle->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CalendarExample::toggle_flag),
toggle));
- vbox3->pack_start(*toggle, Gtk::PackOptions::EXPAND_WIDGET);
+ vbox3->add(*toggle);
flag_checkboxes_[i] = toggle;
}
/* Build the right font-button */
font_button_ = Gtk::make_managed<Gtk::FontButton>();
font_button_->signal_font_set().connect(sigc::mem_fun(*this, &CalendarExample::on_font_button_font_set));
- vbox2->pack_start(*font_button_, Gtk::PackOptions::SHRINK);
+ vbox2->add(*font_button_);
// Add a StyleProvider to the Gtk::Calendar, so we can change the font.
// This was easier before Gtk::Widget::override_font() was deprecated.
@@ -259,33 +259,33 @@ CalendarExample::CalendarExample()
* Build the Signal-event part.
*/
frame = Gtk::make_managed<Gtk::Frame>("Signal events");
- vbox->pack_start(*frame, Gtk::PackOptions::EXPAND_WIDGET);
+ vbox->add(*frame);
vbox2 = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL, DEF_PAD_SMALL);
frame->add(*vbox2);
hbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL, 5);
- vbox2->pack_start (*hbox, Gtk::PackOptions::SHRINK);
+ vbox2->add(*hbox);
auto label = Gtk::make_managed<Gtk::Label>("Day selected:");
- hbox->pack_start (*label, Gtk::PackOptions::SHRINK);
+ hbox->add(*label);
label_selected_ = new Gtk::Label("");
- hbox->pack_start (*label_selected_, Gtk::PackOptions::SHRINK);
+ hbox->add(*label_selected_);
hbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL, 5);
- vbox2->pack_start (*hbox, Gtk::PackOptions::SHRINK);
+ vbox2->add(*hbox);
label = Gtk::make_managed<Gtk::Label>("Day selected double click:");
- hbox->pack_start (*label, Gtk::PackOptions::SHRINK);
+ hbox->add(*label);
label_selected_double_click_ = new Gtk::Label("");
- hbox->pack_start (*label_selected_double_click_, Gtk::PackOptions::SHRINK);
+ hbox->add(*label_selected_double_click_);
hbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL, 5);
- vbox2->pack_start (*hbox, Gtk::PackOptions::SHRINK);
+ vbox2->add(*hbox);
label = Gtk::make_managed<Gtk::Label>("Month change:");
- hbox->pack_start (*label, Gtk::PackOptions::SHRINK);
+ hbox->add(*label);
label_month_ = new Gtk::Label("");
- hbox->pack_start(*label_month_, Gtk::PackOptions::SHRINK);
+ hbox->add(*label_month_);
auto bbox = Gtk::make_managed<Gtk::ButtonBox>();
- vbox->pack_start(*bbox, Gtk::PackOptions::SHRINK);
+ vbox->add(*bbox);
bbox->set_layout(Gtk::ButtonBoxStyle::END);
auto button = Gtk::make_managed<Gtk::Button>("Close");
diff --git a/examples/others/cellrenderercustom/popupentry.cc
b/examples/others/cellrenderercustom/popupentry.cc
index 800d57e..5632e43 100644
--- a/examples/others/cellrenderercustom/popupentry.cc
+++ b/examples/others/cellrenderercustom/popupentry.cc
@@ -30,11 +30,12 @@ PopupEntry::PopupEntry(const Glib::ustring& path)
editing_canceled_ (false)
{
entry_ = new Gtk::Entry();
- pack_start(*Gtk::manage(entry_), Gtk::PackOptions::EXPAND_WIDGET);
+ add(*Gtk::manage(entry_));
entry_->set_has_frame(false);
+ entry_->set_expand(true);
button_ = new Gtk::Button();
- pack_start(*Gtk::manage(button_), Gtk::PackOptions::SHRINK);
+ add(*Gtk::manage(button_));
button_->set_image_from_icon_name("pan-down-symbolic", Gtk::IconSize::INHERIT, true);
set_can_focus();
diff --git a/examples/others/idle/idle.cc b/examples/others/idle/idle.cc
index 0bb4fdc..db9283b 100644
--- a/examples/others/idle/idle.cc
+++ b/examples/others/idle/idle.cc
@@ -43,19 +43,22 @@ IdleExample::IdleExample() :
auto vbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL,5);
// adding a few widgets
- vbox->pack_start(*Gtk::make_managed<Gtk::Label>("Formatting windows drive C:"));
- vbox->pack_start(*Gtk::make_managed<Gtk::Label>("100 MB"));
- vbox->pack_start(m_progressbar_c, Gtk::PackOptions::EXPAND_WIDGET);
+ vbox->add(*Gtk::make_managed<Gtk::Label>("Formatting windows drive C:"));
+ vbox->add(*Gtk::make_managed<Gtk::Label>("100 MB"));
+ vbox->add(m_progressbar_c);
+ m_progressbar_c.set_expand();
- vbox->pack_start(*Gtk::make_managed<Gtk::Label>(""));
+ vbox->add(*Gtk::make_managed<Gtk::Label>(""));
- vbox->pack_start(*Gtk::make_managed<Gtk::Label>("Formatting windows drive D:"));
- vbox->pack_start(*Gtk::make_managed<Gtk::Label>("5000 MB"));
- vbox->pack_start(m_progressbar_d, Gtk::PackOptions::EXPAND_WIDGET);
+ vbox->add(*Gtk::make_managed<Gtk::Label>("Formatting windows drive D:"));
+ vbox->add(*Gtk::make_managed<Gtk::Label>("5000 MB"));
+ vbox->add(m_progressbar_d);
+ m_progressbar_d.set_expand();
auto hbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL,10);
- hbox->pack_start(m_quit, Gtk::PackOptions::EXPAND_PADDING);
- vbox->pack_start(*hbox, Gtk::PackOptions::EXPAND_WIDGET);
+ hbox->add(m_quit);
+ m_quit.set_expand();
+ vbox->add(*hbox);
// set margin and display all
vbox->set_margin(5);
diff --git a/examples/others/statusbar/statusbar.cc b/examples/others/statusbar/statusbar.cc
index 649e40f..0a44a67 100644
--- a/examples/others/statusbar/statusbar.cc
+++ b/examples/others/statusbar/statusbar.cc
@@ -37,13 +37,16 @@ StatusBarExample::StatusBarExample()
add(m_vbox);
- m_vbox.pack_start(m_status_bar, Gtk::PackOptions::EXPAND_WIDGET);
+ m_vbox.add(m_status_bar);
+ m_status_bar.set_expand();
m_bPush.signal_clicked().connect( sigc::bind(sigc::mem_fun(*this, &StatusBarExample::push_item),
m_context_id) );
- m_vbox.pack_start(m_bPush, Gtk::PackOptions::EXPAND_WIDGET);
+ m_bPush.set_expand();
+ m_vbox.add(m_bPush);
m_bPop.signal_clicked().connect( sigc::bind(sigc::mem_fun(*this, &StatusBarExample::pop_item),
m_context_id) );
- m_vbox.pack_start(m_bPop, Gtk::PackOptions::EXPAND_WIDGET);
+ m_bPop.set_expand();
+ m_vbox.add(m_bPop);
}
void
diff --git a/examples/others/treemodelcustom/examplewindow.cc
b/examples/others/treemodelcustom/examplewindow.cc
index 7c2c73e..3449ed0 100644
--- a/examples/others/treemodelcustom/examplewindow.cc
+++ b/examples/others/treemodelcustom/examplewindow.cc
@@ -32,11 +32,12 @@ ExampleWindow::ExampleWindow()
//Only show the scrollbars when they are necessary:
m_ScrolledWindow.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC);
+ m_ScrolledWindow.set_expand();
- m_VBox.pack_start(m_ScrolledWindow, Gtk::PackOptions::EXPAND_WIDGET);
- m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_ScrolledWindow);
+ m_VBox.add(m_ButtonBox);
- m_ButtonBox.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
+ m_ButtonBox.add(m_Button_Quit);
m_ButtonBox.set_margin(5);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
m_Button_Quit.signal_clicked().connect( sigc::mem_fun(*this, &ExampleWindow::on_button_quit) );
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]