RE: [gtk-list] Dimensioning a scrolled window





> -----Original Message-----
> From: andy@lysaker.kvaerner.no [mailto:andy@lysaker.kvaerner.no]
> Sent: Tuesday, August 31, 1999 10:12 AM
> To: gtk-list@redhat.com
> Subject: [gtk-list] Dimensioning a scrolled window
> 
> 
> Hi folks,
> 
> I'm packing a GdkDrawingArea into a GdkScrolledWindow using
> 
> gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrollbox),
> 				      drawarea);
> 
> The scrollbar policy is GTK_POLICY_ALWAYS for both horizontal
> and vertical scrollbars. I know how big the drawing area is,
> and I want to set the size of the scrolled window to show the
> entire drawing area. However, the scrollbars take up a part of
> the scrolled window's size. How do I know how big the scrollbars
> are, so I can add that amount onto the the gtk_widget_set_usize()
> request? Is the only way to construct the scrolled window manually
> from individual scrollbars etc?
> 
> -Andy

Hi,

The other way is something like DIA does. Take a look at create_display_shell in the file interface.c (gnome cvs: http://cvs.gnome.org/lxr/source/dia/app/interface.c, line 122). It uses a table and fills it with a GtkDrawingArea and two scroll bars. The callback funcion (ddisplay_canvas_events) is added to the drawing areas event signal. http://cvs.gnome.org/lxr/source/dia/app/disp_callbacks.c, line 176 shows you how that is handled.

The advantage of DIA's way of drawing is that the drawing area will never be larger than strictly necessary (the part that is drawn on the screen).

Think about it ;)

Arjan



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