[gtkmm-documentation] Replace most Gtk::manage() calls with Gtk::make_managed()
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm-documentation] Replace most Gtk::manage() calls with Gtk::make_managed()
- Date: Sat, 10 Nov 2018 09:16:29 +0000 (UTC)
commit 7dd3cc96e95e127022943854ca1ab014a820b636
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Sat Nov 10 10:11:23 2018 +0100
Replace most Gtk::manage() calls with Gtk::make_managed()
examples/book/box/examplewindow.cc | 20 +++----
examples/book/buildapp/step3/exampleappwindow.cc | 4 +-
examples/book/buildapp/step5/exampleappwindow.cc | 4 +-
examples/book/buildapp/step6/exampleappwindow.cc | 4 +-
examples/book/buildapp/step7/exampleappwindow.cc | 6 +--
examples/book/buildapp/step8/exampleappwindow.cc | 6 +--
examples/book/buildapp/step9/exampleappwindow.cc | 6 +--
examples/book/builder/derived/deriveddialog.cc | 2 +-
examples/book/buttonbox/examplebuttonbox.cc | 2 +-
examples/book/buttonbox/examplewindow.cc | 61 ++++++++++------------
examples/book/flowbox/examplewindow.cc | 4 +-
examples/book/idle/idleexample.cc | 12 ++---
examples/book/listbox/examplewindow.cc | 18 +++----
examples/book/listmodel/examplewindow.cc | 4 +-
examples/book/menus_and_toolbars/examplewindow.cc | 2 +-
examples/book/printing/advanced/examplewindow.cc | 2 +-
.../book/printing/advanced/printformoperation.cc | 6 +--
examples/book/printing/simple/examplewindow.cc | 2 +-
examples/book/range_widgets/examplewindow.cc | 7 ++-
examples/book/recent_files/examplewindow.cc | 2 +-
examples/book/scrolledwindow/examplewindow.cc | 2 +-
examples/book/toolbar/examplewindow.cc | 17 +++---
examples/book/tooltips/examplewindow.cc | 3 +-
.../book/treeview/combo_renderer/examplewindow.cc | 6 +--
examples/book/treeview/list/examplewindow.cc | 2 +-
examples/book/treeview/popup/treeview_withpopup.cc | 6 +--
examples/others/arrow/arrow.cc | 18 +++----
examples/others/calendar/calendar.cc | 38 +++++++-------
.../others/cellrenderercustom/cellrendererlist.cc | 4 +-
examples/others/dnd/dndwindow.cc | 4 +-
examples/others/idle/idle.cc | 14 ++---
examples/others/tictactoe/tictactoe.cc | 6 +--
examples/others/tictactoe/ttt_test.cc | 2 +-
33 files changed, 141 insertions(+), 155 deletions(-)
---
diff --git a/examples/book/box/examplewindow.cc b/examples/book/box/examplewindow.cc
index 92c5f6a..2454014 100644
--- a/examples/book/box/examplewindow.cc
+++ b/examples/book/box/examplewindow.cc
@@ -48,17 +48,17 @@ ExampleWindow::ExampleWindow(int which)
// Create a PackBox - homogeneous = false, spacing = 0,
// options = Gtk::PackOptions::SHRINK, margin = 0
- pPackBox1 = Gtk::manage(new PackBox(false, 0, Gtk::PackOptions::SHRINK));
+ pPackBox1 = Gtk::make_managed<PackBox>(false, 0, Gtk::PackOptions::SHRINK);
m_box1.pack_start(*pPackBox1, Gtk::PackOptions::SHRINK);
// Create a PackBox - homogeneous = false, spacing = 0,
// options = Gtk::PackOptions::EXPAND_PADDING, margin = 0
- pPackBox2 = Gtk::manage(new PackBox(false, 0, Gtk::PackOptions::EXPAND_PADDING));
+ pPackBox2 = Gtk::make_managed<PackBox>(false, 0, Gtk::PackOptions::EXPAND_PADDING);
m_box1.pack_start(*pPackBox2, Gtk::PackOptions::SHRINK);
// Create a PackBox - homogeneous = false, spacing = 0,
// options = Gtk::PackOptions::EXPAND_WIDGET, margin = 0
- pPackBox3 = Gtk::manage(new PackBox(false, 0, Gtk::PackOptions::EXPAND_WIDGET));
+ pPackBox3 = Gtk::make_managed<PackBox>(false, 0, Gtk::PackOptions::EXPAND_WIDGET);
m_box1.pack_start(*pPackBox3, Gtk::PackOptions::SHRINK);
// pack the separator into the vbox. Remember each of these
@@ -73,11 +73,11 @@ ExampleWindow::ExampleWindow(int which)
m_box1.pack_start(m_Label2, Gtk::PackOptions::SHRINK);
// Args are: homogeneous, spacing, options, margin
- pPackBox4 = Gtk::manage(new PackBox(true, 0, Gtk::PackOptions::EXPAND_PADDING));
+ pPackBox4 = Gtk::make_managed<PackBox>(true, 0, Gtk::PackOptions::EXPAND_PADDING);
m_box1.pack_start(*pPackBox4, Gtk::PackOptions::SHRINK);
// Args are: homogeneous, spacing, options, margin
- pPackBox5 = Gtk::manage(new PackBox(true, 0, Gtk::PackOptions::EXPAND_WIDGET));
+ pPackBox5 = Gtk::make_managed<PackBox>(true, 0, Gtk::PackOptions::EXPAND_WIDGET);
m_box1.pack_start(*pPackBox5, Gtk::PackOptions::SHRINK);
m_box1.pack_start(m_separator2, Gtk::PackOptions::SHRINK);
@@ -92,10 +92,10 @@ ExampleWindow::ExampleWindow(int which)
m_Label1.set_valign(Gtk::Align::START);
m_box1.pack_start(m_Label1, Gtk::PackOptions::SHRINK);
- pPackBox1 = Gtk::manage(new PackBox(false, 10, Gtk::PackOptions::EXPAND_PADDING));
+ pPackBox1 = Gtk::make_managed<PackBox>(false, 10, Gtk::PackOptions::EXPAND_PADDING);
m_box1.pack_start(*pPackBox1, Gtk::PackOptions::SHRINK);
- pPackBox2 = Gtk::manage(new PackBox(false, 10, Gtk::PackOptions::EXPAND_WIDGET));
+ pPackBox2 = Gtk::make_managed<PackBox>(false, 10, Gtk::PackOptions::EXPAND_WIDGET);
m_box1.pack_start(*pPackBox2, Gtk::PackOptions::SHRINK);
m_box1.pack_start(m_separator1, Gtk::PackOptions::SHRINK);
@@ -105,10 +105,10 @@ ExampleWindow::ExampleWindow(int which)
m_Label2.set_valign(Gtk::Align::START);
m_box1.pack_start(m_Label2, Gtk::PackOptions::SHRINK);
- pPackBox3 = Gtk::manage(new PackBox(false, 0, Gtk::PackOptions::SHRINK, 10));
+ pPackBox3 = Gtk::make_managed<PackBox>(false, 0, Gtk::PackOptions::SHRINK, 10);
m_box1.pack_start(*pPackBox3, Gtk::PackOptions::SHRINK);
- pPackBox4 = Gtk::manage(new PackBox(false, 0, Gtk::PackOptions::EXPAND_WIDGET, 10));
+ pPackBox4 = Gtk::make_managed<PackBox>(false, 0, Gtk::PackOptions::EXPAND_WIDGET, 10);
m_box1.pack_start(*pPackBox4, Gtk::PackOptions::SHRINK);
m_box1.pack_start(m_separator2, Gtk::PackOptions::SHRINK);
@@ -120,7 +120,7 @@ ExampleWindow::ExampleWindow(int which)
{
// This demonstrates the ability to use Gtk::Box::pack_end() to
// right justify widgets. First, we create a new box as before.
- pPackBox1 = Gtk::manage(new PackBox(false, 0, Gtk::PackOptions::SHRINK));
+ pPackBox1 = Gtk::make_managed<PackBox>(false, 0, Gtk::PackOptions::SHRINK);
// create the label that will be put at the end.
m_Label1.set_text("end");
diff --git a/examples/book/buildapp/step3/exampleappwindow.cc
b/examples/book/buildapp/step3/exampleappwindow.cc
index 39fe094..8068b9e 100644
--- a/examples/book/buildapp/step3/exampleappwindow.cc
+++ b/examples/book/buildapp/step3/exampleappwindow.cc
@@ -46,11 +46,11 @@ void ExampleAppWindow::open_file_view(const Glib::RefPtr<Gio::File>& file)
{
const auto basename = file->get_basename();
- auto scrolled = Gtk::manage(new Gtk::ScrolledWindow());
+ auto scrolled = Gtk::make_managed<Gtk::ScrolledWindow>();
scrolled->set_hexpand(true);
scrolled->set_vexpand(true);
scrolled->show();
- auto view = Gtk::manage(new Gtk::TextView());
+ auto view = Gtk::make_managed<Gtk::TextView>();
view->set_editable(false);
view->set_cursor_visible(false);
view->show();
diff --git a/examples/book/buildapp/step5/exampleappwindow.cc
b/examples/book/buildapp/step5/exampleappwindow.cc
index 63fea53..b4ed34e 100644
--- a/examples/book/buildapp/step5/exampleappwindow.cc
+++ b/examples/book/buildapp/step5/exampleappwindow.cc
@@ -50,11 +50,11 @@ void ExampleAppWindow::open_file_view(const Glib::RefPtr<Gio::File>& file)
{
const auto basename = file->get_basename();
- auto scrolled = Gtk::manage(new Gtk::ScrolledWindow());
+ auto scrolled = Gtk::make_managed<Gtk::ScrolledWindow>();
scrolled->set_hexpand(true);
scrolled->set_vexpand(true);
scrolled->show();
- auto view = Gtk::manage(new Gtk::TextView());
+ auto view = Gtk::make_managed<Gtk::TextView>();
view->set_editable(false);
view->set_cursor_visible(false);
view->show();
diff --git a/examples/book/buildapp/step6/exampleappwindow.cc
b/examples/book/buildapp/step6/exampleappwindow.cc
index adf55e0..757cdc6 100644
--- a/examples/book/buildapp/step6/exampleappwindow.cc
+++ b/examples/book/buildapp/step6/exampleappwindow.cc
@@ -75,11 +75,11 @@ void ExampleAppWindow::open_file_view(const Glib::RefPtr<Gio::File>& file)
{
const auto basename = file->get_basename();
- auto scrolled = Gtk::manage(new Gtk::ScrolledWindow());
+ auto scrolled = Gtk::make_managed<Gtk::ScrolledWindow>();
scrolled->set_hexpand(true);
scrolled->set_vexpand(true);
scrolled->show();
- auto view = Gtk::manage(new Gtk::TextView());
+ auto view = Gtk::make_managed<Gtk::TextView>();
view->set_editable(false);
view->set_cursor_visible(false);
view->show();
diff --git a/examples/book/buildapp/step7/exampleappwindow.cc
b/examples/book/buildapp/step7/exampleappwindow.cc
index 33fd298..092aaf8 100644
--- a/examples/book/buildapp/step7/exampleappwindow.cc
+++ b/examples/book/buildapp/step7/exampleappwindow.cc
@@ -109,11 +109,11 @@ void ExampleAppWindow::open_file_view(const Glib::RefPtr<Gio::File>& file)
{
const auto basename = file->get_basename();
- auto scrolled = Gtk::manage(new Gtk::ScrolledWindow());
+ auto scrolled = Gtk::make_managed<Gtk::ScrolledWindow>();
scrolled->set_hexpand(true);
scrolled->set_vexpand(true);
scrolled->show();
- auto view = Gtk::manage(new Gtk::TextView());
+ auto view = Gtk::make_managed<Gtk::TextView>();
view->set_editable(false);
view->set_cursor_visible(false);
view->show();
@@ -240,7 +240,7 @@ void ExampleAppWindow::update_words()
// Add new child buttons, one per unique word.
for (const auto& word : words)
{
- auto row = Gtk::manage(new Gtk::Button(word));
+ auto row = Gtk::make_managed<Gtk::Button>(word);
row->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this,
&ExampleAppWindow::on_find_word), row));
row->show();
diff --git a/examples/book/buildapp/step8/exampleappwindow.cc
b/examples/book/buildapp/step8/exampleappwindow.cc
index 361a7ee..63fb303 100644
--- a/examples/book/buildapp/step8/exampleappwindow.cc
+++ b/examples/book/buildapp/step8/exampleappwindow.cc
@@ -126,11 +126,11 @@ void ExampleAppWindow::open_file_view(const Glib::RefPtr<Gio::File>& file)
{
const auto basename = file->get_basename();
- auto scrolled = Gtk::manage(new Gtk::ScrolledWindow());
+ auto scrolled = Gtk::make_managed<Gtk::ScrolledWindow>();
scrolled->set_hexpand(true);
scrolled->set_vexpand(true);
scrolled->show();
- auto view = Gtk::manage(new Gtk::TextView());
+ auto view = Gtk::make_managed<Gtk::TextView>();
view->set_editable(false);
view->set_cursor_visible(false);
view->show();
@@ -259,7 +259,7 @@ void ExampleAppWindow::update_words()
// Add new child buttons, one per unique word.
for (const auto& word : words)
{
- auto row = Gtk::manage(new Gtk::Button(word));
+ auto row = Gtk::make_managed<Gtk::Button>(word);
row->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this,
&ExampleAppWindow::on_find_word), row));
row->show();
diff --git a/examples/book/buildapp/step9/exampleappwindow.cc
b/examples/book/buildapp/step9/exampleappwindow.cc
index 25f50d6..b1a2e71 100644
--- a/examples/book/buildapp/step9/exampleappwindow.cc
+++ b/examples/book/buildapp/step9/exampleappwindow.cc
@@ -135,11 +135,11 @@ void ExampleAppWindow::open_file_view(const Glib::RefPtr<Gio::File>& file)
{
const auto basename = file->get_basename();
- auto scrolled = Gtk::manage(new Gtk::ScrolledWindow());
+ auto scrolled = Gtk::make_managed<Gtk::ScrolledWindow>();
scrolled->set_hexpand(true);
scrolled->set_vexpand(true);
scrolled->show();
- auto view = Gtk::manage(new Gtk::TextView());
+ auto view = Gtk::make_managed<Gtk::TextView>();
view->set_editable(false);
view->set_cursor_visible(false);
view->show();
@@ -268,7 +268,7 @@ void ExampleAppWindow::update_words()
// Add new child buttons, one per unique word.
for (const auto& word : words)
{
- auto row = Gtk::manage(new Gtk::Button(word));
+ auto row = Gtk::make_managed<Gtk::Button>(word);
row->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this,
&ExampleAppWindow::on_find_word), row));
row->show();
diff --git a/examples/book/builder/derived/deriveddialog.cc b/examples/book/builder/derived/deriveddialog.cc
index 2bf7208..7e18417 100644
--- a/examples/book/builder/derived/deriveddialog.cc
+++ b/examples/book/builder/derived/deriveddialog.cc
@@ -38,7 +38,7 @@ DerivedDialog::DerivedDialog(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Bu
: DerivedDialog(cobject, refGlade) // Delegate to the other constructor
{
// Show an icon.
- auto pImage = Gtk::manage(new Gtk::Image());
+ 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);
diff --git a/examples/book/buttonbox/examplebuttonbox.cc b/examples/book/buttonbox/examplebuttonbox.cc
index 1aa5fba..10c89be 100644
--- a/examples/book/buttonbox/examplebuttonbox.cc
+++ b/examples/book/buttonbox/examplebuttonbox.cc
@@ -26,7 +26,7 @@ ExampleButtonBox::ExampleButtonBox(bool horizontal,
m_Button_Help("Help")
{
auto orientation = horizontal ? Gtk::Orientation::HORIZONTAL : Gtk::Orientation::VERTICAL;
- auto bbox = Gtk::manage(new Gtk::ButtonBox(orientation));
+ auto bbox = Gtk::make_managed<Gtk::ButtonBox>(orientation);
if (!horizontal)
{
diff --git a/examples/book/buttonbox/examplewindow.cc b/examples/book/buttonbox/examplewindow.cc
index 824de91..4dac080 100644
--- a/examples/book/buttonbox/examplewindow.cc
+++ b/examples/book/buttonbox/examplewindow.cc
@@ -36,25 +36,21 @@ ExampleWindow::ExampleWindow()
m_Frame_Horizontal.add(m_VBox);
m_VBox.set_spacing(5);
- m_VBox.pack_start(*Gtk::manage(
- new ExampleButtonBox(true, "Spread (spacing 40)", 40,
- Gtk::ButtonBoxStyle::SPREAD)),
- Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
+ (true, "Spread (spacing 40)", 40, Gtk::ButtonBoxStyle::SPREAD),
+ Gtk::PackOptions::EXPAND_WIDGET);
- m_VBox.pack_start(*Gtk::manage(
- new ExampleButtonBox(true, "Edge (spacing 30)", 30,
- Gtk::ButtonBoxStyle::EDGE)),
- Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
+ (true, "Edge (spacing 30)", 30, Gtk::ButtonBoxStyle::EDGE),
+ Gtk::PackOptions::EXPAND_WIDGET);
- m_VBox.pack_start(*Gtk::manage(
- new ExampleButtonBox(true, "Start (spacing 20)", 20,
- Gtk::ButtonBoxStyle::START)),
- Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
+ (true, "Start (spacing 20)", 20, Gtk::ButtonBoxStyle::START),
+ Gtk::PackOptions::EXPAND_WIDGET);
- m_VBox.pack_start(*Gtk::manage(
- new ExampleButtonBox(true, "End (spacing 10)", 10,
- Gtk::ButtonBoxStyle::END)),
- Gtk::PackOptions::EXPAND_WIDGET);
+ m_VBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
+ (true, "End (spacing 10)", 10, Gtk::ButtonBoxStyle::END),
+ Gtk::PackOptions::EXPAND_WIDGET);
//The vertical ButtonBoxes:
@@ -64,24 +60,21 @@ ExampleWindow::ExampleWindow()
m_Frame_Vertical.add(m_HBox);
m_HBox.set_spacing(5);
- m_HBox.pack_start(*Gtk::manage(
- new ExampleButtonBox(false, "Spread (spacing 5)", 5,
- Gtk::ButtonBoxStyle::SPREAD)),
- Gtk::PackOptions::EXPAND_WIDGET);
-
- m_HBox.pack_start(*Gtk::manage(
- new ExampleButtonBox(false, "Edge (spacing 30)", 30,
- Gtk::ButtonBoxStyle::EDGE)),
- Gtk::PackOptions::EXPAND_WIDGET);
-
- m_HBox.pack_start(*Gtk::manage(
- new ExampleButtonBox(false, "Start (spacing 20)", 20,
- Gtk::ButtonBoxStyle::START)),
- Gtk::PackOptions::EXPAND_WIDGET);
-
- m_HBox.pack_start(*Gtk::manage(new ExampleButtonBox(false, "End (spacing 10)",
- 10, Gtk::ButtonBoxStyle::END)),
- Gtk::PackOptions::EXPAND_WIDGET);
+ m_HBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
+ (false, "Spread (spacing 5)", 5, Gtk::ButtonBoxStyle::SPREAD),
+ Gtk::PackOptions::EXPAND_WIDGET);
+
+ m_HBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
+ (false, "Edge (spacing 30)", 30, Gtk::ButtonBoxStyle::EDGE),
+ Gtk::PackOptions::EXPAND_WIDGET);
+
+ m_HBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
+ (false, "Start (spacing 20)", 20, Gtk::ButtonBoxStyle::START),
+ Gtk::PackOptions::EXPAND_WIDGET);
+
+ m_HBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
+ (false, "End (spacing 10)", 10, Gtk::ButtonBoxStyle::END),
+ Gtk::PackOptions::EXPAND_WIDGET);
}
ExampleWindow::~ExampleWindow()
diff --git a/examples/book/flowbox/examplewindow.cc b/examples/book/flowbox/examplewindow.cc
index 6e10482..d04cb4c 100644
--- a/examples/book/flowbox/examplewindow.cc
+++ b/examples/book/flowbox/examplewindow.cc
@@ -50,8 +50,8 @@ ExampleWindow::~ExampleWindow()
Gtk::Button* ExampleWindow::create_color_swatch(int swatch_i)
{
- auto drawing_area = Gtk::manage(new Gtk::DrawingArea());
- auto color_swatch = Gtk::manage(new Gtk::Button());
+ auto drawing_area = Gtk::make_managed<Gtk::DrawingArea>();
+ auto color_swatch = Gtk::make_managed<Gtk::Button>();
drawing_area->set_content_width(24);
drawing_area->set_content_height(24);
diff --git a/examples/book/idle/idleexample.cc b/examples/book/idle/idleexample.cc
index efb45ad..92a9366 100644
--- a/examples/book/idle/idleexample.cc
+++ b/examples/book/idle/idleexample.cc
@@ -26,17 +26,17 @@ IdleExample::IdleExample() :
// Adding a few widgets:
add(m_Box);
- m_Box.pack_start( *Gtk::manage(new Gtk::Label("Formatting Windows drive C:")));
- m_Box.pack_start( *Gtk::manage(new Gtk::Label("100 MB")) );
+ 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.pack_start( *Gtk::manage(new Gtk::Label("")) );
+ m_Box.pack_start(*Gtk::make_managed<Gtk::Label>(""));
- m_Box.pack_start( *Gtk::manage(new Gtk::Label("Formatting Windows drive D:")));
- m_Box.pack_start( *Gtk::manage(new Gtk::Label("5000 MB")) );
+ 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);
- auto hbox = Gtk::manage( new Gtk::Box(Gtk::Orientation::HORIZONTAL,10));
+ 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);
diff --git a/examples/book/listbox/examplewindow.cc b/examples/book/listbox/examplewindow.cc
index 15f6d02..f44c8c7 100644
--- a/examples/book/listbox/examplewindow.cc
+++ b/examples/book/listbox/examplewindow.cc
@@ -99,15 +99,15 @@ ExampleWindow::ExampleWindow() :
m_ListBox.signal_row_activated().connect(sigc::mem_fun(*this, &ExampleWindow::on_row_activated));
// Add some rows to the ListBox.
- auto row = Gtk::manage(new ExampleRow("blah4", 4));
+ auto row = Gtk::make_managed<ExampleRow>("blah4", 4);
m_ListBox.append(*row);
m_ListBox.append(m_Row3); // blah3
- row = Gtk::manage(new ExampleRow("blah1", 1));
+ row = Gtk::make_managed<ExampleRow>("blah1", 1);
m_ListBox.append(*row);
- row = Gtk::manage(new ExampleRow("blah2", 2));
+ row = Gtk::make_managed<ExampleRow>("blah2", 2);
m_ListBox.append(*row);
- row = Gtk::manage(new ExampleRow("", 0));
+ 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);
@@ -116,7 +116,7 @@ ExampleWindow::ExampleWindow() :
row->add(m_VBox_Row);
m_ListBox.append(*row);
- row = Gtk::manage(new ExampleRow("", 0));
+ row = Gtk::make_managed<ExampleRow>("", 0);
m_Button_Row2.set_hexpand(false);
m_Button_Row2.set_halign(Gtk::Align::START);
row->add(m_Button_Row2);
@@ -225,7 +225,7 @@ void ExampleWindow::on_add_clicked()
{
static int new_button_nr = 1;
const Glib::ustring text = "blah2 new " + Glib::ustring::format(new_button_nr);
- auto new_row = Gtk::manage(new ExampleRow(text, new_button_nr));
+ auto new_row = Gtk::make_managed<ExampleRow>(text, new_button_nr);
m_ListBox.append(*new_row);
++new_button_nr;
}
@@ -248,10 +248,10 @@ void ExampleWindow::update_header_func(Gtk::ListBoxRow* row, Gtk::ListBoxRow* be
// Create header if needed.
if (!row->get_header())
{
- auto hbox = Gtk::manage(new Gtk::Box(Gtk::Orientation::HORIZONTAL));
- auto label = Gtk::manage(new Gtk::Label("Header"));
+ 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);
- auto button = Gtk::manage(new Gtk::Button("button"));
+ auto button = Gtk::make_managed<Gtk::Button>("button");
hbox->pack_start(*button, Gtk::PackOptions::SHRINK);
row->set_header(*hbox);
}
diff --git a/examples/book/listmodel/examplewindow.cc b/examples/book/listmodel/examplewindow.cc
index 99e244b..0108a8c 100644
--- a/examples/book/listmodel/examplewindow.cc
+++ b/examples/book/listmodel/examplewindow.cc
@@ -85,7 +85,7 @@ Gtk::Widget* ExampleWindow::on_create_widget1(const Glib::RefPtr<Glib::Object>&
std::cout << "on_create_widget1(): item is not a MyObject" << std::endl;
return nullptr;
}
- auto label = Gtk::manage(new Gtk::Label());
+ auto label = Gtk::make_managed<Gtk::Label>();
Glib::Binding::bind_property(obj->property_label(), label->property_label(),
Glib::Binding::Flags::SYNC_CREATE);
return label;
@@ -99,7 +99,7 @@ Gtk::Widget* ExampleWindow::on_create_widget2(const Glib::RefPtr<MyObject>& item
std::cout << "on_create_widget2(): item is empty" << std::endl;
return nullptr;
}
- auto label = Gtk::manage(new Gtk::Label());
+ auto label = Gtk::make_managed<Gtk::Label>();
Glib::Binding::bind_property(item->property_label(), label->property_label(),
Glib::Binding::Flags::SYNC_CREATE);
return label;
diff --git a/examples/book/menus_and_toolbars/examplewindow.cc
b/examples/book/menus_and_toolbars/examplewindow.cc
index 14672c6..8fa710d 100644
--- a/examples/book/menus_and_toolbars/examplewindow.cc
+++ b/examples/book/menus_and_toolbars/examplewindow.cc
@@ -136,7 +136,7 @@ ExampleWindow::ExampleWindow(const Glib::RefPtr<Gtk::Application>& app)
g_warning("GMenu not found");
else
{
- auto pMenuBar = Gtk::manage(new Gtk::MenuBar(gmenu));
+ auto pMenuBar = Gtk::make_managed<Gtk::MenuBar>(gmenu);
//Add the MenuBar to the window:
m_Box.pack_start(*pMenuBar, Gtk::PackOptions::SHRINK);
diff --git a/examples/book/printing/advanced/examplewindow.cc
b/examples/book/printing/advanced/examplewindow.cc
index a752867..8c63b04 100644
--- a/examples/book/printing/advanced/examplewindow.cc
+++ b/examples/book/printing/advanced/examplewindow.cc
@@ -226,7 +226,7 @@ void ExampleWindow::build_main_menu(const Glib::RefPtr<Gtk::Application>& app)
g_warning("GMenu not found");
else
{
- auto pMenuBar = Gtk::manage(new Gtk::MenuBar(gmenu));
+ auto pMenuBar = Gtk::make_managed<Gtk::MenuBar>(gmenu);
// Add the MenuBar to the window:
m_VBox.pack_start(*pMenuBar, Gtk::PackOptions::SHRINK);
diff --git a/examples/book/printing/advanced/printformoperation.cc
b/examples/book/printing/advanced/printformoperation.cc
index 88b3e71..ff48fe6 100644
--- a/examples/book/printing/advanced/printformoperation.cc
+++ b/examples/book/printing/advanced/printformoperation.cc
@@ -154,14 +154,14 @@ Gtk::Widget* PrintFormOperation::on_create_custom_widget()
//Create a custom tab in the print dialog titled "Other"
set_custom_tab_label("Other");
- auto vbox = Gtk::manage(new Gtk::Box(Gtk::Orientation::VERTICAL));
+ auto vbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL);
vbox->set_margin(12);
- auto hbox = Gtk::manage(new Gtk::Box(Gtk::Orientation::HORIZONTAL, 8));
+ auto hbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL, 8);
vbox->pack_start(*hbox, Gtk::PackOptions::SHRINK);
hbox->set_margin(6);
- auto label = Gtk::manage(new Gtk::Label("Choose a font: "));
+ auto label = Gtk::make_managed<Gtk::Label>("Choose a font: ");
hbox->pack_start(*label, Gtk::PackOptions::SHRINK);
m_FontButton.set_font(m_Font);
diff --git a/examples/book/printing/simple/examplewindow.cc b/examples/book/printing/simple/examplewindow.cc
index a752867..8c63b04 100644
--- a/examples/book/printing/simple/examplewindow.cc
+++ b/examples/book/printing/simple/examplewindow.cc
@@ -226,7 +226,7 @@ void ExampleWindow::build_main_menu(const Glib::RefPtr<Gtk::Application>& app)
g_warning("GMenu not found");
else
{
- auto pMenuBar = Gtk::manage(new Gtk::MenuBar(gmenu));
+ auto pMenuBar = Gtk::make_managed<Gtk::MenuBar>(gmenu);
// Add the MenuBar to the window:
m_VBox.pack_start(*pMenuBar, Gtk::PackOptions::SHRINK);
diff --git a/examples/book/range_widgets/examplewindow.cc b/examples/book/range_widgets/examplewindow.cc
index 12b5367..0bccefc 100644
--- a/examples/book/range_widgets/examplewindow.cc
+++ b/examples/book/range_widgets/examplewindow.cc
@@ -106,14 +106,14 @@ ExampleWindow::ExampleWindow()
m_VBox2.pack_start(m_HBox_Combo, Gtk::PackOptions::SHRINK);
m_HBox_Combo.pack_start(
- *Gtk::manage(new Gtk::Label("Scale Value Position:", 0)), Gtk::PackOptions::SHRINK);
+ *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_ComboBox_Position.signal_changed().connect( sigc::mem_fun(*this, &ExampleWindow::on_combo_position) );
m_ComboBox_Position.set_active(0); // Top
//Digits:
m_HBox_Digits.pack_start(
- *Gtk::manage(new Gtk::Label("Scale Digits:", 0)), Gtk::PackOptions::SHRINK);
+ *Gtk::make_managed<Gtk::Label>("Scale Digits:", 0), Gtk::PackOptions::SHRINK);
m_Scale_Digits.set_digits(0);
m_adjustment_digits->signal_value_changed().connect(sigc::mem_fun(*this,
&ExampleWindow::on_adjustment1_value_changed));
@@ -121,8 +121,7 @@ ExampleWindow::ExampleWindow()
//Page Size:
m_HBox_PageSize.pack_start(
- *Gtk::manage(new Gtk::Label("Scrollbar Page Size:", 0)),
- Gtk::PackOptions::SHRINK);
+ *Gtk::make_managed<Gtk::Label>("Scrollbar Page Size:", 0), Gtk::PackOptions::SHRINK);
m_Scale_PageSize.set_digits(0);
m_adjustment_pagesize->signal_value_changed().connect(sigc::mem_fun(*this,
&ExampleWindow::on_adjustment2_value_changed));
diff --git a/examples/book/recent_files/examplewindow.cc b/examples/book/recent_files/examplewindow.cc
index ac081a2..b1523a7 100644
--- a/examples/book/recent_files/examplewindow.cc
+++ b/examples/book/recent_files/examplewindow.cc
@@ -124,7 +124,7 @@ ExampleWindow::ExampleWindow(const Glib::RefPtr<Gtk::Application>& app)
if (gmenu)
{
//Menubar:
- auto pMenubar = Gtk::manage(new Gtk::MenuBar(gmenu));
+ auto pMenubar = Gtk::make_managed<Gtk::MenuBar>(gmenu);
m_Box.pack_start(*pMenubar, Gtk::PackOptions::SHRINK);
}
else
diff --git a/examples/book/scrolledwindow/examplewindow.cc b/examples/book/scrolledwindow/examplewindow.cc
index 8be849b..2240628 100644
--- a/examples/book/scrolledwindow/examplewindow.cc
+++ b/examples/book/scrolledwindow/examplewindow.cc
@@ -48,7 +48,7 @@ ExampleWindow::ExampleWindow()
{
char buffer[32];
sprintf(buffer, "button (%d,%d)\n", i, j);
- auto pButton = Gtk::manage(new Gtk::ToggleButton(buffer));
+ auto pButton = Gtk::make_managed<Gtk::ToggleButton>(buffer);
m_Grid.attach(*pButton, i, j, 1, 1);
}
}
diff --git a/examples/book/toolbar/examplewindow.cc b/examples/book/toolbar/examplewindow.cc
index 76911e4..d17c703 100644
--- a/examples/book/toolbar/examplewindow.cc
+++ b/examples/book/toolbar/examplewindow.cc
@@ -46,15 +46,15 @@ ExampleWindow::ExampleWindow()
m_Toolbar.set_toolbar_style(Gtk::ToolbarStyle::BOTH);
- auto item = Gtk::manage(new Gtk::ToolButton("Click me"));
+ auto item = Gtk::make_managed<Gtk::ToolButton>("Click me");
//item.set_tooltips(*tooltips, "Toolbar item");
m_Toolbar.append(*item);
item->signal_clicked().connect( sigc::mem_fun(*this,
&ExampleWindow::on_toolbar_item) );
- m_Toolbar.append( *(Gtk::manage(new Gtk::SeparatorToolItem)) );
+ m_Toolbar.append(*Gtk::make_managed<Gtk::SeparatorToolItem>());
- item = Gtk::manage(new Gtk::ToolButton("_Save"));
+ item = Gtk::make_managed<Gtk::ToolButton>("_Save");
item->set_use_underline();
item->set_icon_name("document-save");
item->set_homogeneous(false);
@@ -62,19 +62,16 @@ ExampleWindow::ExampleWindow()
item->signal_clicked().connect( sigc::mem_fun(*this,
&ExampleWindow::on_toolbar_item) );
- item = Gtk::manage(new Gtk::ToggleToolButton("Toggle me"));
+ item = Gtk::make_managed<Gtk::ToggleToolButton>("Toggle me");
//item.set_tooltips(*tooltips, "toggle duh");
m_Toolbar.append(*item);
item->signal_clicked().connect( sigc::mem_fun(*this,
&ExampleWindow::on_toolbar_item) );
Gtk::RadioButtonGroup group;
- m_Toolbar.append( *Gtk::manage(
- new Gtk::RadioToolButton(group, "Radio 1")) );
- m_Toolbar.append( *Gtk::manage(
- new Gtk::RadioToolButton(group, "Radio 2")) );
- m_Toolbar.append( *Gtk::manage(
- new Gtk::RadioToolButton(group, "Radio 3")) );
+ m_Toolbar.append(*Gtk::make_managed<Gtk::RadioToolButton>(group, "Radio 1"));
+ m_Toolbar.append(*Gtk::make_managed<Gtk::RadioToolButton>(group, "Radio 2"));
+ m_Toolbar.append(*Gtk::make_managed<Gtk::RadioToolButton>(group, "Radio 3"));
}
}
diff --git a/examples/book/tooltips/examplewindow.cc b/examples/book/tooltips/examplewindow.cc
index 86a9fd5..59df6be 100644
--- a/examples/book/tooltips/examplewindow.cc
+++ b/examples/book/tooltips/examplewindow.cc
@@ -55,8 +55,7 @@ ExampleWindow::ExampleWindow()
//Button's custom tooltip window:
m_button_tooltip_window.set_default_size(250, 30);
- Gtk::Label* label =
- Gtk::manage(new Gtk::Label("A label in a custom tooltip window"));
+ auto label = Gtk::make_managed<Gtk::Label>("A label in a custom tooltip window");
label->show();
m_button_tooltip_window.add(*label);
diff --git a/examples/book/treeview/combo_renderer/examplewindow.cc
b/examples/book/treeview/combo_renderer/examplewindow.cc
index e875e5f..cb04172 100644
--- a/examples/book/treeview/combo_renderer/examplewindow.cc
+++ b/examples/book/treeview/combo_renderer/examplewindow.cc
@@ -92,10 +92,8 @@ ExampleWindow::ExampleWindow()
m_TreeView.append_column("Name", m_Columns.m_col_name);
//Create a Combo CellRenderer, instead of the default Text CellRenderer:
- auto pColumn = Gtk::manage(
- new Gtk::TreeView::Column("Item Chosen") );
- auto pRenderer = Gtk::manage(
- new Gtk::CellRendererCombo);
+ auto pColumn = Gtk::make_managed<Gtk::TreeView::Column>("Item Chosen");
+ auto pRenderer = Gtk::make_managed<Gtk::CellRendererCombo>();
pColumn->pack_start(*pRenderer);
m_TreeView.append_column(*pColumn);
diff --git a/examples/book/treeview/list/examplewindow.cc b/examples/book/treeview/list/examplewindow.cc
index b876218..052c329 100644
--- a/examples/book/treeview/list/examplewindow.cc
+++ b/examples/book/treeview/list/examplewindow.cc
@@ -74,7 +74,7 @@ ExampleWindow::ExampleWindow()
"%010d" /* 10 digits, using leading zeroes. */);
//Display a progress bar instead of a decimal number:
- auto cell = Gtk::manage(new Gtk::CellRendererProgress);
+ auto cell = Gtk::make_managed<Gtk::CellRendererProgress>();
int cols_count = m_TreeView.append_column("Some percentage", *cell);
auto pColumn = m_TreeView.get_column(cols_count - 1);
if(pColumn)
diff --git a/examples/book/treeview/popup/treeview_withpopup.cc
b/examples/book/treeview/popup/treeview_withpopup.cc
index 456b35c..fcfd9f7 100644
--- a/examples/book/treeview/popup/treeview_withpopup.cc
+++ b/examples/book/treeview/popup/treeview_withpopup.cc
@@ -41,17 +41,17 @@ TreeView_WithPopup::TreeView_WithPopup()
append_column("Name", m_Columns.m_col_name);
//Fill popup menu:
- auto item = Gtk::manage(new Gtk::MenuItem("_Edit", true));
+ auto item = Gtk::make_managed<Gtk::MenuItem>("_Edit", true);
item->signal_activate().connect(
sigc::mem_fun(*this, &TreeView_WithPopup::on_menu_file_popup_generic) );
m_Menu_Popup.append(*item);
- item = Gtk::manage(new Gtk::MenuItem("_Process", true));
+ item = Gtk::make_managed<Gtk::MenuItem>("_Process", true);
item->signal_activate().connect(
sigc::mem_fun(*this, &TreeView_WithPopup::on_menu_file_popup_generic) );
m_Menu_Popup.append(*item);
- item = Gtk::manage(new Gtk::MenuItem("_Remove", true));
+ item = Gtk::make_managed<Gtk::MenuItem>("_Remove", true);
item->signal_activate().connect(
sigc::mem_fun(*this, &TreeView_WithPopup::on_menu_file_popup_generic) );
m_Menu_Popup.append(*item);
diff --git a/examples/others/arrow/arrow.cc b/examples/others/arrow/arrow.cc
index c2690c2..bb5c3cf 100644
--- a/examples/others/arrow/arrow.cc
+++ b/examples/others/arrow/arrow.cc
@@ -53,7 +53,7 @@ AppWindow::AppWindow()
set_title ("Arrow Buttons");
/* Create a grid to hold the arrows/buttons */
- grid = Gtk::manage (new Gtk::Grid ());
+ grid = Gtk::make_managed<Gtk::Grid>();
grid->set_row_homogeneous(true);
grid->set_column_homogeneous(true);
@@ -61,17 +61,17 @@ AppWindow::AppWindow()
grid->set_margin(12);
/* Pack and show all our widgets */
- button = Gtk::manage(new ArrowButton(Gtk::ArrowType::UP));
- grid->attach (*button, 1, 0);
+ button = Gtk::make_managed<ArrowButton>(Gtk::ArrowType::UP);
+ grid->attach(*button, 1, 0);
- button = Gtk::manage(new ArrowButton(Gtk::ArrowType::LEFT));
- grid->attach (*button, 0, 1);
+ button = Gtk::make_managed<ArrowButton>(Gtk::ArrowType::LEFT);
+ grid->attach(*button, 0, 1);
- button = Gtk::manage(new ArrowButton(Gtk::ArrowType::RIGHT));
- grid->attach (*button, 2, 1);
+ button = Gtk::make_managed<ArrowButton>(Gtk::ArrowType::RIGHT);
+ grid->attach(*button, 2, 1);
- button = Gtk::manage(new ArrowButton(Gtk::ArrowType::DOWN));
- grid->attach (*button, 1, 2);
+ button = Gtk::make_managed<ArrowButton>(Gtk::ArrowType::DOWN);
+ grid->attach(*button, 1, 2);
grid->set_row_spacing(5);
grid->set_column_spacing(5);
diff --git a/examples/others/calendar/calendar.cc b/examples/others/calendar/calendar.cc
index be322cf..71ff7e6 100644
--- a/examples/others/calendar/calendar.cc
+++ b/examples/others/calendar/calendar.cc
@@ -175,7 +175,7 @@ CalendarExample::CalendarExample()
set_resizable(false);
- auto vbox = Gtk::manage(new Gtk::Box(Gtk::Orientation::VERTICAL, DEF_PAD * 2));
+ auto vbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL, DEF_PAD * 2);
vbox->set_margin(5);
add(*vbox);
@@ -183,16 +183,16 @@ CalendarExample::CalendarExample()
* The top part of the CalendarExample, flags and fontsel.
*/
- auto hbox = Gtk::manage(new Gtk::Box(Gtk::Orientation::HORIZONTAL, DEF_PAD));
+ auto hbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL, DEF_PAD);
vbox->pack_start(*hbox, Gtk::PackOptions::EXPAND_WIDGET);
- auto hbbox = Gtk::manage(new Gtk::ButtonBox());
+ auto hbbox = Gtk::make_managed<Gtk::ButtonBox>();
hbox->pack_start(*hbbox, Gtk::PackOptions::SHRINK);
hbbox->set_margin_end(DEF_PAD);
hbbox->set_layout(Gtk::ButtonBoxStyle::SPREAD);
hbbox->set_spacing(5);
/* Calendar widget */
- auto frame = Gtk::manage(new Gtk::Frame("Calendar"));
+ auto frame = Gtk::make_managed<Gtk::Frame>("Calendar");
hbbox->pack_start(*frame, Gtk::PackOptions::EXPAND_WIDGET);
frame->set_margin_start(DEF_PAD);
frame->set_margin_end(DEF_PAD);
@@ -204,20 +204,20 @@ CalendarExample::CalendarExample()
calendar_->signal_day_selected().connect(sigc::mem_fun(*this, &CalendarExample::day_selected));
calendar_->signal_day_selected_double_click().connect(sigc::mem_fun(*this,
&CalendarExample::day_selected_double_click));
- auto separator = Gtk::manage(new Gtk::Separator(Gtk::Orientation::VERTICAL));
+ auto separator = Gtk::make_managed<Gtk::Separator>(Gtk::Orientation::VERTICAL);
hbox->pack_start (*separator, Gtk::PackOptions::SHRINK);
- auto vbox2 = Gtk::manage(new Gtk::Box(Gtk::Orientation::VERTICAL, DEF_PAD));
+ auto vbox2 = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL, DEF_PAD);
hbox->pack_start(*vbox2, Gtk::PackOptions::SHRINK);
vbox2->set_margin_start(DEF_PAD);
vbox2->set_margin_end(DEF_PAD);
/* Build the Right frame with the flags in */
- auto frameFlags = Gtk::manage(new Gtk::Frame("Flags"));
+ auto frameFlags = Gtk::make_managed<Gtk::Frame>("Flags");
vbox2->pack_start(*frameFlags, Gtk::PackOptions::EXPAND_WIDGET);
frameFlags->set_margin_end(DEF_PAD);
- auto vbox3 = Gtk::manage(new Gtk::Box(Gtk::Orientation::VERTICAL, DEF_PAD_SMALL));
+ auto vbox3 = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL, DEF_PAD_SMALL);
frameFlags->add(*vbox3);
struct {
@@ -240,7 +240,7 @@ CalendarExample::CalendarExample()
}
/* Build the right font-button */
- font_button_ = Gtk::manage(new Gtk::FontButton());
+ 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);
@@ -258,37 +258,37 @@ CalendarExample::CalendarExample()
/*
* Build the Signal-event part.
*/
- frame = Gtk::manage(new Gtk::Frame("Signal events"));
+ frame = Gtk::make_managed<Gtk::Frame>("Signal events");
vbox->pack_start(*frame, Gtk::PackOptions::EXPAND_WIDGET);
- vbox2 = Gtk::manage(new Gtk::Box(Gtk::Orientation::VERTICAL, DEF_PAD_SMALL));
+ vbox2 = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL, DEF_PAD_SMALL);
frame->add(*vbox2);
- hbox = Gtk::manage(new Gtk::Box(Gtk::Orientation::HORIZONTAL, 5));
+ hbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL, 5);
vbox2->pack_start (*hbox, Gtk::PackOptions::SHRINK);
- auto label = Gtk::manage(new Gtk::Label("Day selected:"));
+ auto label = Gtk::make_managed<Gtk::Label>("Day selected:");
hbox->pack_start (*label, Gtk::PackOptions::SHRINK);
label_selected_ = new Gtk::Label("");
hbox->pack_start (*label_selected_, Gtk::PackOptions::SHRINK);
- hbox = Gtk::manage(new Gtk::Box(Gtk::Orientation::HORIZONTAL, 5));
+ hbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL, 5);
vbox2->pack_start (*hbox, Gtk::PackOptions::SHRINK);
- label = Gtk::manage(new Gtk::Label("Day selected double click:"));
+ label = Gtk::make_managed<Gtk::Label>("Day selected double click:");
hbox->pack_start (*label, Gtk::PackOptions::SHRINK);
label_selected_double_click_ = new Gtk::Label("");
hbox->pack_start (*label_selected_double_click_, Gtk::PackOptions::SHRINK);
- hbox = Gtk::manage(new Gtk::Box(Gtk::Orientation::HORIZONTAL, 5));
+ hbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL, 5);
vbox2->pack_start (*hbox, Gtk::PackOptions::SHRINK);
- label = Gtk::manage(new Gtk::Label("Month change:"));
+ label = Gtk::make_managed<Gtk::Label>("Month change:");
hbox->pack_start (*label, Gtk::PackOptions::SHRINK);
label_month_ = new Gtk::Label("");
hbox->pack_start(*label_month_, Gtk::PackOptions::SHRINK);
- auto bbox = Gtk::manage(new Gtk::ButtonBox());
+ auto bbox = Gtk::make_managed<Gtk::ButtonBox>();
vbox->pack_start(*bbox, Gtk::PackOptions::SHRINK);
bbox->set_layout(Gtk::ButtonBoxStyle::END);
- auto button = Gtk::manage(new Gtk::Button("Close"));
+ auto button = Gtk::make_managed<Gtk::Button>("Close");
button->signal_clicked().connect(
sigc::mem_fun(*this, &CalendarExample::on_button_close));
bbox->add(*button);
diff --git a/examples/others/cellrenderercustom/cellrendererlist.cc
b/examples/others/cellrenderercustom/cellrendererlist.cc
index b0d26de..1b6815e 100644
--- a/examples/others/cellrenderercustom/cellrendererlist.cc
+++ b/examples/others/cellrenderercustom/cellrendererlist.cc
@@ -57,8 +57,8 @@ CellRendererList::CellRendererList()
selection->set_mode(Gtk::SelectionMode::BROWSE);
selection->signal_changed().connect(sigc::mem_fun(*this, &Self::on_tree_selection_changed));
- Gtk::Frame *const frame = new Gtk::Frame();
- get_popup_window()->add(*Gtk::manage(frame));
+ Gtk::Frame *const frame = Gtk::make_managed<Gtk::Frame>();
+ get_popup_window()->add(*frame);
frame->add(tree_view_);
frame->set_shadow_type(Gtk::ShadowType::OUT);
diff --git a/examples/others/dnd/dndwindow.cc b/examples/others/dnd/dndwindow.cc
index 1fc6424..adc1252 100644
--- a/examples/others/dnd/dndwindow.cc
+++ b/examples/others/dnd/dndwindow.cc
@@ -238,7 +238,7 @@ void DnDWindow::create_popup()
m_PopupWindow.set_position(Gtk::WindowPosition::MOUSE);
//Create Grid and fill it:
- auto pGrid = Gtk::manage(new Gtk::Grid());
+ auto pGrid = Gtk::make_managed<Gtk::Grid>();
for(int i = 0; i < 3; i++)
{
@@ -246,7 +246,7 @@ void DnDWindow::create_popup()
{
char buffer[128];
g_snprintf(buffer, sizeof(buffer), "%d,%d", i, j);
- auto pButton = Gtk::manage(new Gtk::Button(buffer));
+ auto pButton = Gtk::make_managed<Gtk::Button>(buffer);
pGrid->attach(*pButton, i, j, 1, 1);
pButton->drag_dest_set(Gdk::ContentFormats::create(m_listTargetsNoRoot), Gtk::DestDefaults::ALL,
Gdk::DragAction::COPY | Gdk::DragAction::MOVE);
diff --git a/examples/others/idle/idle.cc b/examples/others/idle/idle.cc
index 0917f44..0bb4fdc 100644
--- a/examples/others/idle/idle.cc
+++ b/examples/others/idle/idle.cc
@@ -40,20 +40,20 @@ IdleExample::IdleExample() :
m_quit.signal_clicked().connect(sigc::mem_fun(*this, &Gtk::Widget::hide));
// put buttons into container
- Gtk::Box *vbox = manage( new Gtk::Box(Gtk::Orientation::VERTICAL,5));
+ auto vbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL,5);
// adding a few widgets
- vbox->pack_start(* manage(new Gtk::Label("Formatting windows drive C:")));
- vbox->pack_start(* manage(new Gtk::Label("100 MB")));
+ 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->pack_start(* manage(new Gtk::Label("")));
+ vbox->pack_start(*Gtk::make_managed<Gtk::Label>(""));
- vbox->pack_start(* manage(new Gtk::Label("Formatting windows drive D:")));
- vbox->pack_start(* manage(new Gtk::Label("5000 MB")));
+ 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);
- Gtk::Box *hbox = manage( new Gtk::Box(Gtk::Orientation::HORIZONTAL,10));
+ 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);
diff --git a/examples/others/tictactoe/tictactoe.cc b/examples/others/tictactoe/tictactoe.cc
index a5ef440..4658d43 100644
--- a/examples/others/tictactoe/tictactoe.cc
+++ b/examples/others/tictactoe/tictactoe.cc
@@ -24,17 +24,17 @@
TicTacToe::TicTacToe()
: Gtk::Box(Gtk::Orientation::VERTICAL)
{
- auto grid = Gtk::manage( new Gtk::Grid() );
+ auto grid = Gtk::make_managed<Gtk::Grid>();
grid->set_row_homogeneous(true);
grid->set_column_homogeneous(true);
- add( *grid);
+ add(*grid);
for(int i=0;i<3; i++)
{
for(int j=0;j<3; j++)
{
Gtk::ToggleButton* button = nullptr;
- buttons[i][j] = button = Gtk::manage( new Gtk::ToggleButton());
+ buttons[i][j] = button = Gtk::make_managed<Gtk::ToggleButton>();
grid->attach(*button, i, j);
button->signal_toggled().connect( sigc::bind(
sigc::mem_fun(*this, &TicTacToe::toggle),
diff --git a/examples/others/tictactoe/ttt_test.cc b/examples/others/tictactoe/ttt_test.cc
index 6433731..0bc556e 100644
--- a/examples/others/tictactoe/ttt_test.cc
+++ b/examples/others/tictactoe/ttt_test.cc
@@ -16,7 +16,7 @@ main (int argc, char *argv[])
{
auto app = Gtk::Application::create("org.gtkmm.example");
- auto ttt = manage( new TicTacToe );
+ auto ttt = Gtk::make_managed<TicTacToe>();
ttt->tictactoe.connect( sigc::bind (sigc::ptr_fun(&win), ttt) );
Gtk::Window window;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]