Using Gtk::Bin
- From: Filipe Apostolo <f apostolo cbr gmail com>
- To: gtkmm-list gnome org
- Subject: Using Gtk::Bin
- Date: Tue, 28 Oct 2008 17:43:39 +0000
I've created a class derived from Gtk::Bin that will heave a single child.
In this case will heave an simple Gtk::Button;
class MyWidget : public Gtk::Bin
{
public:
MyWidget();
virtual ~MyWidget();
protected:
private:
Gtk::Button mTestButton;
};
###################
MyWidget::MyWidget():
mTestButton ("Worked")
{
add (mTestButton);
mTestButton.show();
show_all();
}
And the I heave a class that uses MyWidget.
class ExampleWindow : public Gtk::Window
{
public:
ExampleWindow();
virtual ~ExampleWindow();
protected:
//Signal handlers:
virtual void on_button_quit();
private:
Gtk::VBox m_VBox;
MyWidget m_MyWidget;
Gtk::HButtonBox m_ButtonBox;
Gtk::Button m_Button_Quit;
};
##################################
ExampleWindow::ExampleWindow()
:
m_Button_Quit("Quit")
{
set_title("Custom Widget example");
set_border_width(6);
set_default_size(400, 200);
add(m_VBox);
m_VBox.pack_start(m_MyWidget, Gtk::PACK_EXPAND_WIDGET);
m_MyWidget.show();
m_VBox.pack_start(m_ButtonBox, Gtk::PACK_SHRINK);
m_ButtonBox.pack_start(m_Button_Quit, Gtk::PACK_SHRINK);
m_ButtonBox.set_border_width(6);
m_ButtonBox.set_layout(Gtk::BUTTONBOX_END);
m_Button_Quit.signal_clicked().connect( sigc::mem_fun(*this,
&ExampleWindow::on_button_quit) );
show_all_children();
}
ExampleWindow::~ExampleWindow()
{
}
void ExampleWindow::on_button_quit()
{
hide();
}
Can anybody tell me what am I missing? beacause it only appears the
window with the size that I requested and the quit button. The button in
my widget don't appears.
Tanks
F.Apostolo
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]