Re: grid widget (was Re: possible removal of GtkWrapBox)



On Sun, Oct 10, 2010 at 4:23 AM, Tristan Van Berkom
<tristanvb openismus com> wrote:


>  - in get_preferred_width() and get_preferred_height() it seems
>    you do the same request regardless of the request mode... it may
>    that you check this somewhere else in your request code but I did
>    not see it.
>
>    its important in this case when get_height() is called for a
>    height-for-width widget that you return the height for minimum
>    width, the easiest way I found to do this is just to invoke your
>    vfuncs from get_height:
>       if (is_height_for_width) {
>         get_width ( &min_width )
>         get_height_for_width ( min_width, &min_height, &nat_height );
>       }
>
>  - in get_height_for_width() and get_width_for_height() it seems you do
>    something like the above check... what needs to be done here:
>
>      a.) in get_width_for_height() for a height-for-width mode grid
>          (and the opposite), you need only return the results of
>          get_preferred_width()
>
>      b.) in get_height_for_width() for a height-for-width widget, I
>          found it was important to ensure you dont request for
>          something less than the minimum width, so:
>
>            min_width = grid->get_preferred_width ( &min_width );
>            get_height_for_width ( MAX (min_width, for_width),
>                                  &min_height, &nat_height);


Thanks, I  had not fully digested some of these finer points, it seems.
We should have this in an 'w-f-h implementation hints' section in the
docs, maybe.

It turned out that these things fit really well into the generic
machinery in gtkgrid.c. I hope things look better now.

I've also added a scrolling testcase.


Thanks, Matthias


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