[gtkmm] demos, tests: Use Container::add() instead of Box::pack_start()
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] demos, tests: Use Container::add() instead of Box::pack_start()
- Date: Mon, 4 Feb 2019 17:44:49 +0000 (UTC)
commit 7802bfbf53b333c507c9af99a6aaed586d77b784
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Mon Feb 4 18:38:02 2019 +0100
demos, tests: Use Container::add() instead of Box::pack_start()
demos/gtk-demo/demowindow.cc | 5 +--
demos/gtk-demo/example_buttonbox.cc | 30 ++++++++---------
demos/gtk-demo/example_change_display.cc | 17 ++++++----
demos/gtk-demo/example_colorsel.cc | 5 +--
demos/gtk-demo/example_dialog.cc | 41 ++++++++++++-----------
demos/gtk-demo/example_drawingarea.cc | 12 ++++---
demos/gtk-demo/example_iconbrowser.cc | 29 +++++++++-------
demos/gtk-demo/example_iconview.cc | 5 +--
demos/gtk-demo/example_images.cc | 34 +++++++++----------
demos/gtk-demo/example_menus.cc | 12 ++++---
demos/gtk-demo/example_panes.cc | 11 +++---
demos/gtk-demo/example_sizegroup.cc | 16 +++++----
demos/gtk-demo/example_stacksidebar.cc | 7 ++--
demos/gtk-demo/example_treeview_editable_cells.cc | 15 +++++----
demos/gtk-demo/example_treeview_liststore.cc | 7 ++--
demos/gtk-demo/example_treeview_treestore.cc | 7 ++--
tests/child_widget2/main.cc | 3 +-
tests/delete_cpp_child/main.cc | 4 +--
tests/dialog_deletethis/main.cc | 3 +-
tests/refcount_dialog/main.cc | 3 +-
20 files changed, 147 insertions(+), 119 deletions(-)
---
diff --git a/demos/gtk-demo/demowindow.cc b/demos/gtk-demo/demowindow.cc
index dc31cff5..44734a41 100644
--- a/demos/gtk-demo/demowindow.cc
+++ b/demos/gtk-demo/demowindow.cc
@@ -93,7 +93,7 @@ DemoWindow::DemoWindow()
m_SideBar.get_style_context()->add_class("sidebar");
m_SideBar.set_hexpand(false);
m_SideBar.add(m_TreeView);
- m_HBox.pack_start(m_SideBar, Gtk::PackOptions::SHRINK);
+ m_HBox.add(m_SideBar);
//Notebook:
m_Notebook.popup_enable();
@@ -102,7 +102,8 @@ DemoWindow::DemoWindow()
m_Notebook.append_page(m_TextWidget_Source, "_Source", true); //true = use mnemonic.
m_Notebook.child_property_tab_expand(m_TextWidget_Info) = true;
m_Notebook.child_property_tab_expand(m_TextWidget_Source) = true;
- m_HBox.pack_start(m_Notebook, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Notebook.set_expand(true);
+ m_HBox.add(m_Notebook);
m_HBox.set_vexpand(true);
set_default_size (800, 600);
diff --git a/demos/gtk-demo/example_buttonbox.cc b/demos/gtk-demo/example_buttonbox.cc
index 0d2b288c..82090439 100644
--- a/demos/gtk-demo/example_buttonbox.cc
+++ b/demos/gtk-demo/example_buttonbox.cc
@@ -37,32 +37,32 @@ Example_ButtonBox::Example_ButtonBox()
{
set_title("Button Boxes");
- m_VBox_Main.property_margin() = 10;
+ m_VBox_Main.set_margin(10);
add(m_VBox_Main);
m_Frame_Horizontal.set_margin_top(10);
m_Frame_Horizontal.set_margin_bottom(10);
- m_VBox_Main.pack_start(m_Frame_Horizontal, Gtk::PackOptions::EXPAND_WIDGET);
- m_Frame_Horizontal.set_margin_top(10);
- m_Frame_Horizontal.set_margin_bottom(10);
+ m_Frame_Horizontal.set_expand(true);
+ m_VBox_Main.add(m_Frame_Horizontal);
- m_VBox.property_margin() = 10;
+ m_VBox.set_margin(10);
m_Frame_Horizontal.add(m_VBox);
- m_VBox.pack_start( *(create_button_box(true, "Spread", 40, Gtk::ButtonBoxStyle::SPREAD)) );
- m_VBox.pack_start( *(create_button_box(true, "Edge", 40, Gtk::ButtonBoxStyle::EDGE)) );
- m_VBox.pack_start( *(create_button_box(true, "Start", 40, Gtk::ButtonBoxStyle::START)) );
- m_VBox.pack_start( *(create_button_box(true, "End", 40, Gtk::ButtonBoxStyle::END)) );
+ m_VBox.add( *(create_button_box(true, "Spread", 40, Gtk::ButtonBoxStyle::SPREAD)) );
+ m_VBox.add( *(create_button_box(true, "Edge", 40, Gtk::ButtonBoxStyle::EDGE)) );
+ m_VBox.add( *(create_button_box(true, "Start", 40, Gtk::ButtonBoxStyle::START)) );
+ m_VBox.add( *(create_button_box(true, "End", 40, Gtk::ButtonBoxStyle::END)) );
- m_VBox_Main.pack_start(m_Frame_Vertical, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Frame_Vertical.set_expand(true);
+ m_VBox_Main.add(m_Frame_Vertical);
- m_HBox.property_margin() = 10;
+ m_HBox.set_margin(10);
m_Frame_Vertical.add(m_HBox);
- m_HBox.pack_start( *(create_button_box(false, "Spread", 30, Gtk::ButtonBoxStyle::SPREAD)) );
- m_HBox.pack_start( *(create_button_box(false, "Edge", 30, Gtk::ButtonBoxStyle::EDGE)) );
- m_HBox.pack_start( *(create_button_box(false, "Start", 30, Gtk::ButtonBoxStyle::START)) );
- m_HBox.pack_start( *(create_button_box(false, "End", 30, Gtk::ButtonBoxStyle::END)) );
+ m_HBox.add( *(create_button_box(false, "Spread", 30, Gtk::ButtonBoxStyle::SPREAD)) );
+ m_HBox.add( *(create_button_box(false, "Edge", 30, Gtk::ButtonBoxStyle::EDGE)) );
+ m_HBox.add( *(create_button_box(false, "Start", 30, Gtk::ButtonBoxStyle::START)) );
+ m_HBox.add( *(create_button_box(false, "End", 30, Gtk::ButtonBoxStyle::END)) );
}
Example_ButtonBox::~Example_ButtonBox()
diff --git a/demos/gtk-demo/example_change_display.cc b/demos/gtk-demo/example_change_display.cc
index f3e2d807..94489a57 100644
--- a/demos/gtk-demo/example_change_display.cc
+++ b/demos/gtk-demo/example_change_display.cc
@@ -108,16 +108,17 @@ Example_ChangeDisplay::Example_ChangeDisplay()
set_default_size(300, 400);
- m_VBox.property_margin() = 8;
- get_content_area()->pack_start(m_VBox, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.set_margin(8);
+ m_VBox.set_expand(true);
+ get_content_area()->add(m_VBox);
//Display:
{
setup_frame(m_Frame_Display, m_TreeView_Display, m_ButtonBox_Display);
- m_ButtonBox_Display.pack_start(m_Button_Display_Open, Gtk::PackOptions::SHRINK);
+ m_ButtonBox_Display.add(m_Button_Display_Open);
m_Button_Display_Open.signal_clicked().connect( sigc::mem_fun(*this,
&Example_ChangeDisplay::on_button_display_open) );
- m_ButtonBox_Display.pack_start(m_Button_Display_Close, Gtk::PackOptions::SHRINK);
+ m_ButtonBox_Display.add(m_Button_Display_Close);
m_Button_Display_Close.signal_clicked().connect( sigc::mem_fun(*this,
&Example_ChangeDisplay::on_button_display_close) );
//Setup TreeView:
@@ -129,7 +130,8 @@ Example_ChangeDisplay::Example_ChangeDisplay()
auto refSelection = m_TreeView_Display.get_selection();
refSelection->signal_changed().connect( sigc::mem_fun(*this,
&Example_ChangeDisplay::on_treeview_display_selection_changed) );
- m_VBox.pack_start(m_Frame_Display, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Frame_Display.set_expand(true);
+ m_VBox.add(m_Frame_Display);
m_refSizeGroup_Display = Gtk::SizeGroup::create(Gtk::SizeGroup::Mode::HORIZONTAL);
m_refSizeGroup_Display->add_widget(m_ButtonBox_Display);
@@ -151,7 +153,8 @@ void Example_ChangeDisplay::setup_frame(Gtk::Frame& frame, Gtk::TreeView& treevi
auto pScrolledWindow = Gtk::make_managed<Gtk::ScrolledWindow>();
pScrolledWindow->set_policy(Gtk::PolicyType::NEVER, Gtk::PolicyType::AUTOMATIC);
pScrolledWindow->set_shadow_type(Gtk::ShadowType::IN);
- pHBox->pack_start(*pScrolledWindow, Gtk::PackOptions::EXPAND_WIDGET);
+ pScrolledWindow->set_expand(true);
+ pHBox->add(*pScrolledWindow);
treeview.set_headers_visible(false);
pScrolledWindow->add(treeview);
@@ -159,7 +162,7 @@ void Example_ChangeDisplay::setup_frame(Gtk::Frame& frame, Gtk::TreeView& treevi
auto refSelection = treeview.get_selection();
refSelection->set_mode(Gtk::SelectionMode::BROWSE);
- pHBox->pack_start(buttonbox, Gtk::PackOptions::SHRINK);
+ pHBox->add(buttonbox);
}
void Example_ChangeDisplay::initialize_displays()
diff --git a/demos/gtk-demo/example_colorsel.cc b/demos/gtk-demo/example_colorsel.cc
index 359e7fe0..e3201596 100644
--- a/demos/gtk-demo/example_colorsel.cc
+++ b/demos/gtk-demo/example_colorsel.cc
@@ -45,7 +45,8 @@ Example_ColorSel::Example_ColorSel()
// Create the color swatch area
m_Frame.set_shadow_type(Gtk::ShadowType::IN);
- m_VBox.pack_start(m_Frame, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Frame.set_expand(true);
+ m_VBox.add(m_Frame);
// set a fixed size
m_DrawingArea.set_content_width(200);
@@ -60,7 +61,7 @@ Example_ColorSel::Example_ColorSel()
m_Button.set_halign(Gtk::Align::END);
m_Button.set_valign(Gtk::Align::CENTER);
- m_VBox.pack_start(m_Button, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Button);
m_Button.signal_clicked().connect(sigc::mem_fun(*this, &Example_ColorSel::on_button_clicked));
}
diff --git a/demos/gtk-demo/example_dialog.cc b/demos/gtk-demo/example_dialog.cc
index 55e56fdd..5e00f0c0 100644
--- a/demos/gtk-demo/example_dialog.cc
+++ b/demos/gtk-demo/example_dialog.cc
@@ -70,37 +70,37 @@ Example_Dialog::Example_Dialog()
set_title("Dialogs");
- m_Frame.property_margin() = 8;
+ m_Frame.set_margin(8);
add(m_Frame);
- m_VBox.property_margin() = 8;
+ m_VBox.set_margin(8);
m_Frame.add(m_VBox);
/* Standard message dialog */
- m_VBox.pack_start(m_HBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_HBox);
m_Button_Message.signal_clicked().connect(sigc::mem_fun(*this, &Example_Dialog::on_button_message));
- m_HBox.pack_start(m_Button_Message, Gtk::PackOptions::SHRINK);
- m_VBox.pack_start(*Gtk::make_managed<Gtk::Separator>(Gtk::Orientation::HORIZONTAL),
Gtk::PackOptions::SHRINK);
+ m_HBox.add(m_Button_Message);
+ m_VBox.add(*Gtk::make_managed<Gtk::Separator>(Gtk::Orientation::HORIZONTAL));
/* Interactive dialog*/
- m_VBox.pack_start(m_HBox2, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_HBox2);
m_Button_Interactive.signal_clicked().connect(sigc::mem_fun(*this,
&Example_Dialog::on_button_interactive));
- m_HBox2.pack_start(m_VBox2, Gtk::PackOptions::SHRINK);
- m_VBox2.pack_start(m_Button_Interactive, Gtk::PackOptions::SHRINK);
+ m_HBox2.add(m_VBox2);
+ m_VBox2.add(m_Button_Interactive);
m_Grid.set_row_spacing(4);
m_Grid.set_column_spacing(4);
- m_HBox2.pack_start(m_Grid, Gtk::PackOptions::SHRINK);
+ m_HBox2.add(m_Grid);
- m_Grid.attach(m_Label1, 0, 0, 1, 1);
- m_Grid.attach(m_Entry1, 1, 0, 1, 1);
+ m_Grid.attach(m_Label1, 0, 0);
+ m_Grid.attach(m_Entry1, 1, 0);
m_Label1.set_mnemonic_widget(m_Entry1);
- m_Grid.attach(m_Label2, 0, 1, 1, 1);
- m_Grid.attach(m_Entry2, 1, 1, 1, 1);
+ m_Grid.attach(m_Label2, 0, 1);
+ m_Grid.attach(m_Entry2, 1, 1);
m_Label2.set_mnemonic_widget(m_Entry2);
}
@@ -143,21 +143,22 @@ Dialog_Interactive::Dialog_Interactive(Gtk::Window& parent, const Glib::ustring&
add_button("_OK", Gtk::ResponseType::OK);
add_button("_Cancel", Gtk::ResponseType::CANCEL);
- get_content_area()->pack_start(m_HBox, Gtk::PackOptions::SHRINK);
- m_HBox.pack_start(m_Image, Gtk::PackOptions::SHRINK);
+ get_content_area()->add(m_HBox);
+ m_HBox.add(m_Image);
m_Grid.set_row_spacing(4);
m_Grid.set_column_spacing(4);
- m_HBox.pack_start(m_Grid, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Grid.set_expand(true);
+ m_HBox.add(m_Grid);
- m_Grid.attach(m_Label1, 0, 0, 1, 1);
+ m_Grid.attach(m_Label1, 0, 0);
m_Entry1.set_text(entry1);
- m_Grid.attach(m_Entry1, 1, 0, 1, 1);
+ m_Grid.attach(m_Entry1, 1, 0);
m_Label1.set_mnemonic_widget(m_Entry1);
- m_Grid.attach(m_Label2, 0, 1, 1, 1);
+ m_Grid.attach(m_Label2, 0, 1);
m_Entry2.set_text(entry2);
- m_Grid.attach(m_Entry2, 1, 1, 1, 1);
+ m_Grid.attach(m_Entry2, 1, 1);
m_Label2.set_mnemonic_widget(m_Entry2);
}
diff --git a/demos/gtk-demo/example_drawingarea.cc b/demos/gtk-demo/example_drawingarea.cc
index bc037234..d76cf01c 100644
--- a/demos/gtk-demo/example_drawingarea.cc
+++ b/demos/gtk-demo/example_drawingarea.cc
@@ -59,17 +59,18 @@ Example_DrawingArea::Example_DrawingArea()
{
set_title("Drawing Area");
- m_VBox.property_margin() = 16;
+ m_VBox.set_margin(16);
add(m_VBox);
/*
* Create the checkerboard area
*/
m_Label_Checkerboard.set_markup("<u>Checkerboard pattern</u>");
- m_VBox.pack_start(m_Label_Checkerboard, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Label_Checkerboard);
m_Frame_Checkerboard.set_shadow_type(Gtk::ShadowType::IN);
- m_VBox.pack_start(m_Frame_Checkerboard, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Frame_Checkerboard.set_expand(true);
+ m_VBox.add(m_Frame_Checkerboard);
/* set a minimum size */
m_DrawingArea_Checkerboard.set_content_width(100);
@@ -83,10 +84,11 @@ Example_DrawingArea::Example_DrawingArea()
* Create the scribble area
*/
m_Label_Scribble.set_markup("<u>Scribble area</u>");
- m_VBox.pack_start(m_Label_Scribble, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Label_Scribble);
m_Frame_Scribble.set_shadow_type(Gtk::ShadowType::IN);
- m_VBox.pack_start(m_Frame_Scribble, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Frame_Scribble.set_expand(true);
+ m_VBox.add(m_Frame_Scribble);
m_drag = Gtk::GestureDrag::create();
m_drag->set_button(GDK_BUTTON_PRIMARY);
diff --git a/demos/gtk-demo/example_iconbrowser.cc b/demos/gtk-demo/example_iconbrowser.cc
index bf656315..35841b74 100644
--- a/demos/gtk-demo/example_iconbrowser.cc
+++ b/demos/gtk-demo/example_iconbrowser.cc
@@ -197,8 +197,10 @@ Example_IconBrowser::Example_IconBrowser()
m_header.pack_end(m_search_button);
m_search_button.set_image_from_icon_name("edit-find-symbolic");
m_header.pack_end(m_header_radio_button_box);
- m_header_radio_button_box.pack_start(m_normal_radio, Gtk::PackOptions::EXPAND_WIDGET);
- m_header_radio_button_box.pack_start(m_symbolic_radio, Gtk::PackOptions::EXPAND_WIDGET);
+ m_normal_radio.set_expand();
+ m_header_radio_button_box.add(m_normal_radio);
+ m_symbolic_radio.set_expand();
+ m_header_radio_button_box.add(m_symbolic_radio);
m_normal_radio.set_draw_indicator(false); // Make it look as a normal button
m_symbolic_radio.set_draw_indicator(false);
m_symbolic_radio.join_group(m_normal_radio);
@@ -210,18 +212,20 @@ Example_IconBrowser::Example_IconBrowser()
// Main part of the window.
add(m_hbox);
- m_hbox.pack_start(m_context_list, Gtk::PackOptions::SHRINK);
+ m_hbox.add(m_context_list);
m_context_list.set_selection_mode(Gtk::SelectionMode::SINGLE);
- m_hbox.pack_start(m_vseparator, Gtk::PackOptions::SHRINK);
- m_hbox.pack_start(m_vcontent_box, Gtk::PackOptions::EXPAND_WIDGET);
- m_vcontent_box.pack_start(m_search_bar, Gtk::PackOptions::SHRINK);
+ m_hbox.add(m_vseparator);
+ m_vcontent_box.set_expand();
+ m_hbox.add(m_vcontent_box);
+ m_vcontent_box.add(m_search_bar);
m_search_bar.add(m_search_entry);
// The search bar is shown when the search toggle button is pressed.
m_binding_search_button_search_entry = Glib::Binding::bind_property(
m_search_button.property_active(),
m_search_bar.property_search_mode_enabled(),
Glib::Binding::Flags::BIDIRECTIONAL);
- m_vcontent_box.pack_start(m_scrolled_window, Gtk::PackOptions::EXPAND_WIDGET);
+ m_scrolled_window.set_expand();
+ m_vcontent_box.add(m_scrolled_window);
m_scrolled_window.set_policy(Gtk::PolicyType::NEVER, Gtk::PolicyType::AUTOMATIC);
m_scrolled_window.add(m_icon_view);
m_icon_view.set_model(m_filter_model);
@@ -836,7 +840,7 @@ void Example_IconBrowser::add_context(const Glib::ustring& id,
{
IconContextLabel* row = Gtk::make_managed<IconContextLabel>(id, name);
row->show();
- row->property_margin() = 10;
+ row->set_margin(10);
m_context_list.append(*row);
// Set the tooltip on the list box row.
@@ -900,14 +904,15 @@ DetailDialog::DetailDialog(Gtk::Window& parent)
{
set_resizable(false);
auto content_area = get_content_area();
- content_area->pack_start(m_grid, Gtk::PackOptions::EXPAND_WIDGET);
- m_grid.property_margin() = 10;
+ content_area->add(m_grid);
+ m_grid.set_expand();
+ m_grid.set_margin(10);
m_grid.set_row_spacing(10);
m_grid.set_column_spacing(10);
for (int i = 0; i < n_icon_sizes; ++i)
{
m_grid.attach(m_image[i], i, 0);
- m_image[i].property_margin() = 4;
+ m_image[i].set_margin(4);
m_image[i].set_halign(Gtk::Align::CENTER);
m_image[i].set_valign(Gtk::Align::END);
@@ -919,7 +924,7 @@ DetailDialog::DetailDialog(Gtk::Window& parent)
sigc::bind(sigc::mem_fun(*this, &DetailDialog::on_image_drag_data_get), i));
m_grid.attach(m_label[i], i, 1);
- m_label[i].property_margin() = 4;
+ m_label[i].set_margin(4);
m_label[i].set_halign(Gtk::Align::CENTER);
m_label[i].set_valign(Gtk::Align::CENTER);
std::ostringstream ostr;
diff --git a/demos/gtk-demo/example_iconview.cc b/demos/gtk-demo/example_iconview.cc
index f331f480..27878269 100644
--- a/demos/gtk-demo/example_iconview.cc
+++ b/demos/gtk-demo/example_iconview.cc
@@ -80,7 +80,7 @@ Example_IconView::Example_IconView()
std::cout << error.what() << std::endl;
}
- m_VBox.pack_start(m_Toolbar, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Toolbar);
m_ButtonUp.set_is_important();
m_ButtonUp.set_sensitive();
@@ -92,8 +92,9 @@ Example_IconView::Example_IconView()
m_ScrolledWindow.set_shadow_type(Gtk::ShadowType::ETCHED_IN);
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);
//Create the data model:
m_model = Gtk::ListStore::create(m_columns);
diff --git a/demos/gtk-demo/example_images.cc b/demos/gtk-demo/example_images.cc
index f9fbb0d2..8bf49a75 100644
--- a/demos/gtk-demo/example_images.cc
+++ b/demos/gtk-demo/example_images.cc
@@ -73,20 +73,20 @@ Example_Images::Example_Images()
m_BaseVBox.set_margin(16);
add(m_BaseVBox);
- m_BaseVBox.pack_start(m_HBox);
+ m_BaseVBox.add(m_HBox);
/* Image */
auto pVBox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL, 8);
- m_HBox.pack_start(*pVBox, Gtk::PackOptions::SHRINK);
+ m_HBox.add(*pVBox);
m_Label_Image.set_markup("<u>Image loaded from a file</u>");
- pVBox->pack_start(m_Label_Image, Gtk::PackOptions::SHRINK);
+ pVBox->add(m_Label_Image);
m_Frame_Image.set_shadow_type(Gtk::ShadowType::IN);
m_Frame_Image.set_halign(Gtk::Align::CENTER);
m_Frame_Image.set_valign(Gtk::Align::CENTER);
- pVBox->pack_start(m_Frame_Image, Gtk::PackOptions::SHRINK);
+ pVBox->add(m_Frame_Image);
auto pImage = Gtk::make_managed<Gtk::Image>();
pImage->set_from_icon_name("gtk3-demo");
@@ -96,12 +96,12 @@ Example_Images::Example_Images()
/* Animation */
m_Label_Animation.set_markup("<u>Animation loaded from a file</u>");
- pVBox->pack_start(m_Label_Animation, Gtk::PackOptions::SHRINK);
+ pVBox->add(m_Label_Animation);
m_Frame_Animation.set_shadow_type(Gtk::ShadowType::IN);
m_Frame_Animation.set_halign(Gtk::Align::CENTER);
m_Frame_Animation.set_valign(Gtk::Align::CENTER);
- pVBox->pack_start(m_Frame_Animation, Gtk::PackOptions::SHRINK);
+ pVBox->add(m_Frame_Animation);
auto pPicture = Gtk::make_managed<Gtk::Picture>();
pPicture->set_resource("/images/floppybuddy.gif");
@@ -110,12 +110,12 @@ Example_Images::Example_Images()
/* Symbolic themed icon */
m_Label_ThemedIcon.set_markup("<u>Symbolic themed icon</u>");
- pVBox->pack_start(m_Label_ThemedIcon, Gtk::PackOptions::SHRINK);
+ pVBox->add(m_Label_ThemedIcon);
m_Frame_ThemedIcon.set_shadow_type(Gtk::ShadowType::IN);
m_Frame_ThemedIcon.set_halign(Gtk::Align::CENTER);
m_Frame_ThemedIcon.set_valign(Gtk::Align::CENTER);
- pVBox->pack_start(m_Frame_ThemedIcon, Gtk::PackOptions::SHRINK);
+ pVBox->add(m_Frame_ThemedIcon);
auto icon = Gio::ThemedIcon::create("battery-caution-charging-symbolic", true);
pImage = Gtk::make_managed<Gtk::Image>(icon);
@@ -125,15 +125,15 @@ Example_Images::Example_Images()
/* Progressive */
pVBox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL, 8);
- m_HBox.pack_start(*pVBox, Gtk::PackOptions::SHRINK);
+ m_HBox.add(*pVBox);
m_Label_Progressive.set_markup("<u>Progressive image loading</u>");
- pVBox->pack_start(m_Label_Progressive, Gtk::PackOptions::SHRINK);
+ pVBox->add(m_Label_Progressive);
m_Frame_Progressive.set_shadow_type(Gtk::ShadowType::IN);
m_Frame_Progressive.set_halign(Gtk::Align::CENTER);
m_Frame_Progressive.set_valign(Gtk::Align::CENTER);
- pVBox->pack_start(m_Frame_Progressive, Gtk::PackOptions::SHRINK);
+ pVBox->add(m_Frame_Progressive);
/* Create an empty image for now; the progressive loader
* will create the pixbuf and fill it in.
@@ -145,12 +145,12 @@ Example_Images::Example_Images()
/* Video */
m_Label_Video.set_markup("<u>Displaying video</u>");
- pVBox->pack_start(m_Label_Video, Gtk::PackOptions::SHRINK);
+ pVBox->add(m_Label_Video);
m_Frame_Video.set_shadow_type(Gtk::ShadowType::IN);
m_Frame_Video.set_halign(Gtk::Align::CENTER);
m_Frame_Video.set_valign(Gtk::Align::CENTER);
- pVBox->pack_start(m_Frame_Video, Gtk::PackOptions::SHRINK);
+ pVBox->add(m_Frame_Video);
auto video = Gtk::make_managed<Gtk::Video>();
video->set_resource("/images/gtk-logo.webm");
@@ -160,10 +160,10 @@ Example_Images::Example_Images()
/* Widget paintable */
pVBox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL, 8);
- m_HBox.pack_start(*pVBox, Gtk::PackOptions::SHRINK);
+ m_HBox.add(*pVBox);
m_Label_Paintable.set_markup("<u>Gtk::WidgetPaintable</u>");
- pVBox->pack_start(m_Label_Paintable, Gtk::PackOptions::SHRINK);
+ pVBox->add(m_Label_Paintable);
pPicture = Gtk::make_managed<Gtk::Picture>();
auto demo_window = DemoWindow::get_demo_window();
@@ -174,10 +174,10 @@ Example_Images::Example_Images()
}
pPicture->set_size_request(100, 100);
pPicture->set_valign(Gtk::Align::START);
- pVBox->pack_start(*pPicture, Gtk::PackOptions::SHRINK);
+ pVBox->add(*pPicture);
/* Sensitivity control */
- m_BaseVBox.pack_start(m_ToggleButton, Gtk::PackOptions::SHRINK);
+ m_BaseVBox.add(m_ToggleButton);
m_ToggleButton.signal_toggled().connect(sigc::mem_fun(*this, &Example_Images::on_toggle_sensitivity));
}
diff --git a/demos/gtk-demo/example_menus.cc b/demos/gtk-demo/example_menus.cc
index 9524fbea..d4aa8307 100644
--- a/demos/gtk-demo/example_menus.cc
+++ b/demos/gtk-demo/example_menus.cc
@@ -62,7 +62,7 @@ Example_Menus::Example_Menus()
add(m_VBox1);
- m_VBox1.pack_start(m_MenuBar, Gtk::PackOptions::SHRINK);
+ m_VBox1.add(m_MenuBar);
{
//Note:: It's generally easier to use the Gtk::Builder API.
@@ -84,7 +84,8 @@ Example_Menus::Example_Menus()
m_VBox_Sub1.set_margin(10);
- m_VBox1.pack_start(m_VBox_Sub1, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox_Sub1.set_expand();
+ m_VBox1.add(m_VBox_Sub1);
{
auto accel_group = Gtk::AccelGroup::create();
@@ -126,14 +127,15 @@ Example_Menus::Example_Menus()
sigc::bind(sigc::mem_fun(*this, &Example_Menus::on_item_activated), "F3"));
}
- m_VBox1.pack_start(m_Separator, Gtk::PackOptions::SHRINK);
+ m_VBox1.add(m_Separator);
m_VBox_Sub2.set_margin(10);
- m_VBox1.pack_start(m_VBox_Sub2, Gtk::PackOptions::SHRINK);
+ m_VBox1.add(m_VBox_Sub2);
m_Button.signal_clicked().connect(sigc::mem_fun(*this, &Example_Menus::on_button_clicked));
+ m_Button.set_expand();
- m_VBox_Sub2.pack_start(m_Button, Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox_Sub2.add(m_Button);
m_VBox_Sub2.set_vexpand(false);
m_Button.set_can_default(true);
diff --git a/demos/gtk-demo/example_panes.cc b/demos/gtk-demo/example_panes.cc
index ffdf2f12..9439319a 100644
--- a/demos/gtk-demo/example_panes.cc
+++ b/demos/gtk-demo/example_panes.cc
@@ -52,8 +52,9 @@ Example_Panes::Example_Panes()
add(*Gtk::manage(pVBox));
Gtk::Paned *const pVPaned = new Gtk::Paned(Gtk::Orientation::VERTICAL);
- pVBox->pack_start(*Gtk::manage(pVPaned), Gtk::PackOptions::EXPAND_WIDGET);
- pVPaned->property_margin() = 5;
+ pVBox->add(*Gtk::manage(pVPaned));
+ pVPaned->set_margin(5);
+ pVPaned->set_expand();
Gtk::Paned *const pHPaned = new Gtk::Paned(Gtk::Orientation::HORIZONTAL);
pVPaned->add1(*Gtk::manage(pHPaned));
@@ -75,8 +76,8 @@ Example_Panes::Example_Panes()
pFrame3->set_size_request(60, 80);
// Now create check buttons to control sizing
- pVBox->pack_start(*Gtk::make_managed<PaneOptions>(*pHPaned, "Horizontal", "Left", "Right"),
Gtk::PackOptions::SHRINK);
- pVBox->pack_start(*Gtk::make_managed<PaneOptions>(*pVPaned, "Vertical", "Top", "Bottom"),
Gtk::PackOptions::SHRINK);
+ pVBox->add(*Gtk::make_managed<PaneOptions>(*pHPaned, "Horizontal", "Left", "Right"));
+ pVBox->add(*Gtk::make_managed<PaneOptions>(*pVPaned, "Vertical", "Top", "Bottom"));
}
Example_Panes::~Example_Panes()
@@ -94,7 +95,7 @@ PaneOptions::PaneOptions(Gtk::Paned& paned, const Glib::ustring& frame_label,
m_CheckButton_shrink2 ("_Shrink", true)
{
Gtk::Grid *const pGrid = new Gtk::Grid();
- pGrid->property_margin() = 4;
+ pGrid->set_margin(4);
add(*Gtk::manage(pGrid));
pGrid->attach(*Gtk::make_managed<Gtk::Label>(label1), 0, 0, 1, 1);
diff --git a/demos/gtk-demo/example_sizegroup.cc b/demos/gtk-demo/example_sizegroup.cc
index 1802115f..fb298287 100644
--- a/demos/gtk-demo/example_sizegroup.cc
+++ b/demos/gtk-demo/example_sizegroup.cc
@@ -58,16 +58,18 @@ Example_SizeGroup::Example_SizeGroup()
set_resizable(false);
add_button("_Close", Gtk::ResponseType::CLOSE);
- get_content_area()->pack_start(m_VBox, Gtk::PackOptions::EXPAND_WIDGET);
- m_VBox.property_margin() = 5;
+ get_content_area()->add(m_VBox);
+ m_VBox.set_margin(5);
+ m_VBox.set_expand();
m_refSizeGroup = Gtk::SizeGroup::create(Gtk::SizeGroup::Mode::HORIZONTAL),
/* Create one frame holding color options
*/
- m_VBox.pack_start(m_Frame_Color, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Frame_Color.set_expand();
+ m_VBox.add(m_Frame_Color);
- m_Grid_Color.property_margin() = 5;
+ m_Grid_Color.set_margin(5);
m_Grid_Color.set_row_spacing(5);
m_Grid_Color.set_column_spacing(10);
m_Frame_Color.add(m_Grid_Color);
@@ -82,9 +84,9 @@ Example_SizeGroup::Example_SizeGroup()
/* And another frame holding line style options
*/
- m_VBox.pack_start(m_Frame_Line, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Frame_Line);
- m_Grid_Line.property_margin() = 5;
+ m_Grid_Line.set_margin(5);
m_Grid_Line.set_row_spacing(5);
m_Grid_Line.set_column_spacing(10);
m_Frame_Line.add(m_Grid_Line);
@@ -105,7 +107,7 @@ Example_SizeGroup::Example_SizeGroup()
add_row(m_Grid_Line, 1, m_refSizeGroup, "_Line ends", end_options);
/* And a check button to turn grouping on and off */
- m_VBox.pack_start(m_CheckButton, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_CheckButton);
m_CheckButton.set_active();
m_CheckButton.signal_toggled().connect(sigc::mem_fun(*this, &Example_SizeGroup::on_checkbutton_toggled));
}
diff --git a/demos/gtk-demo/example_stacksidebar.cc b/demos/gtk-demo/example_stacksidebar.cc
index 4322dcef..a55c8580 100644
--- a/demos/gtk-demo/example_stacksidebar.cc
+++ b/demos/gtk-demo/example_stacksidebar.cc
@@ -50,9 +50,10 @@ Example_StackSidebar::Example_StackSidebar()
add(m_Box);
- m_Box.pack_start(m_StackSidebar, Gtk::PackOptions::SHRINK);
- m_Box.pack_start(m_Separator, Gtk::PackOptions::SHRINK);
- m_Box.pack_start(m_Stack, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Box.add(m_StackSidebar);
+ m_Box.add(m_Separator);
+ m_Box.add(m_Stack);
+ m_Stack.set_expand();
m_Stack.set_transition_type(Gtk::StackTransitionType::SLIDE_UP_DOWN);
m_StackSidebar.set_stack(m_Stack);
diff --git a/demos/gtk-demo/example_treeview_editable_cells.cc
b/demos/gtk-demo/example_treeview_editable_cells.cc
index c6a4a7d5..1b6c093a 100644
--- a/demos/gtk-demo/example_treeview_editable_cells.cc
+++ b/demos/gtk-demo/example_treeview_editable_cells.cc
@@ -106,13 +106,14 @@ Example_TreeView_EditableCells::Example_TreeView_EditableCells()
set_title("Shopping List");
set_default_size(320, 200);
- m_VBox.property_margin() = 5;
+ m_VBox.set_margin(5);
add(m_VBox);
- m_VBox.pack_start(m_Label, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Label);
m_ScrolledWindow.set_shadow_type(Gtk::ShadowType::ETCHED_IN);
m_ScrolledWindow.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC);
- m_VBox.pack_start(m_ScrolledWindow, Gtk::PackOptions::EXPAND_WIDGET);
+ m_ScrolledWindow.set_expand();
+ m_VBox.add(m_ScrolledWindow);
/* create model */
create_model();
@@ -126,15 +127,17 @@ Example_TreeView_EditableCells::Example_TreeView_EditableCells()
m_ScrolledWindow.add(m_TreeView);
/* some buttons */
- m_VBox.pack_start(m_HBox, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_HBox);
- m_HBox.pack_start(m_Button_Add, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Button_Add.set_expand();
+ m_HBox.add(m_Button_Add);
m_HBox.set_vexpand(false);
m_Button_Add.signal_clicked().connect(
sigc::mem_fun(*this, &Example_TreeView_EditableCells::on_button_add_clicked));
- m_HBox.pack_start(m_Button_Remove, Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox.add(m_Button_Remove);
+ m_Button_Remove.set_expand();
m_Button_Remove.signal_clicked().connect(
sigc::mem_fun(*this, &Example_TreeView_EditableCells::on_button_remove_clicked));
}
diff --git a/demos/gtk-demo/example_treeview_liststore.cc b/demos/gtk-demo/example_treeview_liststore.cc
index d236004c..f8df8302 100644
--- a/demos/gtk-demo/example_treeview_liststore.cc
+++ b/demos/gtk-demo/example_treeview_liststore.cc
@@ -105,13 +105,14 @@ Example_TreeView_ListStore::Example_TreeView_ListStore()
set_title("Gtk::ListStore demo");
set_default_size(280, 250);
- m_VBox.property_margin() = 8;
+ m_VBox.set_margin(8);
add(m_VBox);
- m_VBox.pack_start(m_Label, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Label);
m_ScrolledWindow.set_shadow_type(Gtk::ShadowType::ETCHED_IN);
m_ScrolledWindow.set_policy(Gtk::PolicyType::NEVER, Gtk::PolicyType::AUTOMATIC);
- m_VBox.pack_start(m_ScrolledWindow, Gtk::PackOptions::EXPAND_WIDGET);
+ m_ScrolledWindow.set_expand();
+ m_VBox.add(m_ScrolledWindow);
/* create model */
create_model();
diff --git a/demos/gtk-demo/example_treeview_treestore.cc b/demos/gtk-demo/example_treeview_treestore.cc
index ecb022d2..33b772ae 100644
--- a/demos/gtk-demo/example_treeview_treestore.cc
+++ b/demos/gtk-demo/example_treeview_treestore.cc
@@ -151,13 +151,14 @@ Example_TreeView_TreeStore::Example_TreeView_TreeStore()
set_title("Card planning sheet");
set_default_size(650, 400);
- m_VBox.property_margin() = 8;
+ m_VBox.set_margin(8);
add(m_VBox);
- m_VBox.pack_start(m_Label, Gtk::PackOptions::SHRINK);
+ m_VBox.add(m_Label);
m_ScrolledWindow.set_shadow_type(Gtk::ShadowType::ETCHED_IN);
m_ScrolledWindow.set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC);
- m_VBox.pack_start(m_ScrolledWindow, Gtk::PackOptions::EXPAND_WIDGET);
+ m_ScrolledWindow.set_expand();
+ m_VBox.add(m_ScrolledWindow);
/* create model */
create_model();
diff --git a/tests/child_widget2/main.cc b/tests/child_widget2/main.cc
index 6275a77f..2212d8bb 100644
--- a/tests/child_widget2/main.cc
+++ b/tests/child_widget2/main.cc
@@ -14,7 +14,8 @@ MyWindow::MyWindow() :
vbox(Gtk::Orientation::VERTICAL)
{
add(vbox);
- vbox.pack_start(b, Gtk::PackOptions::EXPAND_WIDGET);
+ b.set_expand(true);
+ vbox.add(b);
}
int main (int argc, char *argv[])
diff --git a/tests/delete_cpp_child/main.cc b/tests/delete_cpp_child/main.cc
index ca1ced34..55aa3e0f 100644
--- a/tests/delete_cpp_child/main.cc
+++ b/tests/delete_cpp_child/main.cc
@@ -23,12 +23,12 @@ AppWindow::AppWindow()
add(*vbox);
auto button = Gtk::make_managed<Gtk::Button>("Delete Label");
- vbox->pack_start(*button, Gtk::PackOptions::SHRINK);
+ vbox->add(*button);
//m_label = Gtk::make_managed<Gtk::Label>("test");
m_label = new Gtk::Label("test");
g_warning("m_label -> ref_count: %d\n", G_OBJECT(m_label->gobj())->ref_count);
- vbox->pack_start(*m_label, Gtk::PackOptions::SHRINK);
+ vbox->add(*m_label);
g_warning("m_label -> ref_count: %d\n", G_OBJECT(m_label->gobj())->ref_count);
button->signal_clicked().connect( sigc::mem_fun(*this, &AppWindow::on_button_clicked));
diff --git a/tests/dialog_deletethis/main.cc b/tests/dialog_deletethis/main.cc
index 41e66b3a..ebab7993 100644
--- a/tests/dialog_deletethis/main.cc
+++ b/tests/dialog_deletethis/main.cc
@@ -12,7 +12,8 @@ class Dlg : public sigc::trackable
dlg_ = new Gtk::Dialog("Test Dialog");
auto btn = Gtk::make_managed<Gtk::Button>("ClickMe");
btn->signal_clicked().connect(sigc::mem_fun(*this, &Dlg::on_button_clicked));
- dlg_->get_content_area()->pack_start(*btn, Gtk::PackOptions::EXPAND_WIDGET);
+ btn->set_expand(true);
+ dlg_->get_content_area()->add(*btn);
dlg_->add_button("_OK", Gtk::ResponseType::OK);
dlg_->signal_response().connect(sigc::mem_fun(*this, &Dlg::on_response));
dlg_->show();
diff --git a/tests/refcount_dialog/main.cc b/tests/refcount_dialog/main.cc
index ce96dc63..0cedf4b5 100644
--- a/tests/refcount_dialog/main.cc
+++ b/tests/refcount_dialog/main.cc
@@ -31,7 +31,8 @@ MyWindow::MyWindow()
set_size_request(200, 200);
m_Button.signal_clicked().connect( sigc::mem_fun(*this, &MyWindow::on_button_clicked) );
- m_Box.pack_start(m_Button, Gtk::PackOptions::EXPAND_WIDGET);
+ m_Button.set_expand(true);
+ m_Box.add(m_Button);
add(m_Box);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]