[sigc] GTK+ and C++ member function for callback function?
- From: Phong Cao <phngcv gmail com>
- To: libsigc-list gnome org
- Subject: [sigc] GTK+ and C++ member function for callback function?
- Date: Sat, 18 Jun 2011 20:01:47 -0400
Hello everybody,
I am familiar with GTK+ and new to libsigc++. I just want to ask you guys if there is a way to use libsigc++ to connect a GTK+ function with a callback function which is a member of a class. Consider this code:
class TopWin {
public:
//selection_func is a non-static member function.
gboolean selection_func(GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, gboolean path_currently_selected, gpointer user_data);
private:
//private members here...
};
int main(int argc, char *argv[]) {
gtk_init(&argc, &argv);
//...some codes here
//error: can't connect to TopWin::selection_func
gtk_tree_selection_set_select_function(l_select, TopWin::selection_func, NULL, NULL);
return 0;
}
Is there anyway to use libsigc++ to connect gtk_tree_selection_set_select_function() to TopWin::selection_func without declaring TopWin::selection_func as static?
I thought about using Gtkmm instead of Gtk+ a long time ago but the only Gtkmm tutorial available is in the Gtkmm main website and it is so confusing. I ended up continuing to code in C++ and GTK+.
I have also read the libsigc++ tutorial but still unable to solve this problem. I don't want to declare TopWin::selection_func as static because if I do I will have to declare every member of the class static, which is quite painful...!
Thank you for reading my message! Have a good weekend!
Best regards,
Phong Cao,
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]