Re: [gtk-list] Re: Interfaces



On 16 Apr 1999, Guillaume Laurent wrote:

> Tim Janik <timj@gtk.org> writes:
> 
> > the interfaces are meant to follow much the c++ style of signatures,
> 
> I'm not quite sure of what you mean by this...

take a look at the C++ Signatures:: node in your gcc info pages.

> > that is for two given classes class A { int foo (int); } and class B
> > { int foo (int); } which both introduce int foo (int); but don't
> > inherit from each other, you can magically cast both of them into S,
> > where S would be signature S { int foo (int); }.
> 
> That's more or less the principle of Java interfaces, I suppose the
> definition of A and B specify that they implement interface S.
>  
> > of course, this doesn't work as magically with gtk as well
> 
> And I wonder how much magic it will take to wrap this in C++ or
> ObjC. :-)

if language bindings don't come up with a way to export the interfaces,
they can still revert to the normal API provided, e.g.
gtk_radio_button_get_group() and gtk_radio_menu_item_get_group(),
they'd just lack a gtk_radio_get_group() function and the ability to
implement interfaces themselves for that matter.
on the other hand, a bunch of the OO bindings already do things the
right way, e.g. with Gtk-- you simply use this->set_group(), no matter
whether this is a Gtk_RadioMenuItem or a Gtk_RadioButton (except that
the current Gtk-- bindings don't dare to export set_group() for
GtkRadioButton, just for GtkRadioManuItem).

> 
> Really, you sure you're not taking this "let's do OO in C" thing a bit
> too far ?

this didn't steam out of the blue due to an intend to complexify Gtk+'s
type system, but provides a reasonable solution for a bunch of problems
we encountered because of lack of multiple inheritance.
the GtkRadio example i gave is a good one in this sense, as well as one
for GtkToggle would be. a GtkScrollable is also desperatedly needed to
unify and consistently extend the widget types that are currently
featured specially by a GtkScrolledWindow. all of these could well be
implemented through multiple inheritance, but i don't think any healthy
minded programmer would like to see those implemented in Gtk+(+++).

> 
> -- 
> 					Guillaume.
> 

---
ciaoTJ



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