Cocoa: Fix #40395: TCocoaWidgetSet.PtInRegion() implemented

This commit is contained in:
rich2014 2023-07-27 22:12:47 +08:00
parent 285d0248e2
commit 2a6fa122d1
2 changed files with 29 additions and 0 deletions

View File

@ -2047,6 +2047,34 @@ begin
end;
end;
{------------------------------------------------------------------------------
Method: PtInRegion
Params: RNG - Handle to region
X, Y - Point
Returns: If the specified point lies in the region
------------------------------------------------------------------------------}
function TCocoaWidgetSet.PtInRegion(RGN: HRGN; X, Y: Integer): Boolean;
begin
Result := False;
{$IFDEF VerboseWinAPI}
DebugLn('TCocoaWidgetSet.PtInRegion RGN: ' + DbgS(RGN), ' X: ', DbgS(X),
' Y: ', DbgS(Y));
{$ENDIF}
if not (TObject(RGN) is TCocoaRegion) then
begin
DebugLn('TCocoaWidgetSet.PtInRegion Error - invalid region ', DbgS(RGN), '!');
Exit;
end;
Result := TCocoaRegion(RGN).ContainsPoint(Classes.Point(X, Y));
{$IFDEF VerboseWinAPI}
DebugLn('TCocoaRegion.PtInRegion Result: ' + DbgS(Result));
{$ENDIF}
end;
function TCocoaWidgetSet.Rectangle(DC: HDC; X1, Y1, X2, Y2: Integer): Boolean;
var
ctx: TCocoaContext;

View File

@ -148,6 +148,7 @@ function PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer; Filled, Continuous
function Polygon(DC: HDC; Points: PPoint; NumPts: Integer; Winding: boolean): boolean; override;
function Polyline(DC: HDC; Points: PPoint; NumPts: Integer): boolean; override;
function PostMessage(Handle: HWND; Msg: Cardinal; wParam: WParam; lParam: LParam): Boolean; override;
function PtInRegion(RGN: HRGN; X, Y: Integer): Boolean; override;
function Rectangle(DC: HDC; X1, Y1, X2, Y2: Integer): Boolean; override;
function RectVisible(dc : hdc; const ARect: TRect) : Boolean; override;