GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Apr 16, 2014 4:25 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Problem with gtkimage in glade
PostPosted: Sun Jun 02, 2013 10:08 pm 
Offline

Joined: Sun Jun 02, 2013 1:59 pm
Posts: 1
Hello i'm working on a projet and in the project i used images but how can i make the window size because it automaticly fits the image size i want that the windows size determines the final size not the image
thank's and sorry for my english :)


Top
 Profile  
 
 Post subject: Re: Problem with gtkimage in glade
PostPosted: Sat Aug 10, 2013 7:53 pm 
Offline
Familiar Face

Joined: Tue Aug 06, 2013 1:09 pm
Posts: 6
Don't set an image at first. Instead, add an empty GtkImage.

Connect to the widget's "size-allocate" signal, and in the handler function you connect, load the image as a GdkPixbuf then scale it using gdk_pixbuf_scale_simple() to the size given by the allocation received by the widget. Then use gtk_image_new_from_pixbuf() to set the GtkImage's image to the scaled pixbuf.

This may cause your program to receive another "size-allocate", so your handler function should first test whether the image is empty using gtk_image_get_storage_type() and use that as an interlock. Don't keep setting the image on each receipt of this signal after the first attempt.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group