lcl, win32, wince, qt, gtk2, carbon: implement OffsetRGN winapi compatible function

git-svn-id: trunk@29697 -
This commit is contained in:
paul 2011-03-01 07:37:42 +00:00
parent c66163d8f3
commit 7a9b188e2c
14 changed files with 91 additions and 9 deletions

View File

@ -178,7 +178,7 @@ end;
function TWidgetSet.CreatePolygonRgn(Points: PPoint; NumPts: Integer;
FillMode: integer): HRGN;
Begin
begin
Result := 0;
end;
@ -334,7 +334,7 @@ begin
end;
function TWidgetSet.DrawEdge(DC: HDC; var Rect: TRect; edge: Cardinal; grfFlags: Cardinal): Boolean;
Begin
begin
Result := False;
end;
@ -765,7 +765,7 @@ begin
end;
function TWidgetSet.EndPaint(Handle : hwnd; var PS : TPaintStruct): Integer;
Begin
begin
Result:=1;
end;
@ -1297,11 +1297,16 @@ begin
Result := False;
end;
function TWidgetSet.OffsetRgn(RGN: HRGN; nXOffset, nYOffset: Integer): Integer;
begin
Result := Error;
end;
function TWidgetSet.PeekMessage(var lpMsg : TMsg; Handle : HWND;
wMsgFilterMin, wMsgFilterMax,wRemoveMsg : UINT): Boolean;
Begin
begin
Result := False;
End;
end;
function TWidgetSet.Pie(DC: HDC; x1, y1, x2, y2,
sx, sy, ex, ey: Integer): Boolean;
@ -1317,7 +1322,7 @@ function TWidgetSet.PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer;
var
APoints : PPoint;
ACount : Longint;
Begin
begin
APoints := nil;
ACount := 0;
PolyBezier2Polyline(Points,NumPts,APoints,ACount,Continuous);
@ -1402,7 +1407,7 @@ begin
end;
function TWidgetSet.ReleaseCapture : Boolean;
Begin
begin
Result := True;
end;
@ -1596,7 +1601,7 @@ end;
function TWidgetSet.SetProp(Handle: hwnd; Str : PChar;
Data : Pointer) : Boolean;
Begin
begin
Result := True;
end;
@ -1657,7 +1662,7 @@ end;
function TWidgetSet.SetWindowOrgEx(dc : hdc; NewX, NewY : Integer;
OldPoint: PPoint) : Boolean;
Begin
begin
Result := False;
end;

View File

@ -702,6 +702,11 @@ begin
Result := WidgetSet.MoveToEx(DC, X, Y, OldPoint);
end;
function OffsetRgn(RGN: HRGN; nXOffset, nYOffset: Integer): Integer;
begin
Result := WidgetSet.OffsetRgn(RGN, nXOffset, nYOffset);
end;
function PeekMessage(var lpMsg : TMsg; Handle : HWND;
wMsgFilterMin, wMsgFilterMax,wRemoveMsg : UINT): Boolean;
begin

View File

@ -203,6 +203,7 @@ function MonitorFromWindow(hWnd: HWND; dwFlags: DWord): HMONITOR; {$IFDEF IF_BAS
function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
//function OffsetRect --> independent
function OffsetRgn(RGN: HRGN; nXOffset, nYOffset: Integer): Integer; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function PeekMessage(var lpMsg : TMsg; Handle : HWND; wMsgFilterMin, wMsgFilterMax,wRemoveMsg : UINT): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function Pie(DC: HDC; x1, y1, x2, y2, sx, sy, ex, ey: Integer): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}

View File

@ -74,6 +74,7 @@ type
function ContainsPoint(const P: TPoint): Boolean;
procedure SetShape(AShape: HIShapeRef);
function CombineWith(ARegion: TCarbonRegion; CombineMode: Integer): Integer;
procedure Offset(dx, dy: Integer);
public
property Shape: HIShapeRef read FShape write SetShape;
end;
@ -839,6 +840,12 @@ begin
end;
end;
procedure TCarbonRegion.Offset(dx, dy: Integer);
begin
HIShapeOffset(FShape, dx, dy);
end;
{ TCarbonTextLayout }
procedure TCarbonTextLayout.Release;

View File

@ -2554,6 +2554,14 @@ begin
Result := inherited MoveWindowOrgEx(DC, dX, dY);
end;
function TCarbonWidgetSet.OffsetRgn(RGN: HRGN; nXOffset, nYOffset: Integer): Integer;
begin
if not (TObject(RGN) is TCarbonRegion) then
Exit(ERROR);
TCarbonRegion(RGN).Offset(nXOffset, nYOffset);
Result := TCarbonRegion(RGN).GetType;
end;
function TCarbonWidgetSet.PeekMessage(var lpMsg: TMsg; Handle: HWND;
wMsgFilterMin, wMsgFilterMax, wRemoveMsg: UINT): Boolean;
begin

View File

@ -159,6 +159,8 @@ function MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): inte
function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; override;
function MoveWindowOrgEx(DC: HDC; dX, dY: Integer): Boolean; override;
function OffsetRgn(RGN: HRGN; nXOffset, nYOffset: Integer): Integer; override;
function PeekMessage(var lpMsg : TMsg; Handle : HWND; wMsgFilterMin, wMsgFilterMax,wRemoveMsg : UINT): Boolean; override;
function PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer; Filled, Continuous: boolean): boolean; override;
function Polygon(DC: HDC; Points: PPoint; NumPts: Integer; Winding: boolean): boolean; override;

View File

@ -6507,6 +6507,18 @@ begin
end;
end;
function TGtk2WidgetSet.OffsetRgn(RGN: HRGN; nXOffset, nYOffset: Integer): Integer;
var
GdkRGN: PGDKRegion;
begin
if not IsValidGDIObject(RGN) then
Exit(Error);
GdkRGN := PGdiObject(RGN)^.GDIRegionObject;
gdk_region_offset(GdkRGN, nXOffset, nYOffset);
Result := RegionType(GdkRGN);
end;
{------------------------------------------------------------------------------
Function: PeekMessage

View File

@ -171,6 +171,8 @@ function MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): inte
function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; override;
function MoveWindowOrgEx(DC: HDC; dX, dY: Integer): Boolean; override;
function OffsetRgn(RGN: HRGN; nXOffset, nYOffset: Integer): Integer; override;
function PeekMessage(var lpMsg : TMsg; Handle : HWND; wMsgFilterMin, wMsgFilterMax,wRemoveMsg : UINT): Boolean; override;
function PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer; Filled, Continuous: boolean): boolean; override;
function Polygon(DC: HDC; Points: PPoint; NumPts: Integer; Winding: boolean): boolean; override;

View File

@ -4256,6 +4256,30 @@ begin
Result := True;
end;
function TQtWidgetSet.OffsetRgn(RGN: HRGN; nXOffset, nYOffset: Integer): Integer;
var
QtRgn: QRegionH;
begin
Result := ERROR;
if not IsValidGDIObject(RGN) then
Exit
else
QtRgn := TQtRegion(RGN).Widget;
QRegion_translate(QtRgn, nXOffset, nYOffset);
if QRegion_isEmpty(QtRgn) then
Result := NULLREGION
else
begin
if TQtRegion(RGN).IsPolyRegion or (TQtRegion(RGN).numRects > 0) then
Result := COMPLEXREGION
else
Result := SIMPLEREGION;
end;
end;
function TQtWidgetSet.PeekMessage(var lpMsg : TMsg; Handle : HWND; wMsgFilterMin, wMsgFilterMax,wRemoveMsg : UINT): Boolean;
begin
Result := False;

View File

@ -159,6 +159,8 @@ 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;
function OffsetRgn(RGN: HRGN; nXOffset, nYOffset: Integer): Integer; override;
function PeekMessage(var lpMsg : TMsg; Handle : HWND; wMsgFilterMin, wMsgFilterMax,wRemoveMsg : UINT): Boolean; override;
function PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer; Filled, Continuous: boolean): boolean; override;
function Polygon(DC: HDC; Points: PPoint; NumPts: Integer; Winding: boolean): boolean; override;

View File

@ -2560,6 +2560,11 @@ begin
Assert(False, Format('Trace:< [TWin32WidgetSet.MoveToEx] DC:0x%x, X:%d, Y:%d', [DC, X, Y]));
end;
function TWin32WidgetSet.OffsetRgn(RGN: HRGN; nXOffset, nYOffset: Integer): Integer;
begin
Result := Windows.OffsetRgn(RGN, nXOffset, nYOffset);
end;
{------------------------------------------------------------------------------
Method: PeekMessage

View File

@ -160,6 +160,8 @@ function MonitorFromRect(lprcScreenCoords: PRect; dwFlags: DWord): HMONITOR; ove
function MonitorFromWindow(hWnd: HWND; dwFlags: DWord): HMONITOR; override;
function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; override;
function OffsetRgn(RGN: HRGN; nXOffset, nYOffset: Integer): Integer; override;
function PeekMessage(Var LPMsg: TMsg; Handle: HWND; WMsgFilterMin, WMsgFilterMax, WRemoveMsg: UINT): Boolean; override;
function Pie(DC: HDC; EllipseX1,EllipseY1,EllipseX2,EllipseY2,
StartX,StartY,EndX,EndY: Integer): Boolean; override;

View File

@ -2435,6 +2435,11 @@ begin
Assert(False, Format('Trace:< [TWinCEWidgetSet.MoveToEx] DC:0x%x, X:%d, Y:%d', [DC, X, Y]));
end;
function TWinCEWidgetSet.OffsetRgn(RGN: HRGN; nXOffset, nYOffset: Integer): Integer;
begin
Result := Windows.OffsetRgn(RGN, nXOffset, nYOffset);
end;
{function TWinCEWidgetSet.PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer;
Filled, Continuous: boolean): boolean;
begin

View File

@ -171,6 +171,8 @@ function MonitorFromRect(lprcScreenCoords: PRect; dwFlags: DWord): HMONITOR; ove
function MonitorFromWindow(hWnd: HWND; dwFlags: DWord): HMONITOR; override;
function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; override;
function OffsetRgn(RGN: HRGN; nXOffset, nYOffset: Integer): Integer; override;
function PeekMessage(var lpMsg : TMsg; Handle : HWND; wMsgFilterMin, wMsgFilterMax,wRemoveMsg : UINT): Boolean; override;
//function PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer; Filled, Continuous: boolean): boolean; override;
function Polygon(DC: HDC; Points: PPoint; NumPts: Integer; Winding: boolean): boolean; override;