Qt: added winapi function PtInRegion(), added containsPoint(), containsRect() to TQtRegion.

git-svn-id: trunk@17357 -
This commit is contained in:
zeljko 2008-11-12 16:18:14 +00:00
parent dad49bfaff
commit ee19b1a320
3 changed files with 28 additions and 0 deletions

View File

@ -248,6 +248,8 @@ type
constructor Create(CreateHandle: Boolean; Poly: QPolygonH;
Const Fill: QtFillRule = QtWindingFill); virtual; overload;
destructor Destroy; override;
function containsPoint(X,Y: Integer): Boolean;
function containsRect(R: TRect): Boolean;
function GetRegionType: integer;
function getBoundingRect: TRect;
end;
@ -1609,6 +1611,20 @@ begin
inherited Destroy;
end;
function TQtRegion.containsPoint(X, Y: Integer): Boolean;
var
P: TQtPoint;
begin
P.X := X;
P.Y := Y;
Result := QRegion_contains(Widget, PQtPoint(@P));
end;
function TQtRegion.containsRect(R: TRect): Boolean;
begin
Result := QRegion_contains(Widget, PRect(@R));
end;
function TQtRegion.GetRegionType: integer;
var
R: TRect;

View File

@ -3807,6 +3807,17 @@ begin
Result := True;
end;
end;
function TQtWidgetSet.PtInRegion(RGN: HRGN; X, Y: Integer): Boolean;
begin
Result := False;
if not IsValidGDIObject(RGN) then
exit;
Result := TQtRegion(RGN).containsPoint(X, Y);
end;
{------------------------------------------------------------------------------
Function: Rectangle
Params: DC: HDC; X1, Y1, X2, Y2: Integer

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;