Done, now in CVS. Cheers, Fons. PS: PS will be investigated later. Brett Viren wrote: > > Hi, > > Could we make the *SIGNAL* methods of the TG classes virtual? > > For my app, I am working to plug in libsigc++ as an alternative to Rt. > For my subclasses of the TG classes I want my signals called in > response to interactive events (eg. button clicks). If the *SIGNAL* > methods were made virtual, I could very easily override them. For > example: > > class MyTextButton : public TGTextButton > { > public: > ... > SigC::Signal0<void> clicked; > > }; > void MyTextButton::Clicked() > { > // Support any old code which uses Rt > this->TGTextButton::Clicked(); > clicked(); > } > > Besides my desire, making the *SIGNAL* methods virtual is generally > useful as it allows people an alternative way to respond to the events > which generate signals by deriving from TG classes instead of > attaching to signals. Gtk-- does this for all their events by having > some_event_impl() virtual methods in their classes. Qt kind of does > this as well, but with specific protected virutal methods (for example > in QSlider, the 4 possible signals are translated to 2 possible > virtual protected methods). > > Besides the convenience of more options it allows speed optimization > when needed (a virtual method table lookup is much faster than an Rt > signal can ever be). I am not sure if this is a huge win, but it > isn't a loss. > > Thanks, > -Brett. > > PS: Looking around gui/{inc,src}/ I think TGMainFrame::CloseWindow() > might need special treatment as it doesn't follow the "standard" and > call Emit(). I would suggest creating a new virtual method > CloseWindowSignal() which does call Emit("CloseWindow()") and use that > in place of the raw Emit("CloseWindow()") call in > TGMainFrame::HandleClientMessage(). I seem to remember other > complications about this signal, so maybe something further is needed > for this signal. -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7679480
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:07 MET