Re: pointer of functions - what a confusing things :-)



thom_schu gmx de wrote:

Hi,
since I was not able to get the Gtk::TreeView working under Windows (linker
error), I decided to write my own Wrapper for a Gtk+-TreeView-Object.
The Event-Handling of my new class MyTreeView should work just like the
Event-Handling under Gtkmm.
Now I do it like this.

MyTreeView::MyTreeView()
{
 ....
 g_signal_connect(gtk_treeview,"row-activated",CALLBACK(on_row_activated),
this);
 .....
}

// function to connect
SignalRowActivated& MyTreeView::signal_row_activated()
{
 return row_activated_;
}

// callback-function, not a member of MyTreeView
void on_row_activated(GtkTreeView*,GtkTreePath*,GtkTreeViewColumn*, gpointer user_data) {
 ((MyTreeView*)user_data)->row_activated_.emit(tree_view, path);
}

The method on_row_activated is not a member-function, and this I think is
very dirty - but I didnt find a way to give the CALLBACK() a
member-function. Isnt there a way to do it like this :

CALLBACK(&MyTreeView::on_row_activated) ?

thanks in advance

gizmo




Use the macro G_CALLBACK.

bob
begin:vcard
fn:Robert Caryl
n:Caryl;Robert
org:Fiscal Systems, Inc.
adr:;;102 Commerce Circle;Madison;AL;35758;USA
email;internet:bob fis-cal com
title:Senior Software Design Engineer
tel;work:356-772-8920 X108
x-mozilla-html:TRUE
url:http://www.fis-cal.com
version:2.1
end:vcard



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]