Finished implementation of MapWindowPoints (the interface in win32 compatible now)

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@65 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
blikblum
2007-02-19 19:30:20 +00:00
parent e607006dd8
commit aa5df44190
2 changed files with 22 additions and 13 deletions

View File

@ -7466,7 +7466,7 @@ begin
if Visible then
begin
// Create the minimum rectangle to be recaptured.
MapWindowPoints(Tree.Handle, 0, @R.TopLeft, 2);
MapWindowPoints(Tree.Handle, 0, R, 2);
DragRect := GetDragImageRect;
IntersectRect(R, R, DragRect);
@ -7477,7 +7477,7 @@ begin
PaintTarget.Y := R.Top - DragRect.Top;
// The source rectangle is determined by the offsets in the tree.
MapWindowPoints(0, Tree.Handle, @R.TopLeft, 2);
MapWindowPoints(0, Tree.Handle, R, 2);
OffsetRect(R, -Tree.FOffsetX, -Tree.FOffsetY);
// Finally let the tree paint the relevant part and upate the drag image on screen.
@ -11193,7 +11193,7 @@ begin
GetWindowRect(Treeview.Handle, RW);
// Convert to client coordinates.
MapWindowPoints(0, Treeview.Handle, @RW.TopLeft, 2);
MapWindowPoints(0, Treeview.Handle, RW, 2);
// Consider the header within this rectangle.
OffsetRect(R, RW.Left, RW.Top);
@ -11239,7 +11239,7 @@ begin
OffsetRect(R, RW.Left, RW.Top);
// Expressed in client coordinates (because RedrawWindow wants them so, they will actually become negative).
MapWindowPoints(0, Handle, @R.TopLeft, 2);
MapWindowPoints(0, Handle, R, 2);
RedrawWindow(Handle, @R, 0, RDW_FRAME or RDW_INVALIDATE or RDW_VALIDATE or RDW_NOINTERNALPAINT or
RDW_NOERASE or RDW_NOCHILDREN);
end;
@ -19681,7 +19681,7 @@ begin
GetCursorPos(P);
R := ClientRect;
ClipRect := R;
MapWindowPoints(Handle, 0, @R.TopLeft, 2);
MapWindowPoints(Handle, 0, R, 2);
InRect := PtInRect(R, P);
ClientP := ScreenToClient(P);
Panning := [tsWheelPanning, tsWheelScrolling] * FStates <> [];
@ -23604,7 +23604,7 @@ begin
// Calculate the screen area not covered by the drag image and which needs an update.
DragRect := Tree.FDragImage.GetDragImageRect;
MapWindowPoints(0, Handle, @DragRect.TopLeft, 2);
MapWindowPoints(0, Handle, DragRect, 2);
DragRegion := CreateRectRgnIndirect(DragRect);
// Start with non-client area if requested.
@ -23615,7 +23615,7 @@ begin
// Determine the outer rectangle of the entire tree window.
GetWindowRect(Handle, NCRect);
// Express the tree window rectangle in client coordinates (because RedrawWindow wants them so).
MapWindowPoints(0, Handle, @NCRect.TopLeft, 2);
MapWindowPoints(0, Handle, NCRect, 2);
NCRegion := CreateRectRgnIndirect(NCRect);
// Determine client rect in screen coordinates and create another region for it.
UpdateRegion := CreateRectRgnIndirect(ClientRect);

View File

@ -62,23 +62,32 @@ begin
Failed:=Status and HRESULT($80000000)<>0;
end;
function MapWindowPoints(hWndFrom, hWndTo: HWND; lpPoints: PPoint; cPoints: UINT): Integer;
function MapWindowPoints(hWndFrom, hWndTo: HWND; var lpPoints; cPoints: UINT): Integer;
var
I:integer;
I:Integer;
XOffset, YOffset: SmallInt;
FromRect,ToRect: TRect;
begin
Logger.AddCheckPoint(lcDummyFunctions,'MapWiindowsPoints');
//todo: implement result
GetWindowRect(hWndFrom,FromRect);
GetWindowRect(hWndTo,ToRect);
XOffset:=(FromRect.Left - ToRect.Left);
YOffset:=(FromRect.Top - ToRect.Top);
for i:=0 to cPoints - 1 do
begin
(lpPoints+i)^.x:=(FromRect.Left - ToRect.Left) + (lpPoints+i)^.x;
(lpPoints+i)^.y:=(FromRect.Top - ToRect.Top) + (lpPoints+i)^.y;
{
Mode Delphi does not support treating a pointer as a array
if ObjFpc is used than this syntax is preferred
PPoint(@lpPoints)[i].x:= XOffset + PPoint(@lpPoints)[i].x;
PPoint(@lpPoints)[i].y:= YOffset + PPoint(@lpPoints)[i].y;
}
PPoint(@lpPoints+i)^.x:= XOffset + PPoint(@lpPoints+i)^.x;
PPoint(@lpPoints+i)^.y:= YOffset + PPoint(@lpPoints+i)^.y;
end;
Result:=MakeLong(XOffset,YOffset);
end;
function InvalidateRect(aHandle : HWND; ARect : pRect; bErase : Boolean) : Boolean;
begin
Logger.EnterMethod(lcPaint,'InvalidateRect');