Scrolledwindow, layout and drawing area
- From: "fzamperini tiscali it" <fzamperini tiscali it>
- To: gtk-app-devel-list gnome org
- Subject: Scrolledwindow, layout and drawing area
- Date: Fri, 7 Sep 2007 09:43:06 +0200 (CEST)
Hi,
I have to draw a picture inside a top level window that has many
other widgets (like side panes, menu bar etc.); I need zooming and
panning features, so I went for a scrolled window => layout =>
drawingarea.
To achieve zooming I handle the scroll event by scaling the original
size pixbuf and copying it to an off screen pixbuf that is copied on
the drawingarea in the expose_event handler. I want the minimum zoom
value to fit the picture in the scrolled window, and the maximum to be
the actual picture size (let's suppose that the actual picture size is
always greater than the scrolled window viewport).
I read the documentation but I miss something about the GtkLayout;
these are the steps that I'm taking when zooming:
- nothing to do with the scrolledwindow
- layout: I resize it (gtk_layout_set_size()) to the _scaled_ picture
size (remember, always greater or equal to the "viewport")
- drawingarea: I resize it to fit the layout
(gtk_widget_set_size_request()), that is to the scaled picture size.
I took these steps because I think that the layout should hold the
whole scaled picture, and its scrolling features make it move around
behind the top level window; the only visible part, though, will be
that corresponding to the scrolledwindow rectangle.
When I do this in my application I cannot make the drawing area to fit
the layout (it works only the first time I do that), so I see the
picture zooming just in the portion of the viewport that corresponds to
the starting drawingarea rectangle.
Does anyone knows if something is wrong with this approach?
Thank you for any help
Federico Zamperini
____________________________________________________________
Naviga e telefona senza limiti con Tiscali
Scopri le promozioni Tiscali Adsl: navighi e telefoni senza canone Telecom
http://abbonati.tiscali.it/adsl/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]