Re: determine the the type of an object
- From: "Pavlo Korzhyk" <pavlo korzhyk gmail com>
- To: "Horváth Imre" <blemidon kabelnet hu>
- Cc: gtkmm-list gnome org
- Subject: Re: determine the the type of an object
- Date: Fri, 22 Dec 2006 14:06:02 +0200
So the toolbar reconnect function gets a Gtk::Widget (the active tab),
and i need to know the class of this widget:
// connect the toolbuttons to the widget
void RecordToolbar::reconnect(Gtk::Widget *aWidget)
{
toolbutton_first.signal_clicked().connect( sigc::mem_fun(*aWidget,
&[HERE I NEED THE CLASS OF THE WIDGET]::on_record_first) );
}
Do you now can I solve this problem?
In theory you may create a second base class for your tabs. Your code
will be something like:
class AbstractTab{
public:
virtual void on_toolbar1()=0;
virtual void on_toolbar2()=0;
...
};
class MyPageWidget : public Gtk::Widget , public AbstractTab{
public:
virtual void on_toolbar1();
virtual void on_toolbar2();
...
};
void MyPageWidget::on_toolbar1()
{
//write here the custom code of your tab
}
and ALLWAYS reconnect with
toolbutton_first.signal_clicked().connect( sigc::mem_fun(*aWidget,
&AbstractTab::on_record_first) );
Each time the signal with different "this" but same function address
will be reconnected.
I never used virtual functions with sigc, so I could be missing
something obvious.
Anyway hope this post will be of some use :)
BTW don't forget to disconnect all other signals before/after a new handler.
--
WBR, Pavlo Korzhyk
ICQ#155870780
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]