All pastes #629631 Raw Edit

Untitled

public text v1 · immutable
·published 2007-07-22 14:32 UTC
rendered paste body
void standalone_function ()
{
  std::cout << "standalone_function" << std::endl;
}

class MyButton : public Gtk::Button
{
  public:
    void on_clicked () { std::cout << "on_clicked" << std::endl; }
};


int main(int argc, char** argv)
{
  Gtk::Main kit (argc, argv);

  // if you don't use inheritance, connect to the signal
  Gtk::Button button1;
  button2.signal_clicked ().connect (sigc::ptr_fun (&standalone_function));

  // this class defines the virtual function on_clicked, which will automatically
  // fun when the signal is emitted, you don't need to explicitly connect it.
  MyButton button2;

  Gtk::Main::run ();
}