|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Questions about Gtkmm/LibglademmHello, I wrote a program with PyGTK and Glade, but since I'm learning
C++ for some time now, I want to convert my Python porgram to C++. I looked trough the few examples and I manage to use my old Glade file and connect it with C++ code, so that's good. But what I don't get from the examples is the glade signal handling. In Glade, I give all widgets already a signal. So the close button gets: on_close_clicked. In Python/PyGTK this can be simply connected by making a dictionary, like: dic = { "on_close_clicked" : gtk.main_quit } self.wTree.signal_autoconnect(dic) containing all the signals. But in the Libglademm examples, they always use lines of code for each widget to connect the signals, like: Gtk::Button* pButton = 0; refXml->get_widget("quit_button", pButton); if(pButton) pButton->signal_clicked().connect( sigc::ptr_fun(&on_button_clicked) ); Isn't there a way to read the signals set in the glade file? That would save some repeating code. Timo _______________________________________________ gtkmm-list mailing list gtkmm-list@... http://mail.gnome.org/mailman/listinfo/gtkmm-list |
|
|
Re: Questions about Gtkmm/LibglademmOn Sat, 2008-05-10 at 21:56 +0200, Timo wrote: > But what I don't get from the examples is the glade signal handling. > In > Glade, I give all widgets already a signal. So the close button gets: > on_close_clicked. In Python/PyGTK this can be simply connected by > making > a dictionary, like: > dic = { "on_close_clicked" : gtk.main_quit } > self.wTree.signal_autoconnect(dic) > containing all the signals. > > But in the Libglademm examples, they always use lines of code for each > widget to connect the signals, like: > Gtk::Button* pButton = 0; > refXml->get_widget("quit_button", pButton); > if(pButton) > pButton->signal_clicked().connect( > sigc::ptr_fun(&on_button_clicked) ); > > Isn't there a way to read the signals set in the glade file? That > would > save some repeating code. No because C++ is a static language that does not allow symbolic lookup of methods. Hub _______________________________________________ gtkmm-list mailing list gtkmm-list@... http://mail.gnome.org/mailman/listinfo/gtkmm-list |
|
|
Re: Questions about Gtkmm/LibglademmOn Sat, 2008-05-10 at 16:42 -0400, Hubert Figuiere wrote:
> > Isn't there a way to read the signals set in the glade file? That > > would > > save some repeating code. > > No because C++ is a static language that does not allow symbolic lookup > of methods. It's not entirely impossible but I consider it very very difficult. I'm always open to patches to implement it, but I don't expect to ever achieve it myself. -- Murray Cumming murrayc@... www.murrayc.com www.openismus.com _______________________________________________ gtkmm-list mailing list gtkmm-list@... http://mail.gnome.org/mailman/listinfo/gtkmm-list |
|
|
Re: Questions about Gtkmm/LibglademmOn Sun, 2008-05-11 at 20:51 +0200, Murray Cumming wrote: > > > Isn't there a way to read the signals set in the glade file? That > > > would > > > save some repeating code. > > > > No because C++ is a static language that does not allow symbolic > lookup > > of methods. > > It's not entirely impossible but I consider it very very difficult. > I'm > always open to patches to implement it, but I don't expect to ever > achieve it myself. That's why Qt has moc :-) Hub _______________________________________________ gtkmm-list mailing list gtkmm-list@... http://mail.gnome.org/mailman/listinfo/gtkmm-list |
| Free Forum Powered by Nabble | Forum Help |