Re: Invisible GtkImage
On Sat, 22 Jun 2013 15:30:34 -0700, Kip Warner wrote: Yes, your code is similar to what I had tried before with GtkImage, only you're subclassing the DrawingArea instead which is probably a better idea, except it still doesn't work properly either. So how exactly does the behaviour of my simple example differ from what you want? The widget fills the allocated space and the image scales, keeping the aspect ratio. Yeti ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Invisible GtkImage
On Sun, 2013-06-23 at 11:51 +0200, David Nečas wrote: So how exactly does the behaviour of my simple example differ from what you want? The widget fills the allocated space and the image scales, keeping the aspect ratio. When the parent window is resized, I'd like the image to scale to fill the allocated space as much as possible, maintaining the aspect ratio. My code draws the image correctly, but it doesn't resize as the parent window is resized: http://pastebin.com/6LEzFk8A -- Kip Warner -- Software Engineer OpenPGP encrypted/signed mail preferred http://www.thevertigo.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Invisible GtkImage
On Sun, 2013-06-23 at 00:53 +0200, Colomban Wendling wrote: 2) you say it doesn't expand: check your packing flags. You have: page.pack_start(page._bannerAspectFrame, False, False, 0) the 2 False mean don't expand and don't fill the available space. Change this to True, True and you'll be happy. Hey Colomban. I actually already tried that. If I set the second parameter to True, it does expand to fill the available space, but the other widgets below it in the next row below in the vbox are pushed down to the bottom half of the box's available space so that there is a huge wasted space between the banner image and the bottom half. -- Kip Warner -- Software Engineer OpenPGP encrypted/signed mail preferred http://www.thevertigo.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Invisible GtkImage
On Sun, Jun 23, 2013 at 11:05:00AM -0700, Kip Warner wrote: When the parent window is resized, I'd like the image to scale to fill the allocated space as much as possible, maintaining the aspect ratio. My code draws the image correctly, but it doesn't resize as the parent window is resized: http://pastebin.com/6LEzFk8A Well, as it has already been suggested, this is a matter of packing. If you request that the widget does not expand page.pack_start(page._bannerAspectFrame, False, False, 0) then the containing box will not expand the widget when it is enlarged itself. You have to pass expand=True, fill=True. Yeti ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Invisible GtkImage
On Sun, 2013-06-23 at 20:11 +0200, David Nečas wrote: Well, as it has already been suggested, this is a matter of packing. If you request that the widget does not expand page.pack_start(page._bannerAspectFrame, False, False, 0) then the containing box will not expand the widget when it is enlarged itself. You have to pass expand=True, fill=True. Hey David. Like I said to Colomban already, I already tried that. https://mail.gnome.org/archives/gtk-app-devel-list/2013-June/msg00134.html -- Kip Warner -- Software Engineer OpenPGP encrypted/signed mail preferred http://www.thevertigo.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Invisible GtkImage
On Sunday 23 June 2013 20:05:00 Kip Warner wrote: On Sun, 2013-06-23 at 11:51 +0200, David Nečas wrote: So how exactly does the behaviour of my simple example differ from what you want? The widget fills the allocated space and the image scales, keeping the aspect ratio. When the parent window is resized, I'd like the image to scale to fill the allocated space as much as possible, maintaining the aspect ratio. My code draws the image correctly, but it doesn't resize as the parent window is resized: http://pastebin.com/6LEzFk8A Hi, maybe adding a callback to a window signal and redraw the image could be an option? take a look at http://zetcode.com/tutorials/gtktutorial/gtkevents/ gtk_widget_add_events(GTK_WIDGET(window), GDK_CONFIGURE); The event mask of the widget determines, what kind of event will a particular widget receive. Some event are preconfigured, other events have to be added to the event mask. The gtk_widget_add_events() adds a GDK_CONFIGURE event type to the mask. The GDK_CONFIGURE event type accounts for all size, position and stack order events. g_signal_connect(G_OBJECT(window), configure-event, G_CALLBACK(your_callback), NULL); Just an idea. Ciao, ZZ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Invisible GtkImage
On Sun, Jun 23, 2013 at 11:17 AM, Kip Warner k...@thevertigo.com wrote: On Sun, 2013-06-23 at 20:11 +0200, David Nečas wrote: Well, as it has already been suggested, this is a matter of packing. If you request that the widget does not expand page.pack_start(page._bannerAspectFrame, False, False, 0) then the containing box will not expand the widget when it is enlarged itself. You have to pass expand=True, fill=True. Hey David. Like I said to Colomban already, I already tried that. For a vertically orientated GtkBox, the 'expand' field in pack_start is going to be vertical expansion, so you are not going to want that. Instead set the GtkBox.set_hexpand(true) (and GtkBox.set_halign(GTK_ALIGN_FILL)), but definitely do pack children with Fill=True. Make sure both the GtkAspectFrame and the GtkDrawingArea are set to both set_halign(GTK_ALIGN_FILL) and set_valign(GTK_ALIGN_FILL). That means the aspect frame will receive the extra width, and its internal ratio keeping will make its implementation of get_requested_height_for_width() request enough height for your image to expand properly. Its all a problem of packing with expand fill at this point. Just think about how you want the toolkit to work and make sure each component in the hierarchy is doing the right thing. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Invisible GtkImage
For a vertically orientated GtkBox, the 'expand' field in pack_start is going to be vertical expansion, so you are not going to want that. Instead set the GtkBox.set_hexpand(true) (and GtkBox.set_halign(GTK_ALIGN_FILL)), but definitely do pack children with Fill=True. Make sure both the GtkAspectFrame and the GtkDrawingArea are set to both set_halign(GTK_ALIGN_FILL) and set_valign(GTK_ALIGN_FILL). That means the aspect frame will receive the extra width, and its internal ratio keeping will make its implementation of get_requested_height_for_width() request enough height for your image to expand properly. Its all a problem of packing with expand fill at this point. Just think about how you want the toolkit to work and make sure each component in the hierarchy is doing the right thing. Hey Andrew. Thanks for the help. I've almost got it working after I took your advise, but the image is still taking up too much room in the vertical GtkBox above and below it. See all the extra space above and below it I'd like collapsed: http://en.zimagez.com/zimage/box36.php Here is my code: http://pastebin.com/mtVNsPrb Thanks a lot, -- Kip Warner -- Software Engineer OpenPGP encrypted/signed mail preferred http://www.thevertigo.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list