Re: [spam score 10.00/10.0 -pobox] Newbie seeks advice (mixing text, widgets, images on a scrollable canvas)



Pascal Haakmat <a haakmat chello nl> writes: 
I have just one quick question; is it safe to have widgets overlap eachother
in a GtkLayout container? How about in general? 

It is safe to have child widgets overlap their parent. Having widgets
in a layout or fixed overlap is safe, but the stacking order and
redraw results aren't well-defined.

(What I'm thinking is to add
a GtkDrawingArea to the GtkLayout that completely covers the GtkLayout, then
add GtkEntry widgets in the appropriate places).


But don't do this, it defeats the purpose of the layout. The layout is
an infinite scrolling area. Normal widgets can only be a certain size
(32,000 pixels or so). Also, the layout is doing some funky stuff to
ensure smooth scrolling. Adding a drawing area will mangle that.
Draw directly to the layout, as GnomeCanvas does.

You want to: 

 - set the layout size to the full size of the page being browsed

 - go ahead and add all the child widgets at their appropriate
   positions in layout coordinates (relative to the entire page)

 - when you get an expose event, the area of the expose is 
   in the coordinates of the layout->bin_window GdkWindow. 
   Convert these coordinates to full-page coordinates using 
   layout->xoffset and layout->yoffset which are the logical 
   position of the bin_window in full-page coordinates.
   Then draw that region of the full page.  

Havoc




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