Gtk button event
Код:
bool butt(GdkEventButton* event){
//Cairo::RefPtr<Cairo::Context> cr=event->window->get_cairo_context ();
}
int
main (int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
//Load the Glade file and instiate its widgets:
Glib::RefPtr<Gtk::Builder> builder;
try
{
builder = Gtk::Builder::create_from_file(UI_FILE);
}
catch (const Glib::FileError & ex)
{
std::cerr << ex.what() << std::endl;
return 1;
}
Gtk::Window* main_win = 0;
Gtk::DrawingArea* drow = 0;
builder->get_widget("main_window", main_win);
builder->get_widget("drawingarea1", drow);
drow->signal_draw ().connect(
sigc::ptr_fun(&drowww));
drow->signal_button_press_event ().connect(
sigc::ptr_fun(&butt));
if (main_win)
{
kit.run(*main_win);
}
return 0;
}
//Cairo::RefPtr<Cairo::Context> cr=event->window->get_cairo_context ();
}
int
main (int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
//Load the Glade file and instiate its widgets:
Glib::RefPtr<Gtk::Builder> builder;
try
{
builder = Gtk::Builder::create_from_file(UI_FILE);
}
catch (const Glib::FileError & ex)
{
std::cerr << ex.what() << std::endl;
return 1;
}
Gtk::Window* main_win = 0;
Gtk::DrawingArea* drow = 0;
builder->get_widget("main_window", main_win);
builder->get_widget("drawingarea1", drow);
drow->signal_draw ().connect(
sigc::ptr_fun(&drowww));
drow->signal_button_press_event ().connect(
sigc::ptr_fun(&butt));
if (main_win)
{
kit.run(*main_win);
}
return 0;
}