Handling Signals: Base class or embedded?
- From: Matthias Kaeppler <nospam digitalraid com>
- To: gtkmm-list gnome org
- Subject: Handling Signals: Base class or embedded?
- Date: Sat, 09 Apr 2005 13:30:42 +0200
Hello,
say I have a class, which derives from Widget. In this class, I have a
TreeView, which takes pretty much the whole window area.
If I now click into this window, which object will fire an event, the
Widget or the TreeView?
To specify my problem, is there a difference between this code:
class MyWidget: public Gtk::ScrolledWindow
{
Gtk::TreeView view_;
// ...
public:
virtual bool on_button_press_event( GdkEventButton *event );
// ...
};
// override base class handler
bool MyWidget::on_button_press_event( GdkEventButton *event )
{
// ...
}
... and this code:
class MyWidget: public Gtk::ScrolledWindow
{
Gtk::TreeView view_;
// ...
public:
void on_button_press_event( GdkEventButton *event );
// ...
};
view_.signal_button_press_event().connect_notify( sigc::mem_fun( *this,
&MyWidget::on_button_press_event ) );
void MyWidget::on_button_press_event( GdkEventButton *event )
{
// ...
}
?
I am currently doing the first, just override the base class handler,
but that doesn't seem to work. Or maybe I have to connect the overriden
handler to the signal as well?
*confused*
--
Matthias Kaeppler
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]