lcl: add LPtoDP - symmetrical to DPtoLP winapi compatibility method

win32: implement LPtoDP, DPtoLP
qt: implement LPtoDP

git-svn-id: trunk@25236 -
This commit is contained in:
paul 2010-05-07 07:08:43 +00:00
parent df5cb0c835
commit 256161bfc7
7 changed files with 57 additions and 3 deletions

View File

@ -1246,6 +1246,11 @@ begin
Result := False;
end;
function TWidgetSet.LPtoDP(DC: HDC; var Points; Count: Integer): BOOL;
begin
Result := False;
end;
function TWidgetSet.MessageBox(hWnd: HWND; lpText, lpCaption: PChar;
uType : Cardinal): integer;
begin

View File

@ -652,6 +652,11 @@ begin
Result := WidgetSet.LineTo(DC, X, Y);
end;
function LPtoDP(DC: HDC; var Points; Count: Integer): BOOL;
begin
Result := WidgetSet.LPtoDP(DC, Points, Count);
end;
function MaskBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc: Integer; Mask: HBITMAP; XMask, YMask: Integer): Boolean;
begin
Result := WidgetSet.MaskBlt(DestDC, X, Y, Width, Height, SrcDC, XSrc, YSrc, Mask, XMask, YMask);

View File

@ -186,6 +186,7 @@ function IsZoomed(handle: HWND): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF
procedure LeaveCriticalSection(var CritSection: TCriticalSection); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function LineTo(DC: HDC; X, Y: Integer): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function LPtoDP(DC: HDC; var Points; Count: Integer): BOOL; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
//function MakeLong --> independent
//function MakeROP4 --> independent

View File

@ -1149,9 +1149,8 @@ begin
Result := False;
if not IsValidDC(DC)
then
exit;
if not IsValidDC(DC) then
Exit;
QtDC := TQtDeviceContext(DC);
@ -3944,6 +3943,37 @@ begin
Result := True;
end;
function TQtWidgetSet.LPtoDP(DC: HDC; var Points; Count: Integer): BOOL;
var
P: PPoint;
QtPoint: TQtPoint;
Matrix: QTransformH;
QtDC: TQtDeviceContext;
Inverted: Boolean;
begin
Result := False;
if not IsValidDC(DC) then
Exit;
QtDC := TQtDeviceContext(DC);
Matrix := QPainter_transform(QtDC.Widget);
P := @Points;
while Count > 0 do
begin
Dec(Count);
QtPoint.X := P^.X;
QtPoint.Y := P^.Y;
QTransform_map(Matrix, PQtPoint(@QtPoint), PQtPoint(@QtPoint));
P^.X := QtPoint.X;
P^.Y := QtPoint.Y;
Inc(P);
end;
Result := True;
end;
function TQtWidgetSet.MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): integer;
var

View File

@ -150,6 +150,7 @@ function IsZoomed(Handle: HWND): boolean; override;
procedure LeaveCriticalSection(var CritSection: TCriticalSection); override;
function LineTo(DC: HDC; X, Y: Integer): Boolean; override;
function LPtoDP(DC: HDC; var Points; Count: Integer): BOOL; override;
function MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): integer; override;
function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; override;

View File

@ -1055,6 +1055,11 @@ begin
Result := Windows.DestroyIcon(Handle);
end;
function TWin32WidgetSet.DPtoLP(DC: HDC; var Points; Count: Integer): BOOL;
begin
Result := Windows.DPtoLP(DC, Points, Count);
end;
{------------------------------------------------------------------------------
Method: DrawFrameControl
Params: DC - handle to device context
@ -2421,6 +2426,11 @@ begin
Assert(False, Format('Trace:< [TWin32WidgetSet.LineTo] DC:0x%x, X:%d, Y:%d', [DC, X, Y]));
end;
function TWin32WidgetSet.LPtoDP(DC: HDC; var Points; Count: Integer): BOOL;
begin
Result := Windows.LPtoDP(DC, Points, Count);
end;
{------------------------------------------------------------------------------
Method: MaskBlt
Params: DestDC - The destination device context

View File

@ -65,6 +65,7 @@ function DeleteObject(GDIObject: HGDIOBJ): Boolean; override;
function DestroyCaret(Handle: HWND): Boolean; override;
function DestroyCursor(Handle: HCURSOR): Boolean; override;
function DestroyIcon(Handle: HICON): Boolean; override;
function DPtoLP(DC: HDC; var Points; Count: Integer): BOOL; override;
function DrawEdge(DC: HDC; var Rect: TRect; Edge: Cardinal; GrfFlags: Cardinal): Boolean; override;
function DrawFrameControl(DC: HDC; const Rect: TRect; UType, UState: Cardinal): Boolean; override;
function DrawFocusRect(DC: HDC; const Rect: TRect): boolean; override;
@ -147,6 +148,7 @@ function IsWindowVisible(handle: HWND): boolean; override;
function IsZoomed(handle: HWND): boolean; override;
function LineTo(DC: HDC; X, Y: Integer): Boolean; override;
function LPtoDP(DC: HDC; var Points; Count: Integer): BOOL; override;
function MaskBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc: Integer; Mask: HBITMAP; XMask, YMask: Integer; Rop: DWORD): Boolean; override;
function MaskBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc: Integer; Mask: HBITMAP; XMask, YMask: Integer): Boolean; override;