Re: Task list for gnome-libs-1.0



Martin Baulig wrote:

> >>>>
> gnome-mdi: OK, although several people think it is a bit painful to have
> to derive widgets in order to MDI-ify applications.
> <<<<
> 
> What about adding something like a general GnomeMDIContainerChild widget
> and the init function gnome_mdi_container_child_new () taking a
> GnomeUIInfo for the Menu and a widget to use inside ?
> 
> This would allow people to use some code like this:
> 
>         label = gtk_label_new (_("This is a test"));
> 
>         child = gnome_mdi_container_child_new (NULL, label);
> 
>         gnome_mdi_add_child (mdi, GNOME_MDI_CHILD (page));
>         gnome_mdi_add_view (mdi, GNOME_MDI_CHILD (page));
> 
> to avoid the subclassing.
> 
> Jaka, what do you think about this ?

I've come up with an idea very similar to yours: make create_view,
create_menus and other signal members of the GnomeMDIChildClass
"virtual" functions (just pointers to a function) instead of signals
(they really make no sense as signals since they all return allocated
memory). then subclass GnomeMDIChild to GnomeMDIGenericChild which
becomes a part of libgnomeui and let each instance of this class have
these members also and set them for each object:

child = gnome_mdi_generic_child_new("name", create_view, create_menus,
get_conf_str, set_label);

the "virtual" functions for GnomeMDIGenericChildClass call the object's
method that was passed to it with
the _new() call if it is non-NULL or the GnomeMDIChildClass's handler
otherwise.

this allows one to either use GnomeMDIGenericChild objects as generic
MDI children, set some user data to them and set their object-wise
functions to provide views, menus, notebook labels and config strings or
to subclass the GnomeMDIChild class (as I do in ghex and I think Martin
does in gtop).

is it OK to commit this or is one more MDI related class just to much
and should be avoided at all costs ;)

regards,
	jaKa

-- 
email: jaka.mocnik@kiss.uni-lj.si
w3:    http://pluton.ijs.si/~jaka



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