Re: Question of Style [was Re: Conceptual Question on Signal Handling in Subclasses]



Ian Flanigan <flan lean to> writes: 
The thing is, I've looked through many of the GTK class definitions
and I've never seen a virtual function that wasn't the default handler
for a signal.  This leads me to believe that in GTK virtual functions
are, by convention, only used for signal handling.  Is this true?

Oh, your problem is easy then. No, it isn't true. It's
expected/normal/good to use non-signal virtual functions here.

GTK code (especially older GTK code) tends to make every random
virtual function also be a signal. For example, GtkWidget::show is
just a virtual function, it isn't a signal the widget was shown. 
The rationale is something between "why not?" and "it makes the
function introspectable" and "maybe you want to derive without writing
a subclass."

Typically notification signals are named in the past tense ("clicked")
and virtual functions that may happen to be registered as default
signal handlers are in the imperative ("show", "do_foo").

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]