Re: [gtk-list] hiding things and resizing...



On Fri, 27 Feb 1998, Owen Taylor wrote:

> 
> > > Me again... *smirk* smack me if I get too loud  ;)
> > > 
> > > Same application, I want a portion of the window (some option buttons) to
> > > be shown only when the user wants them.  Using widget_hide() works just
> > > fine, except that I don't want the widgets left in the window resizing to
> > > fit the window.  What I want is for the window to resize to fit the
> > > widgets.  (unhiding the options does re-inflate the window, the window
> > > just doesn't auto-deflate)
> 
> I think what what is wanted is:
> 
> void
> gtk_window_set_policy (GtkWindow *window,
> 		       gint       allow_shrink,
> 		       gint       allow_grow,
> 		       gint       auto_shrink)

this wouldnÄt work because it is the internal allocation that
changes, i.e. the allocation of the children of the parent of the+#
widget that got hidden. (too complicated? here is the pseudo code):


widget_hide:
{
  unmap(widget);
  
  size_request(widget->parent);
  size_allocate (widget->parent);
}


now what needs to be achived is just the unmap behaviou, without
the widget->parent taking the widget out of its size computation,
it should just behave as if the widget was still visible.

> If you set auto_shrink to TRUE, it should do what you want.
> 
> > i would suggest something like an extra NO_WINDOW container
> > (e.g. GtkSpaceBox ;) that will always request the size of its child, no
> > matter whether it is visible or not.
> > hm, come too think about it i belive i could hack that up pretty quick,
> > it should be a pretty small container derived from GtkBin that needs to
> > overload the size_request, size_allocate, map, unmap and expose handlers...
> > what do people think?
> > 
> > [owen, what leeman asks for is the current (visible!) behaviour if you force
> > unrealize a widget. (which would be bad since currently gtk_widget_unrealize
> > leaves GTK_MAPPED set on a widget that doesn't have a window anymore.)
> > do we have any possibility to prevent (preserve??) this visible behaviour,
> > without enforcing the invariants on gtk_widget_unrealize (which in turn
> > would change its behaviour)?]
> 
> I don't see too much point in having that behavior. (Making widgets
> disappear without changing the allocation).

well, i actually like the idea to be able to make a widget purposly
disappear, leaving a gap.

> Depending on what you are looking for, doing
> gtk_container_block_resize() on the parent in conjuction with
> gtk_window_hide might work anyways.

you would need to leave gtk_container_block_resize() set,
and that wouldn't work with subsequent window resizing calls.
gtk_container_[un]block_resize() is just there for wrapping
tree changes where an intermediate resizing wouldn't make
any sense, e.g. between subsequent removals of a bunch of list items.

> But I don't think that was what was being asked for.
> 
> I'd rather leave unrealize() as a internal call, than hijack
> it to get a particular (uncommmon) visual effect.

yep, actually i think GtkSpaceBox is the right thing to do, but i
fear it won't get into 1.0 (though pretty small and easy) since
we are having a feature freeze now.

> 
> Regards,
>                                         Owen
> 

---
ciaoTJ



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