Re: The Right Way To Resize Images?
- From: Mike Benham <moxie thoughtcrime org>
- To: <gtk-app-devel-list gnome org>
- Subject: Re: The Right Way To Resize Images?
- Date: Mon, 20 May 2002 18:14:28 -0700 (PDT)
For the benefit of the mail archive, I'm going to answer my own questions.
On Sun, 19 May 2002, Mike Benham wrote:
I'm displaying GtkImages in a GtkScrolledWindow, but sometimes I want to
resize an image so that it fits in the viewable area of the
GtkScrolledWindow. I can resize images fine using GdkPixbuf routines, but
I can't figure out what the viewable area of a GtkScrolledWindow is. In
fact, I can't determine the size of any widgets except GtkWindow (which
GtkScrolledWindow doesn't inherit from).
In the case of GtkScrolledWindow, the methods
gtk_scrolled_window_get_hadjustment() and
gtk_scrolled_window_get_vadjustment() will return GtkAdjustment structures
that contain information about the state of the the horizontal and
vertical scrollbars. Those structures contain an elment called page_size,
which is the size of the viewable area that the scrollbars control.
So:
gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(window))->page_size
will return the viewable width and
gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window))->page_size
will return the viewable height.
It seems like get_size() should be a base method on GtkWidget? Am
I missing something?
It still seems like this should be true.
Also, I can't seem to force a GtkTreeView repaint. If I update a
GtkListStore, the GtkTreeView/GtkTreeViewColumn doesn't seem to notice
until it normally repaints (like when it receives a mouseover event, etc).
Turns out I was modifying the model from an external thread without using
the gdk global mutex primitives. Once I started treating model updates as
a critical region, the view updated instantly.
- Mike
--
http://www.thoughtcrime.org
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]