/*
 *
 * g++ `pkg-config --libs gtkmm-2.0 --cflags gtkmm-2.0` -o frametest2 test2.cc
 *
 */
#include <gtkmm.h>

using namespace SigC;

class MyFrame : public Gtk::Frame
{
public:
  MyFrame(string s) : Gtk::Frame(s), b(s) {
    add(b);
  }

  virtual ~MyFrame() {
    cout << "MyFrame dtor" << endl;
  }
private:
  Gtk::Button b;
};

class TestWindow : public Gtk::Window
{
public:
  TestWindow() {
    add(vbox1);
    vbox1.pack_start(*manage(new MyFrame("frame")));

    Gtk::Button *b = manage(new Gtk::Button("delete widgets"));
    b->signal_clicked().connect(slot(*this, &TestWindow::on_button_clicked));
    vbox1.pack_start(*b);
    show_all();
  }
private:
  void on_button_clicked() {
    vbox1.children().erase(vbox1.children().begin(), vbox1.children().end());
  }
  
  Gtk::VBox vbox1;
};



int main (int argc, char *argv[])
{
  Gtk::Main kit(argc, argv);
  TestWindow w;
  kit.run(w);
  return 0;
}
