Commit 31a7f568 authored by Kjell Ahlstedt's avatar Kjell Ahlstedt

examples: Use Gtk::Container::add() instead of Gtk::Box::pack_start()

parent af993478
......@@ -38,9 +38,9 @@ ExampleWindow::ExampleWindow()
m_prev_button.set_image_from_icon_name("go-previous-symbolic", Gtk::IconSize::INHERIT, true);
m_next_button.set_image_from_icon_name("go-next-symbolic", Gtk::IconSize::INHERIT, true);
m_photo_button.set_image_from_icon_name("media-record-symbolic", Gtk::IconSize::INHERIT, true);
m_photo_box.pack_start(m_prev_button, Gtk::PackOptions::SHRINK);
m_photo_box.pack_start(m_photo_button, Gtk::PackOptions::SHRINK);
m_photo_box.pack_start(m_next_button, Gtk::PackOptions::SHRINK);
m_photo_box.add(m_prev_button);
m_photo_box.add(m_photo_button);
m_photo_box.add(m_next_button);
auto style_context = m_photo_box.get_style_context();
style_context->add_class("raised");
style_context->add_class("linked");
......@@ -52,8 +52,9 @@ ExampleWindow::ExampleWindow()
// Layout
m_box.set_homogeneous(false);
m_box.pack_start(m_face_image, Gtk::PackOptions::EXPAND_WIDGET);
m_box.pack_end(m_action_bar, Gtk::PackOptions::SHRINK);
m_face_image.set_expand();
m_box.add(m_face_image);
m_box.add(m_action_bar);
add(m_box);
}
......
......@@ -26,8 +26,10 @@ ExampleAssistant::ExampleAssistant()
set_title("Gtk::Assistant example");
set_default_size(400, 300);
m_box.pack_start(m_label1, Gtk::PackOptions::EXPAND_WIDGET);
m_box.pack_start(m_entry, Gtk::PackOptions::EXPAND_WIDGET);
m_box.add(m_label1);
m_box.add(m_entry);
m_label1.set_expand();
m_entry.set_expand();
append_page(m_box);
append_page(m_check);
......
......@@ -29,8 +29,6 @@ ExampleWindow::ExampleWindow(int which)
m_separator2.set_margin_top(5);
m_separator2.set_margin_bottom(5);
PackBox *pPackBox1, *pPackBox2, *pPackBox3, *pPackBox4, *pPackBox5;
switch(which)
{
case 1:
......@@ -44,43 +42,44 @@ ExampleWindow::ExampleWindow(int which)
// Pack the label into the vertical box (vbox box1). Remember that
// widgets added to a vbox will be packed one on top of the other in
// order.
m_box1.pack_start(m_Label1, Gtk::PackOptions::SHRINK);
m_box1.add(m_Label1);
// Create a PackBox - homogeneous = false, spacing = 0,
// options = Gtk::PackOptions::SHRINK, margin = 0
pPackBox1 = Gtk::make_managed<PackBox>(false, 0, Gtk::PackOptions::SHRINK);
m_box1.pack_start(*pPackBox1, Gtk::PackOptions::SHRINK);
// expand = false, Gtk::Align::FILL, margin = 0
// These are the default values.
auto pPackBox = Gtk::make_managed<PackBox>();
m_box1.add(*pPackBox);
// Create a PackBox - homogeneous = false, spacing = 0,
// options = Gtk::PackOptions::EXPAND_PADDING, margin = 0
pPackBox2 = Gtk::make_managed<PackBox>(false, 0, Gtk::PackOptions::EXPAND_PADDING);
m_box1.pack_start(*pPackBox2, Gtk::PackOptions::SHRINK);
// expand = true, Gtk::Align::CENTER, margin = 0
pPackBox = Gtk::make_managed<PackBox>(false, 0, true, Gtk::Align::CENTER);
m_box1.add(*pPackBox);
// Create a PackBox - homogeneous = false, spacing = 0,
// options = Gtk::PackOptions::EXPAND_WIDGET, margin = 0
pPackBox3 = Gtk::make_managed<PackBox>(false, 0, Gtk::PackOptions::EXPAND_WIDGET);
m_box1.pack_start(*pPackBox3, Gtk::PackOptions::SHRINK);
// expand = true, Gtk::Align::FILL, margin = 0
pPackBox = Gtk::make_managed<PackBox>(false, 0, true);
m_box1.add(*pPackBox);
// pack the separator into the vbox. Remember each of these
// widgets are being packed into a vbox, so they'll be stacked
// vertically.
m_box1.pack_start(m_separator1, Gtk::PackOptions::SHRINK);
m_box1.add(m_separator1);
// create another new label, and show it.
m_Label2.set_text("Gtk::Box(Gtk::Orientation::HORIZONTAL, 0); set_homogeneous(true);");
m_Label2.set_halign(Gtk::Align::START);
m_Label2.set_valign(Gtk::Align::START);
m_box1.pack_start(m_Label2, Gtk::PackOptions::SHRINK);
m_box1.add(m_Label2);
// Args are: homogeneous, spacing, options, margin
pPackBox4 = Gtk::make_managed<PackBox>(true, 0, Gtk::PackOptions::EXPAND_PADDING);
m_box1.pack_start(*pPackBox4, Gtk::PackOptions::SHRINK);
// Args are: homogeneous, spacing, expand, align, margin
pPackBox = Gtk::make_managed<PackBox>(true, 0, true, Gtk::Align::CENTER);
m_box1.add(*pPackBox);
// Args are: homogeneous, spacing, options, margin
pPackBox5 = Gtk::make_managed<PackBox>(true, 0, Gtk::PackOptions::EXPAND_WIDGET);
m_box1.pack_start(*pPackBox5, Gtk::PackOptions::SHRINK);
// Args are: homogeneous, spacing, expand, align, margin
pPackBox = Gtk::make_managed<PackBox>(true, 0, true);
m_box1.add(*pPackBox);
m_box1.pack_start(m_separator2, Gtk::PackOptions::SHRINK);
m_box1.add(m_separator2);
break;
}
......@@ -90,46 +89,48 @@ ExampleWindow::ExampleWindow(int which)
m_Label1.set_text("Gtk::Box(Gtk::Orientation::HORIZONTAL, 10); set_homogeneous(false);");
m_Label1.set_halign(Gtk::Align::START);
m_Label1.set_valign(Gtk::Align::START);
m_box1.pack_start(m_Label1, Gtk::PackOptions::SHRINK);
m_box1.add(m_Label1);
pPackBox1 = Gtk::make_managed<PackBox>(false, 10, Gtk::PackOptions::EXPAND_PADDING);
m_box1.pack_start(*pPackBox1, Gtk::PackOptions::SHRINK);
auto pPackBox = Gtk::make_managed<PackBox>(false, 10, true, Gtk::Align::CENTER);
m_box1.add(*pPackBox);
pPackBox2 = Gtk::make_managed<PackBox>(false, 10, Gtk::PackOptions::EXPAND_WIDGET);
m_box1.pack_start(*pPackBox2, Gtk::PackOptions::SHRINK);
pPackBox = Gtk::make_managed<PackBox>(false, 10, true);
m_box1.add(*pPackBox);
m_box1.pack_start(m_separator1, Gtk::PackOptions::SHRINK);
m_box1.add(m_separator1);
m_Label2.set_text("Gtk::Box(Gtk::Orientation::HORIZONTAL, 0); set_homogeneous(false);");
m_Label2.set_halign(Gtk::Align::START);
m_Label2.set_valign(Gtk::Align::START);
m_box1.pack_start(m_Label2, Gtk::PackOptions::SHRINK);
m_box1.add(m_Label2);
pPackBox3 = Gtk::make_managed<PackBox>(false, 0, Gtk::PackOptions::SHRINK, 10);
m_box1.pack_start(*pPackBox3, Gtk::PackOptions::SHRINK);
pPackBox = Gtk::make_managed<PackBox>(false, 0, false, Gtk::Align::FILL, 10);
m_box1.add(*pPackBox);
pPackBox4 = Gtk::make_managed<PackBox>(false, 0, Gtk::PackOptions::EXPAND_WIDGET, 10);
m_box1.pack_start(*pPackBox4, Gtk::PackOptions::SHRINK);
pPackBox = Gtk::make_managed<PackBox>(false, 0, true, Gtk::Align::FILL, 10);
m_box1.add(*pPackBox);
m_box1.pack_start(m_separator2, Gtk::PackOptions::SHRINK);
m_box1.add(m_separator2);
break;
}
case 3:
{
// This demonstrates the ability to use Gtk::Box::pack_end() to
// This demonstrates the ability to use Gtk::Align::END to
// right justify widgets. First, we create a new box as before.
pPackBox1 = Gtk::make_managed<PackBox>(false, 0, Gtk::PackOptions::SHRINK);
auto pPackBox = Gtk::make_managed<PackBox>();
// create the label that will be put at the end.
m_Label1.set_text("end");
// pack it using pack_end(), so it is put on the right side
// pack it using Gtk::Align::END, so it is put on the right side
// of the PackBox.
pPackBox1->pack_end(m_Label1, Gtk::PackOptions::SHRINK);
m_Label1.set_halign(Gtk::Align::END);
m_Label1.set_hexpand(true);
pPackBox->add(m_Label1);
m_box1.pack_start(*pPackBox1, Gtk::PackOptions::SHRINK);
m_box1.add(*pPackBox);
// This explicitly sets the separator to 700 pixels wide by 5 pixels
// high. This is so the hbox we created will also be 700 pixels wide,
......@@ -139,7 +140,7 @@ ExampleWindow::ExampleWindow(int which)
m_separator1.set_size_request(700, 5);
// pack the separator into the vbox.
m_box1.pack_start(m_separator1, Gtk::PackOptions::SHRINK);
m_box1.add(m_separator1);
break;
}
......@@ -156,9 +157,10 @@ ExampleWindow::ExampleWindow(int which)
&ExampleWindow::on_button_quit_clicked) );
// pack the button into the quitbox.
m_boxQuit.pack_start(m_buttonQuit, Gtk::PackOptions::EXPAND_PADDING);
m_boxQuit.add(m_buttonQuit);
m_buttonQuit.set_hexpand(true);
m_buttonQuit.set_halign(Gtk::Align::CENTER);
m_box1.pack_start(m_boxQuit, Gtk::PackOptions::SHRINK);
m_box1.add(m_boxQuit);
// pack the vbox (box1) which now contains all our widgets, into the
// main window.
......
......@@ -15,38 +15,35 @@
*/
#include "packbox.h"
#include <map>
PackBox::PackBox(bool homogeneous, int spacing, Gtk::PackOptions options,
int margin)
: Gtk::Box(Gtk::Orientation::HORIZONTAL, spacing),
m_button1("box.pack_start("),
m_button2("button,"),
m_button3((options == Gtk::PackOptions::SHRINK) ? "Gtk::PackOptions::SHRINK);" :
((options == Gtk::PackOptions::EXPAND_PADDING) ?
"Gtk::PackOptions::EXPAND_PADDING);" : "Gtk::PackOptions::EXPAND_WIDGET);"))
namespace
{
set_homogeneous(homogeneous);
m_button1.set_margin_start(margin);
m_button1.set_margin_end(margin);
pack_start(m_button1, options);
m_button2.set_margin_start(margin);
m_button2.set_margin_end(margin);
pack_start(m_button2, options);
m_button3.set_margin_start(margin);
m_button3.set_margin_end(margin);
pack_start(m_button3, options);
m_pbutton4 = new Gtk::Button("margin=" + Glib::ustring::format(margin));
m_pbutton4->set_margin_start(margin);
m_pbutton4->set_margin_end(margin);
pack_start(*m_pbutton4, options);
const std::map<Gtk::Align, Glib::ustring> align_string = {
{Gtk::Align::FILL, "Gtk::Align::FILL"},
{Gtk::Align::START, "Gtk::Align::START"},
{Gtk::Align::END, "Gtk::Align::END"},
{Gtk::Align::CENTER, "Gtk::Align::CENTER"},
{Gtk::Align::BASELINE, "Gtk::Align::BASELINE"},
};
}
PackBox::~PackBox()
PackBox::PackBox(bool homogeneous, int spacing, bool expand, Gtk::Align align, int margin)
: Gtk::Box(Gtk::Orientation::HORIZONTAL, spacing)
{
delete m_pbutton4;
}
set_homogeneous(homogeneous);
m_buttons[0].set_label("box.add(button);");
m_buttons[1].set_label("expand=" + Glib::ustring(expand ? "true" : "false"));
m_buttons[2].set_label(align_string.at(align));
m_buttons[3].set_label("margin=" + Glib::ustring::format(margin));
for (auto& button : m_buttons)
{
add(button);
button.set_hexpand(expand);
button.set_halign(align);
button.set_margin_start(margin);
button.set_margin_end(margin);
}
}
......@@ -22,12 +22,11 @@
class PackBox : public Gtk::Box
{
public:
PackBox(bool homogeneous, int spacing, Gtk::PackOptions options, int margin = 0);
virtual ~PackBox();
PackBox(bool homogeneous = false, int spacing = 0, bool expand = false,
Gtk::Align align = Gtk::Align::FILL, int margin = 0);
protected:
Gtk::Button m_button1, m_button2, m_button3;
Gtk::Button* m_pbutton4;
Gtk::Button m_buttons[4];
};
#endif //GTKMM_EXAMPLE_PACKBOX_H
......@@ -41,7 +41,8 @@ DerivedDialog::DerivedDialog(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Bu
auto pImage = Gtk::make_managed<Gtk::Image>();
pImage->set_from_icon_name(is_glad ? "face-smile" : "face-sad");
pImage->set_icon_size(Gtk::IconSize::LARGE);
get_content_area()->pack_start(*pImage, Gtk::PackOptions::EXPAND_WIDGET);
pImage->set_expand();
get_content_area()->add(*pImage);
}
DerivedDialog::~DerivedDialog()
......
......@@ -33,7 +33,7 @@ ExampleButtonBox::ExampleButtonBox(bool horizontal,
set_margin_start(5);
set_margin_end(5);
}
bbox->property_margin() = 5;
bbox->set_margin(5);
add(*bbox);
......
......@@ -28,53 +28,49 @@ ExampleWindow::ExampleWindow()
m_VBox_Main.set_spacing(10);
add(m_VBox_Main);
m_VBox_Main.pack_start(m_Frame_Horizontal, Gtk::PackOptions::EXPAND_WIDGET);
m_VBox_Main.set_margin_start(10);
m_VBox_Main.add(m_Frame_Horizontal);
//The horizontal ButtonBoxes:
m_VBox.set_margin(10);
m_Frame_Horizontal.add(m_VBox);
m_VBox.set_spacing(5);
m_VBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
(true, "Spread (spacing 40)", 40, Gtk::ButtonBoxStyle::SPREAD),
Gtk::PackOptions::EXPAND_WIDGET);
m_VBox.add(*Gtk::make_managed<ExampleButtonBox>
(true, "Spread (spacing 40)", 40, Gtk::ButtonBoxStyle::SPREAD));
m_VBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
(true, "Edge (spacing 30)", 30, Gtk::ButtonBoxStyle::EDGE),
Gtk::PackOptions::EXPAND_WIDGET);
m_VBox.add(*Gtk::make_managed<ExampleButtonBox>
(true, "Edge (spacing 30)", 30, Gtk::ButtonBoxStyle::EDGE));
m_VBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
(true, "Start (spacing 20)", 20, Gtk::ButtonBoxStyle::START),
Gtk::PackOptions::EXPAND_WIDGET);
m_VBox.add(*Gtk::make_managed<ExampleButtonBox>
(true, "Start (spacing 20)", 20, Gtk::ButtonBoxStyle::START));
m_VBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
(true, "End (spacing 10)", 10, Gtk::ButtonBoxStyle::END),
Gtk::PackOptions::EXPAND_WIDGET);
m_VBox.add(*Gtk::make_managed<ExampleButtonBox>
(true, "End (spacing 10)", 10, Gtk::ButtonBoxStyle::END));
for (auto child : m_VBox.get_children())
child->set_expand();
//The vertical ButtonBoxes:
m_VBox_Main.pack_start(m_Frame_Vertical, Gtk::PackOptions::EXPAND_WIDGET);
m_VBox_Main.add(m_Frame_Vertical);
m_HBox.set_margin(10);
m_Frame_Vertical.add(m_HBox);
m_HBox.set_spacing(5);
m_HBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
(false, "Spread (spacing 5)", 5, Gtk::ButtonBoxStyle::SPREAD),
Gtk::PackOptions::EXPAND_WIDGET);
m_HBox.add(*Gtk::make_managed<ExampleButtonBox>
(false, "Spread (spacing 5)", 5, Gtk::ButtonBoxStyle::SPREAD));
m_HBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
(false, "Edge (spacing 30)", 30, Gtk::ButtonBoxStyle::EDGE),
Gtk::PackOptions::EXPAND_WIDGET);
m_HBox.add(*Gtk::make_managed<ExampleButtonBox>
(false, "Edge (spacing 30)", 30, Gtk::ButtonBoxStyle::EDGE));
m_HBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
(false, "Start (spacing 20)", 20, Gtk::ButtonBoxStyle::START),
Gtk::PackOptions::EXPAND_WIDGET);
m_HBox.add(*Gtk::make_managed<ExampleButtonBox>
(false, "Start (spacing 20)", 20, Gtk::ButtonBoxStyle::START));
m_HBox.pack_start(*Gtk::make_managed<ExampleButtonBox>
(false, "End (spacing 10)", 10, Gtk::ButtonBoxStyle::END),
Gtk::PackOptions::EXPAND_WIDGET);
m_HBox.add(*Gtk::make_managed<ExampleButtonBox>
(false, "End (spacing 10)", 10, Gtk::ButtonBoxStyle::END));
for (auto child : m_HBox.get_children())
child->set_expand();
}
ExampleWindow::~ExampleWindow()
......
......@@ -38,24 +38,29 @@ RadioButtons::RadioButtons() :
add(m_Box_Top);
//Put the inner boxes and the separator in the outer box:
m_Box_Top.pack_start(m_Box1, Gtk::PackOptions::EXPAND_WIDGET);
m_Box_Top.pack_start(m_Separator, Gtk::PackOptions::EXPAND_WIDGET);
m_Box_Top.pack_start(m_Box2, Gtk::PackOptions::EXPAND_WIDGET);
m_Box_Top.add(m_Box1);
m_Box_Top.add(m_Separator);
m_Box_Top.add(m_Box2);
m_Separator.set_expand();
// Set the inner boxes' margins
m_Box1.set_margin(10);
m_Box2.set_margin(10);
// Put the radio buttons in Box1:
m_Box1.pack_start(m_RadioButton1, Gtk::PackOptions::EXPAND_WIDGET);
m_Box1.pack_start(m_RadioButton2, Gtk::PackOptions::EXPAND_WIDGET);
m_Box1.pack_start(m_RadioButton3, Gtk::PackOptions::EXPAND_WIDGET);
m_Box1.add(m_RadioButton1);
m_Box1.add(m_RadioButton2);
m_Box1.add(m_RadioButton3);
m_RadioButton1.set_expand();
m_RadioButton2.set_expand();
m_RadioButton3.set_expand();
// Set the second button active
m_RadioButton2.set_active();
// Put Close button in Box2:
m_Box2.pack_start(m_Button_Close, Gtk::PackOptions::EXPAND_WIDGET);
m_Box2.add(m_Button_Close);
m_Button_Close.set_expand();
// Make the button the default widget
m_Button_Close.set_can_default();
......
......@@ -39,10 +39,11 @@ ExampleWindow::ExampleWindow()
m_VBox.set_margin(12);
add(m_VBox);
m_VBox.pack_start(m_Label, Gtk::PackOptions::SHRINK);
m_VBox.add(m_Label);
//Fill Grid:
m_VBox.pack_start(m_Grid, Gtk::PackOptions::EXPAND_WIDGET);
m_VBox.add(m_Grid);
m_Grid.set_expand(true);
m_Grid.set_row_homogeneous(true);
m_Grid.set_column_homogeneous(true);
m_Grid.attach(m_ButtonA1, 0, 0);
......@@ -51,15 +52,15 @@ ExampleWindow::ExampleWindow()
m_Grid.attach(m_ButtonB2, 1, 1);
//Add ButtonBox to bottom:
m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
m_VBox.add(m_ButtonBox);
m_VBox.set_spacing(6);
//Fill ButtonBox:
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
m_ButtonBox.pack_start(m_Button_Copy, Gtk::PackOptions::SHRINK);
m_ButtonBox.add(m_Button_Copy);
m_Button_Copy.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_copy) );
m_ButtonBox.pack_start(m_Button_Paste, Gtk::PackOptions::SHRINK);
m_ButtonBox.add(m_Button_Paste);
m_Button_Paste.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_paste) );
......
......@@ -29,10 +29,11 @@ ExampleWindow::ExampleWindow()
m_VBox.set_margin(12);
add(m_VBox);
m_VBox.pack_start(m_Label, Gtk::PackOptions::SHRINK);
m_VBox.add(m_Label);
//Fill Grid:
m_VBox.pack_start(m_Grid, Gtk::PackOptions::EXPAND_WIDGET);
m_VBox.add(m_Grid);
m_Grid.set_expand(true);
m_Grid.set_row_homogeneous(true);
m_Grid.set_column_homogeneous(true);
m_Grid.attach(m_ButtonA1, 0, 0);
......@@ -41,15 +42,15 @@ ExampleWindow::ExampleWindow()
m_Grid.attach(m_ButtonB2, 1, 1);
//Add ButtonBox to bottom:
m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
m_VBox.add(m_ButtonBox);
m_VBox.set_spacing(6);
//Fill ButtonBox:
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
m_ButtonBox.pack_start(m_Button_Copy, Gtk::PackOptions::SHRINK);
m_ButtonBox.add(m_Button_Copy);
m_Button_Copy.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_copy) );
m_ButtonBox.pack_start(m_Button_Paste, Gtk::PackOptions::SHRINK);
m_ButtonBox.add(m_Button_Paste);
m_Button_Paste.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_paste) );
}
......
......@@ -31,11 +31,12 @@ ExampleWindow::ExampleWindow()
//Add the child widgets to the custom container:
m_MyContainer.set_child_widgets(m_Button_One, m_Label_Two);
m_MyContainer.set_expand();
m_VBox.pack_start(m_MyContainer, Gtk::PackOptions::EXPAND_WIDGET);
m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::SHRINK);
m_VBox.add(m_MyContainer);
m_VBox.add(m_ButtonBox);
m_ButtonBox.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
m_ButtonBox.add(m_Button_Quit);
m_ButtonBox.set_margin(6);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
m_Button_Quit.signal_clicked().connect( sigc::mem_fun(*this,
......
......@@ -33,7 +33,7 @@ ExampleWindow::ExampleWindow()
m_Grid.attach(m_ButtonBox, 0, 2, 2, 1);
m_ButtonBox.pack_start(m_Button_Quit, Gtk::PackOptions::SHRINK);
m_ButtonBox.add(m_Button_Quit);
m_ButtonBox.set_margin(6);
m_ButtonBox.set_layout(Gtk::ButtonBoxStyle::END);
m_Button_Quit.signal_clicked().connect( sigc::mem_fun(*this, &ExampleWindow::on_button_quit) );
......
......@@ -28,12 +28,15 @@ ExampleWindow::ExampleWindow()
add(m_VBox);
m_VBox.pack_start(m_Label, Gtk::PackOptions::EXPAND_WIDGET);
m_VBox.add(m_Label);
m_Label.set_expand(true);
m_Label.set_line_wrap(true);
m_Label.set_selectable(true);
m_VBox.pack_start(m_ButtonBox, Gtk::PackOptions::EXPAND_WIDGET);
m_ButtonBox.pack_start(m_Button, Gtk::PackOptions::EXPAND_WIDGET);
m_VBox.add(m_ButtonBox);
m_ButtonBox.set_expand(true);
m_ButtonBox.add(m_Button);
m_Button.set_expand(true);
m_Button.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_clicked) );
......
......@@ -26,11 +26,11 @@ ExampleWindow::ExampleWindow()
add(m_VBox);
m_VBox.pack_start(m_ColorButton, Gtk::PackOptions::SHRINK);
m_VBox.add(m_ColorButton);
m_ColorButton.signal_color_set().connect(sigc::mem_fun(*this,
&ExampleWindow::on_color_button_color_set) );
m_VBox.pack_start(m_Button_Dialog, Gtk::PackOptions::SHRINK);
m_VBox.add(m_Button_Dialog);
m_Button_Dialog.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_dialog_clicked) );
......@@ -41,7 +41,8 @@ ExampleWindow::ExampleWindow()
m_Color.set_alpha(1.0); //opaque
m_ColorButton.set_rgba(m_Color);
m_VBox.pack_start(m_DrawingArea, Gtk::PackOptions::EXPAND_WIDGET);
m_VBox.add(m_DrawingArea);
m_DrawingArea.set_expand(true);
m_DrawingArea.set_draw_func(sigc::mem_fun(*this, &ExampleWindow::on_drawing_area_draw));
}
......
......@@ -27,11 +27,13 @@ ExampleWindow::ExampleWindow()
add(m_ButtonBox);
m_ButtonBox.pack_start(m_Button_File, Gtk::PackOptions::EXPAND_WIDGET);
m_ButtonBox.add(m_Button_File);
m_Button_File.set_expand(true);
m_Button_File.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_file_clicked) );
m_ButtonBox.pack_start(m_Button_Folder, Gtk::PackOptions::EXPAND_WIDGET);
m_ButtonBox.add(m_Button_Folder);
m_Button_Folder.set_expand(true);
m_Button_Folder.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_folder_clicked) );
}
......
......@@ -25,11 +25,13 @@ ExampleWindow::ExampleWindow()
add(m_ButtonBox);
m_ButtonBox.pack_start(m_Button_File_Open, Gtk::PackOptions::EXPAND_WIDGET);
m_ButtonBox.add(m_Button_File_Open);
m_Button_File_Open.set_expand(true);
m_Button_File_Open.signal_clicked().connect(sigc::bind(sigc::mem_fun(*this,
&ExampleWindow::on_button_file_clicked), Gtk::FileChooser::Action::OPEN));
m_ButtonBox.pack_start(m_Button_File_Save, Gtk::PackOptions::EXPAND_WIDGET);
m_ButtonBox.add(m_Button_File_Save);
m_Button_File_Save.set_expand(true);
m_Button_File_Save.signal_clicked().connect(sigc::bind(sigc::mem_fun(*this,
&ExampleWindow::on_button_file_clicked), Gtk::FileChooser::Action::SAVE));
}
......
......@@ -26,13 +26,15 @@ ExampleWindow::ExampleWindow()
add(m_ButtonBox);
m_ButtonBox.pack_start(m_FontButton, Gtk::PackOptions::EXPAND_WIDGET);
m_ButtonBox.add(m_FontButton);
m_FontButton.set_expand(true);
m_FontButton.set_use_font(true);
m_FontButton.set_use_size(true);
m_FontButton.signal_font_set().connect(sigc::mem_fun(*this,
&ExampleWindow::on_font_button_font_set) );
m_ButtonBox.pack_start(m_Button_Dialog, Gtk::PackOptions::EXPAND_WIDGET);
m_ButtonBox.add(m_Button_Dialog);
m_Button_Dialog.set_expand(true);
m_Button_Dialog.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_dialog_clicked) );
}
......
......@@ -28,11 +28,13 @@ ExampleWindow::ExampleWindow()
add(m_ButtonBox);
m_ButtonBox.pack_start(m_Button_Info, Gtk::PackOptions::EXPAND_WIDGET);
m_ButtonBox.add(m_Button_Info);
m_Button_Info.set_expand(true);
m_Button_Info.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_info_clicked) );
m_ButtonBox.pack_start(m_Button_Question, Gtk::PackOptions::EXPAND_WIDGET);
m_ButtonBox.add(m_Button_Question);
m_Button_Question.set_expand(true);
m_Button_Question.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_question_clicked) );
}
......
......@@ -35,7 +35,8 @@ DnDWindow::DnDWindow()
m_Button_Drag.signal_drag_data_get().connect(sigc::mem_fun(*this,
&DnDWindow::on_button_drag_data_get));
m_HBox.pack_start(m_Button_Drag, Gtk::PackOptions::EXPAND_WIDGET);
m_HBox.add(m_Button_Drag);
m_Button_Drag.set_expand(true);
//Drop site:
......@@ -50,7 +51,8 @@ DnDWindow::DnDWindow()
m_Label_Drop.signal_drag_data_received().connect(sigc::mem_fun(*this,
&DnDWindow::on_label_drop_drag_data_received) );
m_HBox.pack_start(m_Label_Drop, Gtk::PackOptions::EXPAND_WIDGET);
m_HBox.add(m_Label_Drop);
m_Label_Drop.set_expand(true);
}
DnDWindow::~DnDWindow()
......
......@@ -26,13 +26,14 @@ ExampleWindow::ExampleWindow()
set_title("Gtk::EntryCompletion");
add(m_VBox);
m_VBox.pack_start(m_Entry, Gtk::PackOptions::SHRINK);
m_VBox.add(m_Entry);
m_VBox.pack_start(m_Label, Gtk::PackOptions::EXPAND_WIDGET);
m_VBox.add(m_Label);
m_Label.set_expand(true);