Energon
05-20-2002, 11:50 PM
Okay, I've got a Gtk::Tree object in my GUI. And I want to know when an item is double clicked, so I do this:
item = manage(new Gtk::TreeItem(info.description));
item->button_press_event.connect(slot(itemButtonHandler ));
And this is the handler:
int itemButtonHandler(GdkEventButton* button)
{
switch(button->type)
{
case GDK_BUTTON_PRESS:
break;
case GDK_2BUTTON_PRESS:
switch(button->button)
{
case 1:
std::cout << "window - " << button->window->user_data << std::endl;
break;
default:
return false;
}
return true;
case GDK_3BUTTON_PRESS:
break;
default:
return false;
}
return false;
}
Which is absolutely grand... except that in the handler, I have no way of knowing which item was double clicked. The GdkEventButton object has a window pointer, but it's for the GdkWindow and not the Gtk widget (ie, the pointers don't match up). Is there a way I can overload the connect? I know it's possible, but I though that required me to pass the parameters, and I don't have the event parameter to pass...
Does anyone know of a way to get done what I'm trying to do? Thanks in advance, I really really appreciate it.
item = manage(new Gtk::TreeItem(info.description));
item->button_press_event.connect(slot(itemButtonHandler ));
And this is the handler:
int itemButtonHandler(GdkEventButton* button)
{
switch(button->type)
{
case GDK_BUTTON_PRESS:
break;
case GDK_2BUTTON_PRESS:
switch(button->button)
{
case 1:
std::cout << "window - " << button->window->user_data << std::endl;
break;
default:
return false;
}
return true;
case GDK_3BUTTON_PRESS:
break;
default:
return false;
}
return false;
}
Which is absolutely grand... except that in the handler, I have no way of knowing which item was double clicked. The GdkEventButton object has a window pointer, but it's for the GdkWindow and not the Gtk widget (ie, the pointers don't match up). Is there a way I can overload the connect? I know it's possible, but I though that required me to pass the parameters, and I don't have the event parameter to pass...
Does anyone know of a way to get done what I'm trying to do? Thanks in advance, I really really appreciate it.