Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > ca81b57b553ae75608ba0fc5e7925e4e > files > 613

libgtkmm1.2-devel-1.2.10-1mdk.ppc.rpm

#include <iostream>
#include <gtk--/main.h>
#include <gtk--/window.h>
#include <gtk--/button.h>

using std::cout;

using SigC::slot;
using SigC::bind;

class Buttons : public Gtk::Window
{
public:
  Gtk::Button *m_button;

  Buttons();
  ~Buttons();

  void callback(char *data) 
    {
      cout << "Hello again - " << data << " was pressed" << endl;
    }

  gint delete_event_impl(GdkEventAny*) { 
    Gtk::Main::quit(); return 0; 
  }
  
};

Buttons::Buttons() 
{
  m_button = manage(new Gtk::Button());
  m_button -> add_pixlabel("info.xpm", "cool button");
   
  set_title("Pixmap'd buttons!");
  set_border_width(10);
  
  m_button->clicked.connect(bind<char*>(slot(this, &Buttons::callback),
                                        "cool button"));
  
  add(*m_button);
  show_all();
}

Buttons::~Buttons() {};

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

  Buttons buttons;

  kit.run();
  return 0;
}