pointer of functions - what a confusing things :-)



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


 

-- 
"Feel free" mit GMX FreeMail!
Monat für Monat 10 FreeSMS inklusive! http://www.gmx.net



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