Re: more GDK->GTK mapping



On 28 Feb 2001, Havoc Pennington wrote:

> 
> Tim Janik <timj gtk org> writes: 
> > you should use GTK_OBJECT_TYPE() or at least G_OBJECT_TYPE(), i.e. use
> > the macros introduced for the fundamental type you're operating on.
> > 
> 
> How is this different from saying we should have gtk_entry_draw(),
> gtk_button_draw(), etc. instead of gtk_widget_draw()?
> 
> The point of inheritance is that an object is_a GTypeInstance, so you
> can call GTypeInstance methods on it. Type checks are supposed to
> catch type errors, passing an instance there is not a type error.

there is no GTypeInstance type registered with the type system,
so you can't perform is_a checks on it, additionally, there are no
such things as GTypeInstance methods. the fact that GObject includes
it as its first structure member is more of an implementation detail
than anything else (if you don't belive that, look at GtkObject in 1.2
which did not startout with GtkTypeInstance).
this is pretty much the same issue as g_type_create_instance() vs.
g_object_new(), a certain set of the gtype.h API is reserved for
implementations of fundamental types and its documentation will
outline this at some point. for the time being, it should be pretty
easy to keep in mind, that as long as you use GObjects, use the GObject
API since its a fundamental type and as such comes with the fundamental
primitives required, i.e. a macro to extract its type.

on a side note, my main worry here is compatibility, i'll not gurantee
that the API required to implement fundamental types will remain as stable
as you'd expect e.g. the GObject API to stay.

> 
> Havoc
> 

---
ciaoTJ





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