Re: [gtk-list] Re: Newbie with some low level questions



On Fri, 24 Apr 1998, Doug South wrote:

> Ok, so I can use gtkfixed, but I'm not completely getting the results
> I'd want.
> 
> For one, I can resize and move the widgets about using GtkAllocation and
> gtk_widget_size_allocate, but how do I find out the minimum size of a
> widget. I thought maybe that would be set in struct GtkAllocation within
> a Widget, but all fields of the struct start as 0. My understanding of
> the interrelationships between the different "packages" could be
> seriously flawed btw. Is there somewhere this data is available?

widget->requisition will give you the (minimum) size that the widget would
like to have for it's allocation. if that isn't up to date or you are about
to newly allocate a widget and need it's (new) requisition call
gtk_widget_size_request ();
e.g.:

{
  GtkAllocation allocation = { 0, 0, 0, 0 };
  
  gtk_widget_size_request (child, &child->requisition);
  allocation.x = 0;
  allocation.y = 0;
  allocation.width = child->requisition.width;
  allocation.height = child->requisition.height;

  gtk_widget_size_allocate (child, &allocation);
}

though gtk usually does this for you when you just set
gtk_widget_usize (child, 5, 5);

> 
> Also, when I put a fixed within a window, I have no problem resizing and
> moving the widget around UNTIL the window is resized. Then the widget is
> placed back into its original position (upper left hand corner of the
> fixed). Is there something I need to do in conjunction with allocate or
> is there a signal being broadcast from window that I could remove to
> short-curcuit this functionality?

concerning the movement, all containers will automatically layout
their children (that's why you see your widgets position to be resetted
when you resize the window). basically you should only move widgets around
which are children of a GtkFixed container by using gtk_fixed_move();

> 
> Doug
> -- 

---
ciaoTJ



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