Re: GnomeMDIChild and their views

> Hi Jaka,

sorry for not promptly replying to your previous mail, but I am just soooo busy these days...

> I'm having a little trouble figuring out the relationship
> between the child and the view in your GnomeMDI system.
> The API seems to imply that only one type of view can 
> exist per child, even though you can create more than one
> view per child.  The add_view() functions don't allow for
> any extra parameters to specify which type of view you
> want to add, and the remove_view() functions don't allow
> you to say which view you want removed.  Am I confused, 
> or is this how it's supposed to work?
well, what you are mentioning really is a drawback, but just in the API, coming from the fact that I never thought of different types of views when I was working on the API (which was designed with GHex as a testbed). 
remove_view() of course lets you specify the view: you pass it a pointer to the view you want to remove.

> However, it doesn't seem like GnomeMDI is built to support
> this, at least without extending the current API.  Was
> this part of the original intent of GnomeMDI, and if so,
> how would I make use of it?  Would I have to derive my
> own Child classes to do so?  Is the limitation just in
> GnomeMDIGenericChild?
the API makes it awkward to implement indeed. my proposal is to create a single view type that is merely a container widget that contains your actual view, you create different widgets for each view type and put one of them in the "real" view (the container use a function like my_view_change_type(view, view_type) to change it.

you would do something like this when adding a new view:

gnome_mdi_add_view(mdi, my_child);
view = gnome_mdi_get_active_view(mdi);
set_view_type(view, A_VIEW_TYPE);

where the last call would remove any previous contents from the view and insert the proper widget for the desired type. I hope I wasn't too unclear.

and now I see that it would be very nice if gnome_mdi_add_view() would return a pointer to the created view... sigh... I guess we'll have to wait for 2.0 to make such changes...

the API should be rethought and modified a bit for 2.0. any of your comments are very welcome. you might say that for now multiple view types may exist, but the MDI does not know anything about it ;).
> Another way to put this is, what good is it to have more
> than one identical view of the same child object?  (c:
not identical views, identical view types, think of a text document with three views of the same type, each showing a different portion of text... ie: the document data is identical for all views but the view parameters may differ between views (like the line in which the cursor of a text editor is).


pošt@.kiss at

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