On Sat, Jun 8, 2013 at 10:27 PM, Kip Warner <k...@thevertigo.com> wrote:
> The banner image should automatically resize as the window is resized. > It should use the full width available in the parent page (GtkBox), but > the image's height should be calculated as a function of the aspect > ratio to keep it from being distorted. > I don't want the scrollbars to ever appear and the full image to always > be visible. Any help appreciated. > One approach is ditching the ScrolledWindow and overriding the get_preferred_width_for_height/width() vfuncs to return the full image width, and then in size_allocate() set the image to a scaled pixbuf of the allocated width. This involves making a subclass which is a little bit of work if you've never done it before (especially in straight C). The only example I have on hand [1] is in Gtkmm and does quite a bit more than you need (Animated image support, toggling between thumbnail and full size). But overriding these functions should be enough: size_allocate() get_preferred_height() get_preferred_width_for_height() get_preferred_width() get_preferred_height_for_width() [1] https://github.com/talisein/Horizon/blob/master/src/horizon_image.cpp _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list