Example #1
0
Gobby::ClosableFrame::ClosableFrame(const Glib::ustring& title,
                                    const Glib::ustring& icon_name,
                                    Preferences::Option<bool>& option):
	m_option(option), m_allow_visible(true)
{
	CloseButton* button = Gtk::manage(new CloseButton);

	button->set_hexpand(true);
	button->set_halign(Gtk::ALIGN_END);

	button->signal_clicked().connect(
		sigc::mem_fun(*this, &ClosableFrame::on_clicked));
	m_option.signal_changed().connect(
		sigc::mem_fun(*this, &ClosableFrame::on_option));

	button->show();

	Gtk::Image* image = Gtk::manage(
		new Gtk::Image);
	image->set_from_icon_name(icon_name, Gtk::ICON_SIZE_MENU);
	image->show();

	Gtk::Label* label_title = Gtk::manage(
		new Gtk::Label(title, Gtk::ALIGN_START));
	label_title->show();

	m_grid.set_border_width(6);
	m_grid.set_column_spacing(6);
	m_grid.set_row_spacing(6);
	m_grid.attach(*image, 0, 0, 1, 1);
	m_grid.attach(*label_title, 1, 0, 1, 1);
	m_grid.attach(*button, 2, 0, 1, 1);
	m_grid.show();

	add(m_grid);

	on_option();
}