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


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