[gtkmm-documentation/gtkmm-3-24] 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/gtkmm-3-24] Replace most Gtk::manage() calls with Gtk::make_managed()
- Date: Fri, 9 Nov 2018 14:14:39 +0000 (UTC)
commit 8b63c8a5fa4c5dae3b327c603d9101928fab041e
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Fri Nov 9 15:10:23 2018 +0100
Replace most Gtk::manage() calls with Gtk::make_managed()
examples/book/box/examplewindow.cc | 23 ++++-----
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 | 6 +--
examples/book/buttonbox/examplewindow.cc | 57 +++++++++-------------
examples/book/flowbox/examplewindow.cc | 4 +-
examples/book/idle/idleexample.cc | 14 +++---
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 | 8 ++-
examples/book/recent_files/examplewindow.cc | 2 +-
examples/book/scrolledwindow/examplewindow.cc | 6 +--
examples/book/socket/socket.cc | 7 ++-
examples/book/toolbar/examplewindow.cc | 19 +++-----
examples/book/toolpalette/examplewindow.cc | 32 ++++++------
examples/book/tooltips/examplewindow.cc | 4 +-
.../book/treeview/combo_renderer/examplewindow.cc | 8 +--
examples/book/treeview/list/examplewindow.cc | 4 +-
examples/book/treeview/popup/treeview_withpopup.cc | 6 +--
examples/others/arrow/arrow.cc | 18 +++----
examples/others/calendar/calendar.cc | 38 +++++++--------
.../others/cellrenderercustom/cellrendererlist.cc | 6 +--
examples/others/dnd/dndwindow.cc | 8 ++-
examples/others/idle/idle.cc | 14 +++---
examples/others/tictactoe/tictactoe.cc | 4 +-
examples/others/tictactoe/ttt_test.cc | 2 +-
35 files changed, 157 insertions(+), 199 deletions(-)
---
diff --git a/examples/book/box/examplewindow.cc b/examples/book/box/examplewindow.cc
index ff655d1..a1bc6e1 100644
--- a/examples/book/box/examplewindow.cc
+++ b/examples/book/box/examplewindow.cc
@@ -1,5 +1,3 @@
-//$Id: examplewindow.cc 836 2007-05-09 03:02:38Z jjongsma $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2002 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -45,17 +43,17 @@ ExampleWindow::ExampleWindow(int which)
// Create a PackBox - homogeneous = false, spacing = 0,
// options = Gtk::PACK_SHRINK, padding = 0
- pPackBox1 = Gtk::manage(new PackBox(false, 0, Gtk::PACK_SHRINK));
+ pPackBox1 = Gtk::make_managed<PackBox>(false, 0, Gtk::PACK_SHRINK);
m_box1.pack_start(*pPackBox1, Gtk::PACK_SHRINK);
// Create a PackBox - homogeneous = false, spacing = 0,
// options = Gtk::PACK_EXPAND_PADDING, padding = 0
- pPackBox2 = Gtk::manage(new PackBox(false, 0, Gtk::PACK_EXPAND_PADDING));
+ pPackBox2 = Gtk::make_managed<PackBox>(false, 0, Gtk::PACK_EXPAND_PADDING);
m_box1.pack_start(*pPackBox2, Gtk::PACK_SHRINK);
// Create a PackBox - homogeneous = false, spacing = 0,
// options = Gtk::PACK_EXPAND_WIDGET, padding = 0
- pPackBox3 = Gtk::manage(new PackBox(false, 0, Gtk::PACK_EXPAND_WIDGET));
+ pPackBox3 = Gtk::make_managed<PackBox>(false, 0, Gtk::PACK_EXPAND_WIDGET);
m_box1.pack_start(*pPackBox3, Gtk::PACK_SHRINK);
// pack the separator into the vbox. Remember each of these
@@ -70,11 +68,11 @@ ExampleWindow::ExampleWindow(int which)
m_box1.pack_start(m_Label2, Gtk::PACK_SHRINK);
// Args are: homogeneous, spacing, options, padding
- pPackBox4 = Gtk::manage(new PackBox(true, 0, Gtk::PACK_EXPAND_PADDING));
+ pPackBox4 = Gtk::make_managed<PackBox>(true, 0, Gtk::PACK_EXPAND_PADDING);
m_box1.pack_start(*pPackBox4, Gtk::PACK_SHRINK);
// Args are: homogeneous, spacing, options, padding
- pPackBox5 = Gtk::manage(new PackBox(true, 0, Gtk::PACK_EXPAND_WIDGET));
+ pPackBox5 = Gtk::make_managed<PackBox>(true, 0, Gtk::PACK_EXPAND_WIDGET);
m_box1.pack_start(*pPackBox5, Gtk::PACK_SHRINK);
m_box1.pack_start(m_separator2, Gtk::PACK_SHRINK, 5);
@@ -90,10 +88,10 @@ ExampleWindow::ExampleWindow(int which)
m_Label1.set_valign(Gtk::ALIGN_START);
m_box1.pack_start(m_Label1, Gtk::PACK_SHRINK);
- pPackBox1 = Gtk::manage(new PackBox(false, 10, Gtk::PACK_EXPAND_PADDING));
+ pPackBox1 = Gtk::make_managed<PackBox>(false, 10, Gtk::PACK_EXPAND_PADDING);
m_box1.pack_start(*pPackBox1, Gtk::PACK_SHRINK);
- pPackBox2 = Gtk::manage(new PackBox(false, 10, Gtk::PACK_EXPAND_WIDGET));
+ pPackBox2 = Gtk::make_managed<PackBox>(false, 10, Gtk::PACK_EXPAND_WIDGET);
m_box1.pack_start(*pPackBox2, Gtk::PACK_SHRINK);
m_box1.pack_start(m_separator1, Gtk::PACK_SHRINK, 5);
@@ -103,10 +101,10 @@ ExampleWindow::ExampleWindow(int which)
m_Label2.set_valign(Gtk::ALIGN_START);
m_box1.pack_start(m_Label2, Gtk::PACK_SHRINK);
- pPackBox3 = Gtk::manage(new PackBox(false, 0, Gtk::PACK_SHRINK, 10));
+ pPackBox3 = Gtk::make_managed<PackBox>(false, 0, Gtk::PACK_SHRINK, 10);
m_box1.pack_start(*pPackBox3, Gtk::PACK_SHRINK);
- pPackBox4 = Gtk::manage(new PackBox(false, 0, Gtk::PACK_EXPAND_WIDGET, 10));
+ pPackBox4 = Gtk::make_managed<PackBox>(false, 0, Gtk::PACK_EXPAND_WIDGET, 10);
m_box1.pack_start(*pPackBox4, Gtk::PACK_SHRINK);
m_box1.pack_start(m_separator2, Gtk::PACK_SHRINK, 5);
@@ -118,7 +116,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::PACK_SHRINK));
+ pPackBox1 = Gtk::make_managed<PackBox>(false, 0, Gtk::PACK_SHRINK);
// create the label that will be put at the end.
m_Label1.set_text("end");
@@ -173,4 +171,3 @@ void ExampleWindow::on_button_quit_clicked()
{
hide();
}
-
diff --git a/examples/book/buildapp/step3/exampleappwindow.cc
b/examples/book/buildapp/step3/exampleappwindow.cc
index cab4477..31e038c 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 865f669..66bd536 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 04c4bdd..f2c9088 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 27ded70..a9e3af1 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 1421da6..402d96f 100644
--- a/examples/book/buildapp/step8/exampleappwindow.cc
+++ b/examples/book/buildapp/step8/exampleappwindow.cc
@@ -129,11 +129,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();
@@ -262,7 +262,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 8d27c0f..61c47cd 100644
--- a/examples/book/buildapp/step9/exampleappwindow.cc
+++ b/examples/book/buildapp/step9/exampleappwindow.cc
@@ -138,11 +138,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();
@@ -271,7 +271,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 bf73a81..266c2cc 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", Gtk::ICON_SIZE_DIALOG);
pImage->show_all();
get_content_area()->pack_start(*pImage);
diff --git a/examples/book/buttonbox/examplebuttonbox.cc b/examples/book/buttonbox/examplebuttonbox.cc
index 0374c10..dfd5f8a 100644
--- a/examples/book/buttonbox/examplebuttonbox.cc
+++ b/examples/book/buttonbox/examplebuttonbox.cc
@@ -1,5 +1,3 @@
-//$Id: examplebuttonbox.cc 836 2007-05-09 03:02:38Z jjongsma $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2002 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -30,9 +28,9 @@ ExampleButtonBox::ExampleButtonBox(bool horizontal,
Gtk::ButtonBox* bbox = nullptr;
if(horizontal)
- bbox = Gtk::manage( new Gtk::ButtonBox(Gtk::ORIENTATION_HORIZONTAL) );
+ bbox = Gtk::make_managed<Gtk::ButtonBox>(Gtk::ORIENTATION_HORIZONTAL);
else
- bbox = Gtk::manage( new Gtk::ButtonBox(Gtk::ORIENTATION_VERTICAL) );
+ bbox = Gtk::make_managed<Gtk::ButtonBox>(Gtk::ORIENTATION_VERTICAL);
bbox->set_border_width(5);
diff --git a/examples/book/buttonbox/examplewindow.cc b/examples/book/buttonbox/examplewindow.cc
index d18a37d..93aa491 100644
--- a/examples/book/buttonbox/examplewindow.cc
+++ b/examples/book/buttonbox/examplewindow.cc
@@ -1,5 +1,3 @@
-//$Id: examplewindow.cc 836 2007-05-09 03:02:38Z jjongsma $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2002 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -34,25 +32,21 @@ ExampleWindow::ExampleWindow()
m_VBox.set_border_width(10);
m_Frame_Horizontal.add(m_VBox);
- m_VBox.pack_start(*Gtk::manage(
- new ExampleButtonBox(true, "Spread (spacing 40)", 40,
- Gtk::BUTTONBOX_SPREAD)),
- Gtk::PACK_EXPAND_WIDGET);
+ m_VBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
+ (true, "Spread (spacing 40)", 40, Gtk::BUTTONBOX_SPREAD),
+ Gtk::PACK_EXPAND_WIDGET);
- m_VBox.pack_start(*Gtk::manage(
- new ExampleButtonBox(true, "Edge (spacing 30)", 30,
- Gtk::BUTTONBOX_EDGE)),
- Gtk::PACK_EXPAND_WIDGET, 5);
+ m_VBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
+ (true, "Edge (spacing 30)", 30, Gtk::BUTTONBOX_EDGE),
+ Gtk::PACK_EXPAND_WIDGET, 5);
- m_VBox.pack_start(*Gtk::manage(
- new ExampleButtonBox(true, "Start (spacing 20)", 20,
- Gtk::BUTTONBOX_START)),
- Gtk::PACK_EXPAND_WIDGET, 5);
+ m_VBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
+ (true, "Start (spacing 20)", 20, Gtk::BUTTONBOX_START),
+ Gtk::PACK_EXPAND_WIDGET, 5);
- m_VBox.pack_start(*Gtk::manage(
- new ExampleButtonBox(true, "end (spacing 10)", 10,
- Gtk::BUTTONBOX_END)),
- Gtk::PACK_EXPAND_WIDGET, 5);
+ m_VBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
+ (true, "End (spacing 10)", 10, Gtk::BUTTONBOX_END),
+ Gtk::PACK_EXPAND_WIDGET, 5);
//The vertical ButtonBoxes:
@@ -61,24 +55,21 @@ ExampleWindow::ExampleWindow()
m_HBox.set_border_width(10);
m_Frame_Vertical.add(m_HBox);
- m_HBox.pack_start(*Gtk::manage(
- new ExampleButtonBox(false, "Spread (spacing 5)", 5,
- Gtk::BUTTONBOX_SPREAD)),
- Gtk::PACK_EXPAND_WIDGET);
+ m_HBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
+ (false, "Spread (spacing 5)", 5, Gtk::BUTTONBOX_SPREAD),
+ Gtk::PACK_EXPAND_WIDGET);
- m_HBox.pack_start(*Gtk::manage(
- new ExampleButtonBox(false, "Edge (spacing 30)", 30,
- Gtk::BUTTONBOX_EDGE)),
- Gtk::PACK_EXPAND_WIDGET, 5);
+ m_HBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
+ (false, "Edge (spacing 30)", 30, Gtk::BUTTONBOX_EDGE),
+ Gtk::PACK_EXPAND_WIDGET, 5);
- m_HBox.pack_start(*Gtk::manage(
- new ExampleButtonBox(false, "Start (spacing 20)", 20,
- Gtk::BUTTONBOX_START)),
- Gtk::PACK_EXPAND_WIDGET, 5);
+ m_HBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
+ (false, "Start (spacing 20)", 20, Gtk::BUTTONBOX_START),
+ Gtk::PACK_EXPAND_WIDGET, 5);
- m_HBox.pack_start(*Gtk::manage(new ExampleButtonBox(false, "End (spacing 10)",
- 10, Gtk::BUTTONBOX_END)),
- Gtk::PACK_EXPAND_WIDGET, 5);
+ m_HBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
+ (false, "End (spacing 10)", 10, Gtk::BUTTONBOX_END),
+ Gtk::PACK_EXPAND_WIDGET, 5);
show_all_children();
}
diff --git a/examples/book/flowbox/examplewindow.cc b/examples/book/flowbox/examplewindow.cc
index 3134705..95fde11 100644
--- a/examples/book/flowbox/examplewindow.cc
+++ b/examples/book/flowbox/examplewindow.cc
@@ -52,8 +52,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_size_request(24, 24);
diff --git a/examples/book/idle/idleexample.cc b/examples/book/idle/idleexample.cc
index f08fb8c..38e9eca 100644
--- a/examples/book/idle/idleexample.cc
+++ b/examples/book/idle/idleexample.cc
@@ -1,5 +1,3 @@
-//$Id: idleexample.cc 836 2007-05-09 03:02:38Z jjongsma $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2003 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -28,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);
- 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);
- 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);
hbox->pack_start(m_ButtonQuit, Gtk::PACK_EXPAND_PADDING);
diff --git a/examples/book/listbox/examplewindow.cc b/examples/book/listbox/examplewindow.cc
index b16d01e..b468e77 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::PACK_SHRINK);
m_HBox_Row.pack_start(m_CheckButton_Row1, Gtk::PACK_SHRINK);
m_HBox_Row.pack_start(m_Button_Row1, Gtk::PACK_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);
@@ -227,7 +227,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);
new_row->show_all();
m_ListBox.append(*new_row);
++new_button_nr;
@@ -251,10 +251,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::PACK_SHRINK);
- auto button = Gtk::manage(new Gtk::Button("button"));
+ auto button = Gtk::make_managed<Gtk::Button>("button");
hbox->pack_start(*button, Gtk::PACK_SHRINK);
hbox->show_all();
row->set_header(*hbox);
diff --git a/examples/book/listmodel/examplewindow.cc b/examples/book/listmodel/examplewindow.cc
index ac6b747..0fc8887 100644
--- a/examples/book/listmodel/examplewindow.cc
+++ b/examples/book/listmodel/examplewindow.cc
@@ -87,7 +87,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_SYNC_CREATE);
return label;
@@ -101,7 +101,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_SYNC_CREATE);
return label;
diff --git a/examples/book/menus_and_toolbars/examplewindow.cc
b/examples/book/menus_and_toolbars/examplewindow.cc
index 57ebaa5..fc90250 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::PACK_SHRINK);
diff --git a/examples/book/printing/advanced/examplewindow.cc
b/examples/book/printing/advanced/examplewindow.cc
index 32e36ad..17e1022 100644
--- a/examples/book/printing/advanced/examplewindow.cc
+++ b/examples/book/printing/advanced/examplewindow.cc
@@ -228,7 +228,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::PACK_SHRINK);
diff --git a/examples/book/printing/advanced/printformoperation.cc
b/examples/book/printing/advanced/printformoperation.cc
index 42096f1..02b2ac1 100644
--- a/examples/book/printing/advanced/printformoperation.cc
+++ b/examples/book/printing/advanced/printformoperation.cc
@@ -154,15 +154,15 @@ 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_border_width(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, false, false);
hbox->set_border_width(6);
hbox->show();
- auto label = Gtk::manage(new Gtk::Label("Choose a font: "));
+ auto label = Gtk::make_managed<Gtk::Label>("Choose a font: ");
hbox->pack_start(*label, false, false);
label->show();
diff --git a/examples/book/printing/simple/examplewindow.cc b/examples/book/printing/simple/examplewindow.cc
index 32e36ad..17e1022 100644
--- a/examples/book/printing/simple/examplewindow.cc
+++ b/examples/book/printing/simple/examplewindow.cc
@@ -228,7 +228,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::PACK_SHRINK);
diff --git a/examples/book/range_widgets/examplewindow.cc b/examples/book/range_widgets/examplewindow.cc
index d5431e0..3d9c5d0 100644
--- a/examples/book/range_widgets/examplewindow.cc
+++ b/examples/book/range_widgets/examplewindow.cc
@@ -1,5 +1,3 @@
-//$Id: examplewindow.cc 836 2007-05-09 03:02:38Z jjongsma $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2002 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -108,14 +106,14 @@ ExampleWindow::ExampleWindow()
m_VBox2.pack_start(m_HBox_Combo, Gtk::PACK_SHRINK);
m_HBox_Combo.pack_start(
- *Gtk::manage(new Gtk::Label("Scale Value Position:", 0)), Gtk::PACK_SHRINK);
+ *Gtk::make_managed<Gtk::Label>("Scale Value Position:", 0), Gtk::PACK_SHRINK);
m_HBox_Combo.pack_start(m_ComboBox_Position);
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::PACK_SHRINK);
+ *Gtk::make_managed<Gtk::Label>("Scale Digits:", 0), Gtk::PACK_SHRINK);
m_Scale_Digits.set_digits(0);
m_adjustment_digits->signal_value_changed().connect(sigc::mem_fun(*this,
&ExampleWindow::on_adjustment1_value_changed));
@@ -123,7 +121,7 @@ ExampleWindow::ExampleWindow()
//Page Size:
m_HBox_PageSize.pack_start(
- *Gtk::manage(new Gtk::Label("Scrollbar Page Size:", 0)),
+ *Gtk::make_managed<Gtk::Label>("Scrollbar Page Size:", 0),
Gtk::PACK_SHRINK);
m_Scale_PageSize.set_digits(0);
m_adjustment_pagesize->signal_value_changed().connect(sigc::mem_fun(*this,
diff --git a/examples/book/recent_files/examplewindow.cc b/examples/book/recent_files/examplewindow.cc
index 4feeb1f..f2b987c 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::PACK_SHRINK);
}
else
diff --git a/examples/book/scrolledwindow/examplewindow.cc b/examples/book/scrolledwindow/examplewindow.cc
index 546f757..3c06e29 100644
--- a/examples/book/scrolledwindow/examplewindow.cc
+++ b/examples/book/scrolledwindow/examplewindow.cc
@@ -1,5 +1,3 @@
-//$Id: examplewindow.cc 836 2007-05-09 03:02:38Z jjongsma $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2002 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -51,8 +49,8 @@ ExampleWindow::ExampleWindow()
{
char buffer[32];
sprintf(buffer, "button (%d,%d)\n", i, j);
- auto pButton = Gtk::manage(new Gtk::ToggleButton(buffer));
- m_Grid.attach(*pButton, i, j, 1, 1);
+ auto pButton = Gtk::make_managed<Gtk::ToggleButton>(buffer);
+ m_Grid.attach(*pButton, i, j);
}
}
diff --git a/examples/book/socket/socket.cc b/examples/book/socket/socket.cc
index 2a431fa..bcbd9b5 100644
--- a/examples/book/socket/socket.cc
+++ b/examples/book/socket/socket.cc
@@ -27,7 +27,7 @@ class MySocketWindow : public Gtk::Window
ifstream infile(id_filename);
if (infile)
{
- auto socket = Gtk::manage(new Gtk::Socket());
+ auto socket = Gtk::make_managed<Gtk::Socket>();
add(*socket);
socket->signal_plug_added().connect(sigc::ptr_fun(plug_added));
socket->signal_plug_removed().connect(sigc::ptr_fun(plug_removed));
@@ -38,9 +38,8 @@ class MySocketWindow : public Gtk::Window
}
else
{
- auto label = Gtk::manage(
- new Gtk::Label(
- "Plug id file not found.\n Make sure plug is running."));
+ auto label = Gtk::make_managed<Gtk::Label>(
+ "Plug id file not found.\n Make sure plug is running.");
add(*label);
set_size_request(150, 50);
}
diff --git a/examples/book/toolbar/examplewindow.cc b/examples/book/toolbar/examplewindow.cc
index 454d911..0b3e246 100644
--- a/examples/book/toolbar/examplewindow.cc
+++ b/examples/book/toolbar/examplewindow.cc
@@ -1,5 +1,3 @@
-//$Id: examplewindow.cc 870 2007-07-13 19:08:46Z murrayc $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2002 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -48,15 +46,15 @@ ExampleWindow::ExampleWindow()
m_Toolbar.set_toolbar_style(Gtk::TOOLBAR_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);
@@ -64,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"));
}
show_all_children();
diff --git a/examples/book/toolpalette/examplewindow.cc b/examples/book/toolpalette/examplewindow.cc
index a35bfdf..e9fcedf 100644
--- a/examples/book/toolpalette/examplewindow.cc
+++ b/examples/book/toolpalette/examplewindow.cc
@@ -1,5 +1,3 @@
-//$Id: examplewindow.cc 870 2007-07-13 19:08:46Z murrayc $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2002 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -38,8 +36,7 @@ void ExampleWindow::load_icon_items()
for (type_stringvec::const_iterator iter = contexts.begin(); iter != contexts.end(); ++iter)
{
const Glib::ustring context_name = *iter;
- Gtk::ToolItemGroup* group =
- Gtk::manage(new Gtk::ToolItemGroup(context_name));
+ auto group = Gtk::make_managed<Gtk::ToolItemGroup>(context_name);
m_ToolPalette.add(*group);
// Iterate through the icon names, populating the ToolItemGroup as appropriate.
@@ -66,8 +63,8 @@ void ExampleWindow::load_icon_items()
pixbuf->get_height() > 2*requested_icon_size)
continue;
- auto image = Gtk::manage(new Gtk::Image(pixbuf));
- auto button = Gtk::manage(new Gtk::ToolButton(*image, icon_name));
+ auto image = Gtk::make_managed<Gtk::Image>(pixbuf);
+ auto button = Gtk::make_managed<Gtk::ToolButton>(*image, icon_name);
button->set_tooltip_text(icon_name);
button->set_is_important();
group->insert(*button);
@@ -83,8 +80,7 @@ void ExampleWindow::load_icon_items()
void ExampleWindow::load_toggle_items()
{
- auto group =
- Gtk::manage(new Gtk::ToolItemGroup("Radio Item"));
+ auto group = Gtk::make_managed<Gtk::ToolItemGroup>("Radio Item");
m_ToolPalette.add(*group);
Gtk::RadioToolButton::Group radio_group;
@@ -92,7 +88,7 @@ void ExampleWindow::load_toggle_items()
for(int i = 1; i <= 10; ++i)
{
const Glib::ustring label = Glib::ustring::compose("#%1", i);
- auto button = Gtk::manage(new Gtk::RadioToolButton());
+ auto button = Gtk::make_managed<Gtk::RadioToolButton>();
button->set_group(radio_group);
button->set_label(label);
@@ -103,11 +99,11 @@ void ExampleWindow::load_toggle_items()
static Gtk::ToolItem* create_entry_item(const Glib::ustring& text)
{
- auto entry = Gtk::manage(new Gtk::Entry());
+ auto entry = Gtk::make_managed<Gtk::Entry>();
entry->set_text(text);
entry->set_width_chars(5);
- auto item = Gtk::manage(new Gtk::ToolItem());
+ auto item = Gtk::make_managed<Gtk::ToolItem>();
item->add(*entry);
return item;
@@ -115,9 +111,9 @@ static Gtk::ToolItem* create_entry_item(const Glib::ustring& text)
void ExampleWindow::load_special_items()
{
- auto group = Gtk::manage(new Gtk::ToolItemGroup());
+ auto group = Gtk::make_managed<Gtk::ToolItemGroup>();
- Gtk::Button *label_button = Gtk::manage(new Gtk::Button("Advanced Features"));
+ Gtk::Button *label_button = Gtk::make_managed<Gtk::Button>("Advanced Features");
label_button->show();
group->set_label_widget(*label_button);
m_ToolPalette.add(*group);
@@ -146,26 +142,26 @@ void ExampleWindow::load_special_items()
"homogeneous", FALSE, "expand", TRUE,
"new-row", TRUE, NULL);
- Gtk::ToolButton *button = Gtk::manage(new Gtk::ToolButton());
+ auto button = Gtk::make_managed<Gtk::ToolButton>();
button->set_icon_name("go-up");
button->set_tooltip_text("Show on vertical palettes only");
group->insert(*button);
button->set_visible_horizontal(false);
- button = Gtk::manage(new Gtk::ToolButton());
+ button = Gtk::make_managed<Gtk::ToolButton>();
button->set_icon_name("go-next");
button->set_tooltip_text("Show on horizontal palettes only");
group->insert(*button);
button->set_visible_vertical(false);
- button = Gtk::manage(new Gtk::ToolButton());
+ button = Gtk::make_managed<Gtk::ToolButton>();
button->set_icon_name("edit-delete");
button->set_tooltip_text("Do not show at all");
button->set_no_show_all();
group->insert(*button);
button->set_visible_vertical(false);
- button = Gtk::manage(new Gtk::ToolButton());
+ button = Gtk::make_managed<Gtk::ToolButton>();
button->set_icon_name("view-fullscreen");
button->set_tooltip_text("Expanded this item");
group->insert(*button);
@@ -174,7 +170,7 @@ void ExampleWindow::load_special_items()
"expand", TRUE,
NULL);
- button = Gtk::manage(new Gtk::ToolButton());
+ button = Gtk::make_managed<Gtk::ToolButton>();
button->set_icon_name("help-contents");
button->set_tooltip_text("A regular item");
group->insert(*button);
diff --git a/examples/book/tooltips/examplewindow.cc b/examples/book/tooltips/examplewindow.cc
index 8daf3bf..8f7883d 100644
--- a/examples/book/tooltips/examplewindow.cc
+++ b/examples/book/tooltips/examplewindow.cc
@@ -1,5 +1,3 @@
-/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
/* gtkmm example Copyright (C) 2007 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -58,7 +56,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"));
+ 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 7b26897..bb4ad7e 100644
--- a/examples/book/treeview/combo_renderer/examplewindow.cc
+++ b/examples/book/treeview/combo_renderer/examplewindow.cc
@@ -1,5 +1,3 @@
-//$Id: examplewindow.cc 836 2007-05-09 03:02:38Z jjongsma $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2002 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -94,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 c70eafe..bf0e90d 100644
--- a/examples/book/treeview/list/examplewindow.cc
+++ b/examples/book/treeview/list/examplewindow.cc
@@ -1,5 +1,3 @@
-//$Id: examplewindow.cc 836 2007-05-09 03:02:38Z jjongsma $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2002 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -76,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 ddcac5b..1871042 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 088c64a..161a66a 100644
--- a/examples/others/arrow/arrow.cc
+++ b/examples/others/arrow/arrow.cc
@@ -56,23 +56,23 @@ AppWindow::AppWindow()
set_border_width (10);
/* 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);
grid->set_border_width (2);
/* Pack and show all our widgets */
- button = Gtk::manage (new ArrowButton (Gtk::ARROW_UP));
- grid->attach (*button, 1, 0, 1, 1);
+ button = Gtk::make_managed<ArrowButton>(Gtk::ARROW_UP);
+ grid->attach (*button, 1, 0);
- button = Gtk::manage (new ArrowButton (Gtk::ARROW_LEFT));
- grid->attach (*button, 0, 1, 1, 1);
+ button = Gtk::make_managed<ArrowButton>(Gtk::ARROW_LEFT);
+ grid->attach (*button, 0, 1);
- button = Gtk::manage (new ArrowButton (Gtk::ARROW_RIGHT));
- grid->attach (*button, 2, 1, 1, 1);
+ button = Gtk::make_managed<ArrowButton>(Gtk::ARROW_RIGHT);
+ grid->attach (*button, 2, 1);
- button = Gtk::manage (new ArrowButton (Gtk::ARROW_DOWN));
- grid->attach (*button, 1, 2, 1, 1);
+ button = Gtk::make_managed<ArrowButton>(Gtk::ARROW_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 9618c0a..9d6760e 100644
--- a/examples/others/calendar/calendar.cc
+++ b/examples/others/calendar/calendar.cc
@@ -177,22 +177,22 @@ CalendarExample::CalendarExample()
set_resizable(false);
- auto vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, DEF_PAD));
+ auto vbox = Gtk::make_managed<Gtk::Box>(Gtk::ORIENTATION_VERTICAL, DEF_PAD);
add(*vbox);
/*
* 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::PACK_EXPAND_WIDGET, DEF_PAD);
- auto hbbox = Gtk::manage(new Gtk::ButtonBox());
+ auto hbbox = Gtk::make_managed<Gtk::ButtonBox>();
hbox->pack_start(*hbbox, Gtk::PACK_SHRINK, DEF_PAD);
hbbox->set_layout(Gtk::BUTTONBOX_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::PACK_EXPAND_WIDGET, DEF_PAD);
calendar_ = new Gtk::Calendar();
set_flags();
@@ -202,17 +202,17 @@ 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::PACK_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::PACK_SHRINK, 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::PACK_EXPAND_WIDGET, 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 {
@@ -235,7 +235,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::PACK_SHRINK);
@@ -253,37 +253,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::PACK_EXPAND_WIDGET, DEF_PAD);
- 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::PACK_SHRINK);
- auto label = Gtk::manage(new Gtk::Label("Day selected:"));
+ auto label = Gtk::make_managed<Gtk::Label>("Day selected:");
hbox->pack_start (*label, Gtk::PACK_SHRINK);
label_selected_ = new Gtk::Label("");
hbox->pack_start (*label_selected_, Gtk::PACK_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::PACK_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::PACK_SHRINK);
label_selected_double_click_ = new Gtk::Label("");
hbox->pack_start (*label_selected_double_click_, Gtk::PACK_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::PACK_SHRINK);
- label = Gtk::manage(new Gtk::Label("Month change:"));
+ label = Gtk::make_managed<Gtk::Label>("Month change:");
hbox->pack_start (*label, Gtk::PACK_SHRINK);
label_month_ = new Gtk::Label("");
hbox->pack_start(*label_month_, Gtk::PACK_SHRINK);
- auto bbox = Gtk::manage(new Gtk::ButtonBox());
+ auto bbox = Gtk::make_managed<Gtk::ButtonBox>();
vbox->pack_start(*bbox, Gtk::PACK_SHRINK);
bbox->set_layout(Gtk::BUTTONBOX_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 7f70014..57e7abf 100644
--- a/examples/others/cellrenderercustom/cellrendererlist.cc
+++ b/examples/others/cellrenderercustom/cellrendererlist.cc
@@ -1,5 +1,3 @@
-//$Id: cellrendererlist.cc 156 2004-03-12 10:11:35Z murrayc $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2002 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -55,8 +53,8 @@ CellRendererList::CellRendererList()
selection->set_mode(Gtk::SELECTION_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::SHADOW_OUT);
diff --git a/examples/others/dnd/dndwindow.cc b/examples/others/dnd/dndwindow.cc
index f0f2f66..00e6598 100644
--- a/examples/others/dnd/dndwindow.cc
+++ b/examples/others/dnd/dndwindow.cc
@@ -1,5 +1,3 @@
-//$Id: dndwindow.cc 177 2004-03-28 18:58:09Z murrayc $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2002 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -235,7 +233,7 @@ void DnDWindow::create_popup()
m_PopupWindow.set_position(Gtk::WIN_POS_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++)
{
@@ -243,8 +241,8 @@ void DnDWindow::create_popup()
{
char buffer[128];
g_snprintf(buffer, sizeof(buffer), "%d,%d", i, j);
- auto pButton = Gtk::manage(new Gtk::Button(buffer));
- pGrid->attach(*pButton, i, j, 1, 1);
+ auto pButton = Gtk::make_managed<Gtk::Button>(buffer);
+ pGrid->attach(*pButton, i, j);
pButton->drag_dest_set(m_listTargetsNoRoot, Gtk::DEST_DEFAULT_ALL, Gdk::DragAction(GDK_ACTION_COPY |
GDK_ACTION_MOVE));
pButton->signal_drag_motion().connect( sigc::mem_fun(*this, &DnDWindow::on_popup_button_drag_motion)
); pButton->signal_drag_leave().connect( sigc::mem_fun(*this,
&DnDWindow::on_popup_button_drag_leave) );
diff --git a/examples/others/idle/idle.cc b/examples/others/idle/idle.cc
index b19e8bd..c1b63a1 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));
+ Gtk::Box *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);
- 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::Box *hbox = manage( new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL,10));
+ Gtk::Box *hbox = Gtk::make_managed<Gtk::Box>(Gtk::ORIENTATION_HORIZONTAL,10);
hbox->pack_start(m_quit, Gtk::PACK_EXPAND_PADDING);
vbox->pack_start(*hbox);
diff --git a/examples/others/tictactoe/tictactoe.cc b/examples/others/tictactoe/tictactoe.cc
index 1c021f4..b09af80 100644
--- a/examples/others/tictactoe/tictactoe.cc
+++ b/examples/others/tictactoe/tictactoe.cc
@@ -26,7 +26,7 @@
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);
@@ -36,7 +36,7 @@ TicTacToe::TicTacToe()
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, 1, 1);
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 0d9912e..e7ad6cb 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(argc, argv, "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]