Re: Pluggable widgets II



On Wed, 20 Dec 2006, Mark McLoughlin wrote:

Hi Tim,
	Just a couple of things I'm confused about:

 - How does this work for interface types?

   e.g. I can understand how you might want to replace GtkEntry's
   editable interface, but not how you'd appoint an implementation type
   for GTK_TYPE_EDITABLE

you can't use it to replace the editable interface, however suppose
gtk+ offered this API:

GType
gtk_editable_get_type (void)
{
  [...]
  /* apppoint default implementation type for gtk_editable_new() */
  g_factory_appoint (GTK_TYPE_EDITABLE, GTK_TYPE_ENTRY);
  return type;
}

/* create a stock gtk widget to display and edit text */
GtkWidget*
gtk_editable_new (void)
{
  /* this relies on an implementation type being appointed for GtkEditable */
  return g_factory_create (GTK_TYPE_EDITABLE, NULL);
}

you could use gtk_editable_new() to create a widget conforming to GtkEditable
to display and edit text. however, you can still appoint a type other than
the stock GtkEntry widget as a platform vendor to be created by calls
to gtk_editable_new().

of course, the same will be possible for gtk_entry_new(), i just meant to
extend on your interface example. the above interface implementation
appointing seems particularly suited for future dialog types.

 - How does this work for application derived types?

   e.g. if vino derives from GtkLabel to make a label which looks like
   a clickable URL, then even if it is instantiated using
   g_factory_create() a gtk theme module will not be able to replace
   it given the fact it does not have access to the derived gtype

a theme has many other means to affect widget look or behavior.
it is not meant to appoint new widget types. or - if you have a
use case for this, please elaborate.

Thanks,
Mark.

---
ciaoTJ



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