Hi,
I've been looking into this change and there is a slight problem:)
EndPaint (windows function) needs to have passed a structure that contains the
same painting information that was retrieved from BeginPaint (windows
function). Somehow this information needs to be stored between the calls.
In the Perl world, you would do something like:
$win->BeginPaint;
#do painting here
$win->EndPaint;
Which means that the pointer returned from BeginPaint (or the contents of the
pointer) need to be stored somewhere. The current approach is to create a hash
and associate it with the window. The ideal way would be to associate the
pointer to the window - not the data.
Or perhaps an alternative approach might be more suitable? Something like:
$win->BeginPaint( \&Paint);
sub Paint {
my ($DC,$x,$y,$x1,$y1)[EMAIL PROTECTED];
#do painting
}
Where BeginPaint, is passed a reference to a sub, BeginPaint then calls windows
BeginPaint, the sub ref is called, passed all the parameters, then finally
calls EndPaint? But, then why not define the Paint event directly (ie,
-onPaint)?
Thoughts?
Cheers,
jez.
----- Original Message -----
From: Jez White
To: guihackers
Sent: Friday, May 14, 2004 3:22 PM
Subject: [perl-win32-gui-hackers] GUI.xs (BeginPaint and EndPaint)
Hi,
Would any one have any objections if I change (fix depending on your
viewpoint:) ) the BeginPaint and EndPaint functions in GUI.xs?
I think these functions are left over from previous versions (along with the
other painting/drawing functions in GUI.xs). They are currently not used by any
other internal functions, nor are they documented anywhere. The general usage
would stay the same, but I plan to return the details as an array
(dc,x,y,x1,x2,flag) rather than messing with the object itself. I think this
would be cleaner, faster and more like other xs functions.
In general usage these functions would be used in conjunction with a Hooked
WS_PAINT message, allowing the users program to handle the painting of window
directly. A good example, would be the bitmap scrolling example ask for by
Glenn Linderman, instead of painting the bitmap into a image control, it could
be painted direct into the windows DC (I'll try and put together an example
this weekend).
Comments?
Cheers,
jez.