Re: gtk_widget_set_size_request stopped working with GTK3
- From: Steffen Gutmann <muibase yahoo com>
- To: Tristan Van Berkom <tvb gnome org>
- Cc: "gtk-devel-list gnome org" <gtk-devel-list gnome org>
- Subject: Re: gtk_widget_set_size_request stopped working with GTK3
- Date: Mon, 1 Oct 2012 09:52:37 -0700 (PDT)
Hi Tristan!
> Lets not go around the merry-go-round one more time.
>
> In GTK+3, widgets receive *at least* what they requested in the size
> requesting phase.
>
> User facing apis cannot undermine the minimal requirements for the geometry
> which a widget has requested.
>
> User facing apis can however, enforce a minimum size (i.e. the widget
> will be at least "this big")
> or they can configure a widget in such a way that it will require less size.
Ok, I accept this statement. Will the docs of gtk_widget_set_size_request be updated accordingly?
For GtkImage though, I think we need some way to specify the minimum size when a GdkPixbuf is used.
> The "pixel-size" thing not working for pixbufs could be considered an
> enhancement
> request bug for GtkImage.
>
> i.e. it should support clipping of pixbufs (and then, it should also
> need some alignment
> parameters to decide which portion of the input image should be
> clipped, also pixel-size
> does not really imply clipping directly, the user might very well
> expect the image to scale
> to the desired size).
The docs for gtk_image_set_pixel size says:
"Sets the pixel size to use for named icons. If the pixel size is set
to a value != -1, it is used instead of the icon size set by gtk_image_set_from_icon_name().
"
This is not really clear to me. Does it scale the image to the desired pixel size, or center or crop them? This should be specified in the docs.
Also for a GtkImage based on a GdkPixbuf, don't we want to support different values for width and height? The pixel size only specifies one dimension. Are the icons always of a squared size?
Maybe two new properties in GtkImage would do the job, say "pixbuf-width-request" and "pixbuf-height-request". They would do the same thing as
"width-request" and "height-request" in GTK2. Or, say we allow shrinking of the size in "width-request" and "height-request" but only if an additional new property "size-request-enforce" (boolean, default is FALSE) is set to TRUE.
Regarding alignment, the "halign" and "valign" properties in GtkWidget may be useful. Although they currently are only meaningful when there is extra space, not when the content of the Widget is larger than the allocated space.
> a.) Create a GtkDrawingArea
>
> b.) Connect to "draw" signal
>
> c.) Use this code:
>
> gdk_cairo_set_source_pixbuf (cr, pixbuf, x, y);
> cairo_paint (cr);
> (borrowed directly from:
Yes, that works. Thanks!
Steffen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]