Re: expose_event



Paul Davis wrote:
>>I need to write an expose_event which clears a widget (GtkLayout) from
>>things I've drawn on it.
>>
>>The way I do it at the moment is: gdk_draw_rectangle() (complete region)
>>Unfortunately this also 'overwrites' too much (GtkFrames inside the
>>GTkLayout disappear etc.)
>>
>>Any idea how to redraw without disturbing the other widgets ?

I use gtklayout to do something a bit like this (hope I've not 
misunderstood):

http://www.vips.ecs.soton.ac.uk/vips-7.7/snap.jpg

(the window in the top left ... you can drag the frames about, and stack 
them on top of each other etc.)

Each of the frames is inside a gtkeventbox. This makes the stacking 
sort-of work, since X will then do the overlaps and clipping for 
exposes. You could probably do the same thing to get your exposes to 
clip against children, although I've never tried drawing on the background.

There are a couple of problems with this: there's quite a lot of 
flickering, since gtk (1.2 anyway) can't distinguish between a move and 
a resize. You'll find that every time you gtk_layout_move() something it 
will repaint even when it doesn't need to. Plus it will probably break 
horribly if I ever get around to building with the win32 backend.

> Perhaps you'd be better off explaining what you're trying to do. BTW,
> I spent a year or two using a GtkLayout for the kind of thing you
> sound as if you might be trying to do. When I eventually used the
> Canvas, I realized I had made a serious error not starting out with
> it.

Paul's probably right.

John



========================================================== 
Coming Soon: 

Madame de Pompadour 
Images of a Mistress 

16 October 2002 - 12 January 2003 

For information and tickets: 
http://www.nationalgallery.org.uk/exhibitions/



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