Re: determine the the type of an object
- From: Horváth Imre <blemidon kabelnet hu>
- To: Pavlo Korzhyk <pavlo korzhyk gmail com>
- Cc: "gtkmm-list gnome org" <gtkmm-list gnome org>
- Subject: Re: determine the the type of an object
- Date: Fri, 22 Dec 2006 18:45:14 +0100
Hi,
Yes, you can not connect a virtual function :(
I've tried this before...
Thanx:
Imre Horvath
2006. 12. 22, p�ek keltez�el 14.06-kor Pavlo Korzhyk ezt �a:
> > 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.
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]