LCL: Implement function EqualRgn for Windows and Gtk(2). Issue #23287, patch from Valdinilson Lourenço da Cunha

git-svn-id: trunk@39262 -
This commit is contained in:
juha 2012-11-07 22:56:49 +00:00
parent 2f0ee470cb
commit 32fa5fe6c5
9 changed files with 68 additions and 7 deletions

View File

@ -842,6 +842,11 @@ begin
Result := True;
end;
function TWidgetSet.EqualRgn(Rgn1: HRGN; Rgn2: HRGN): Boolean;
begin
Result := False;
end;
function TWidgetSet.ExcludeClipRect(dc: hdc;
Left, Top, Right, Bottom : Integer) : Integer;
var

View File

@ -221,6 +221,11 @@ begin
Result := WidgetSet.DPtoLP(DC,Points,Count);
end;
function Ellipse(DC: HDC; x1,y1,x2,y2: Integer): Boolean;
begin
Result := WidgetSet.Ellipse(DC,x1,y1,x2,y2);
end;
function EnableScrollBar(Wnd: HWND; wSBflags, wArrows: Cardinal): Boolean;
begin
Result := WidgetSet.EnableScrollBar(Wnd, wSBflags, wArrows);
@ -258,9 +263,9 @@ begin
Result := WidgetSet.EnumFontFamiliesEx(DC, lpLogFont, Callback, LParam, flags);
end;
function Ellipse(DC: HDC; x1,y1,x2,y2: Integer): Boolean;
function EqualRgn(Rgn1: HRGN; Rgn2: HRGN): Boolean;
begin
Result := WidgetSet.Ellipse(DC,x1,y1,x2,y2);
Result := WidgetSet.EqualRgn(Rgn1, Rgn2);
end;
function ExcludeClipRect(dc: hdc; Left, Top, Right, Bottom : Integer) : Integer;

View File

@ -99,6 +99,7 @@ function EnumFontFamiliesEx(DC: HDC; lpLogFont:PLogFont; Callback: FontEnumExPro
function Ellipse(DC: HDC; x1, y1, x2, y2: Integer): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
//function EqualRect --> independent
function EqualRgn(Rgn1: HRGN; Rgn2: HRGN): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function ExcludeClipRect(dc: hdc; Left, Top, Right, Bottom : Integer) : Integer; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function ExtCreatePen(dwPenStyle, dwWidth: DWord; const lplb: TLogBrush; dwStyleCount: DWord; lpStyle: PDWord): HPEN; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}

View File

@ -3761,6 +3761,26 @@ begin
{$ENDIF}
end;
{------------------------------------------------------------------------------
Method: EqualRgn
Params: Rgn1: HRGN; Rgn2: HRGN
Returns: True if the two regions are equal
Checks the two specified regions to determine whether they are identical. The
function considers two regions identical if they are equal in size and shape.
------------------------------------------------------------------------------}
function TGtkWidgetSet.EqualRgn(Rgn1: HRGN; Rgn2: HRGN): Boolean;
var
AGdiObject: PGdiObject absolute Rgn1;
BGdiObject: PGdiObject absolute Rgn2;
begin
Result := IsValidGDIObject(Rgn1) and IsValidGDIObject(Rgn2);
if Result then
Result := gdk_region_equal(AGdiObject^.GDIRegionObject,
BGdiObject^.GDIRegionObject);
end;
{------------------------------------------------------------------------------
Function: ExcludeClipRect
Params: dc: hdc; Left, Top, Right, Bottom : Integer

View File

@ -79,6 +79,7 @@ procedure EnterCriticalSection(var CritSection: TCriticalSection); override;
function EnumDisplayMonitors(hdc: HDC; lprcClip: PRect; lpfnEnum: MonitorEnumProc; dwData: LPARAM): LongBool; override;
function EnumFontFamilies(DC: HDC; Family: Pchar; EnumFontFamProc: FontEnumProc; LParam:Lparam):longint; override;
function EnumFontFamiliesEx(DC: HDC; lpLogFont: PLogFont; Callback: FontEnumExProc; Lparam: LParam; Flags: dword): longint; override;
function EqualRgn(Rgn1: HRGN; Rgn2: HRGN): Boolean; override;
function ExcludeClipRect(dc: hdc; Left, Top, Right, Bottom : Integer) : Integer; override;
function ExtCreatePen(dwPenStyle, dwWidth: DWord; const lplb: TLogBrush; dwStyleCount: DWord; lpStyle: PDWord): HPEN; override;
function ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; override;

View File

@ -3545,7 +3545,6 @@ end;
Returns: Nothing
Use Ellipse to draw a filled circle or ellipse.
------------------------------------------------------------------------------}
function TGtk2WidgetSet.Ellipse(DC: HDC; X1, Y1, X2, Y2: Integer): Boolean;
var
@ -3599,6 +3598,25 @@ begin
{$ENDIF}
end;
{------------------------------------------------------------------------------
Method: EqualRgn
Params: Rgn1: HRGN; Rgn2: HRGN
Returns: True if the two regions are equal
Checks the two specified regions to determine whether they are identical. The
function considers two regions identical if they are equal in size and shape.
------------------------------------------------------------------------------}
function TGtk2WidgetSet.EqualRgn(Rgn1: HRGN; Rgn2: HRGN): Boolean;
var
AGdiObject: PGdiObject absolute Rgn1;
BGdiObject: PGdiObject absolute Rgn2;
begin
Result := IsValidGDIObject(Rgn1) and IsValidGDIObject(Rgn2);
if Result then
Result := gdk_region_equal(AGdiObject^.GDIRegionObject,
BGdiObject^.GDIRegionObject);
end;
{------------------------------------------------------------------------------
Function: ExcludeClipRect
Params: dc: hdc; Left, Top, Right, Bottom : Integer
@ -3613,8 +3631,6 @@ end;
NullRegion
SimpleRegion
ComplexRegion
------------------------------------------------------------------------------}
function TGtk2WidgetSet.ExcludeClipRect(dc: hdc;
Left, Top, Right, Bottom : Integer) : Integer;

View File

@ -92,6 +92,7 @@ function EnumDisplayMonitors({%H-}hdc: HDC; {%H-}lprcClip: PRect; lpfnEnum: Moni
function EnumFontFamilies(DC: HDC; Family: Pchar; EnumFontFamProc: FontEnumProc; LParam:Lparam):longint; override;
{$ENDIF}
function EnumFontFamiliesEx({%H-}DC: HDC; lpLogFont: PLogFont; Callback: FontEnumExProc; Lparam: LParam; {%H-}Flags: dword): longint; override;
function EqualRgn(Rgn1: HRGN; Rgn2: HRGN): Boolean; override;
function ExcludeClipRect(dc: hdc; Left, Top, Right, Bottom : Integer) : Integer; override;
function ExtCreatePen(dwPenStyle, dwWidth: DWord; const lplb: TLogBrush; dwStyleCount: DWord; lpStyle: PDWord): HPEN; override;
function ExtSelectClipRGN(dc: hdc; rgn : hrgn; Mode : Longint) : Integer; override;

View File

@ -1324,6 +1324,19 @@ begin
{$endif}
end;
{------------------------------------------------------------------------------
Method: EqualRgn
Params: Rgn1: HRGN; Rgn2: HRGN
Returns: True if the two regions are equal
Checks the two specified regions to determine whether they are identical. The
function considers two regions identical if they are equal in size and shape.
------------------------------------------------------------------------------}
function TWin32WidgetSet.EqualRgn(Rgn1: HRGN; Rgn2: HRGN): Boolean;
begin
Result := Windows.EqualRgn(Rgn1, Rgn2);
end;
{------------------------------------------------------------------------------
Function: ExcludeClipRect
Params: dc, Left, Top, Right, Bottom
@ -1338,8 +1351,6 @@ end;
NullRegion
SimpleRegion
ComplexRegion
------------------------------------------------------------------------------}
function TWin32WidgetSet.ExcludeClipRect(dc: hdc;
Left, Top, Right, Bottom : Integer) : Integer;

View File

@ -80,6 +80,7 @@ function EndPaint(Handle : hwnd; var PS : TPaintStruct): Integer; override;
function EnumDisplayMonitors(hdc: HDC; lprcClip: PRect; lpfnEnum: MonitorEnumProc; dwData: LPARAM): LongBool; override;
function EnumFontFamilies(DC: HDC; Family:Pchar; EnumFontFamProc: FontEnumProc; LParam:Lparam):longint; override;
function EnumFontFamiliesEx(DC:HDC; lpLogFont:PLogFont; Callback: FontEnumExProc; LParam:Lparam; flags:dword):longint; override;
function EqualRgn(Rgn1: HRGN; Rgn2: HRGN): Boolean; override;
function ExcludeClipRect(dc: hdc; Left, Top, Right, Bottom : Integer) : Integer; override;
function ExtCreatePen(dwPenStyle, dwWidth: DWord; const lplb: TLogBrush; dwStyleCount: DWord; lpStyle: PDWord): HPEN; override;
function ExtTextOut(DC: HDC; X, Y: Integer; Options: LongInt; Rect: PRect; Str: PChar; Count: LongInt; Dx: PInteger): Boolean; override;