LCL-CustomDrawn: Implements GetCliBox, now TGrid starts to appear

git-svn-id: trunk@36544 -
This commit is contained in:
sekelsenmat 2012-04-03 15:48:52 +00:00
parent 258b8b8ad5
commit a8ad7b2373
2 changed files with 26 additions and 43 deletions

View File

@ -2586,7 +2586,7 @@ begin
Result := True; Result := True;
end; end;
(*{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Function: GetClipBox Function: GetClipBox
Params: dc, lprect Params: dc, lprect
Returns: Integer Returns: Integer
@ -2601,62 +2601,45 @@ end;
SimpleRegion SimpleRegion
ComplexRegion ComplexRegion
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TQtWidgetSet.GetClipBox(DC: hDC; lpRect: PRect): Longint; function TCDWidgetSet.GetClipBox(DC: hDC; lpRect: PRect): Longint;
var var
ARegion: QRegionH; LazDC: TLazCanvas;
Pt: TPoint; lClipRegion: TFPCustomRegion;
begin begin
{$ifdef VerboseCDWinAPI}
DebugLn('[WinAPI GetClipBox] DC ' + dbghex(DC));
{$endif}
Result := NULLREGION; Result := NULLREGION;
if lpRect <> nil then if lpRect <> nil then
lpRect^ := Rect(0,0,0,0); lpRect^ := Rect(0,0,0,0);
if DC = 0 then DC := HDC(ScreenDC);
if not IsValidDC(DC) then if not IsValidDC(DC) then
Result := ERROR; Result := ERROR;
if Result <> ERROR then if Result = ERROR then Exit;
with TQtDeviceContext(DC) do
begin
{$ifdef VerboseQtWinAPI}
Writeln('TQtWidgetSet.GetClipBox FastClip=',
((vClipRect <> nil) and not vClipRectDirty) );
{$endif}
// the most correct way to get a clipbox if through LazDC := TLazCanvas(DC);
// region.boundingrect, but it's slower.
// TODO: remove "and false" below when vClipRectDirty is implemented if (lpRect<>nil) then
// it should be "true" when user set a custom clip rect
// and "false" on beginpaint
if (vClipRect<>nil) and not vClipRectDirty and false then
lpRect^ := vClipRect^
else
if getClipping then
begin begin
ARegion := QRegion_Create; lClipRegion := LazDC.ClipRegion;
try if lClipRegion = nil then
QPainter_clipRegion(Widget, ARegion); begin
GetWindowOrgEx(DC, @Pt); Result := NULLREGION;
if (Pt.X <> 0) or (Pt.Y <> 0) then lpRect^ := Bounds(0, 0, LazDC.Width, LazDC.Height);
SetWindowOrgEx(DC, Pt.X, Pt.Y, @Pt);
QRegion_boundingRect(ARegion, lpRect);
finally
QRegion_destroy(ARegion);
end;
Result := SIMPLEREGION;
end end
else else
if vImage <> nil then
begin begin
lpRect^ := Rect(0, 0, vImage.width, vImage.height);
Result := SIMPLEREGION; Result := SIMPLEREGION;
lpRect^ := lClipRegion.GetBoundingRect();
end; end;
{$ifdef VerboseQtWinAPI}
WriteLn('TQtWidgetSet.GetClipBox Rect=', dbgs(lprect^));
{$endif}
end; end;
end; end;
{------------------------------------------------------------------------------ (*{------------------------------------------------------------------------------
Function: GetClipRGN Function: GetClipRGN
Params: dc, rgn Params: dc, rgn
Returns: Integer Returns: Integer

View File

@ -110,8 +110,8 @@ function GetCaretRespondToFocus(handle: HWND; var ShowHideOnFocus: boolean): Boo
function GetClientBounds(handle : HWND; var ARect : TRect) : Boolean; override; function GetClientBounds(handle : HWND; var ARect : TRect) : Boolean; override;
function BackendGetClientBounds(handle : HWND; var ARect : TRect) : Boolean; function BackendGetClientBounds(handle : HWND; var ARect : TRect) : Boolean;
function GetClientRect(handle : HWND; var ARect : TRect) : Boolean; override; function GetClientRect(handle : HWND; var ARect : TRect) : Boolean; override;
(*function GetClipBox(DC : hDC; lpRect : PRect) : Longint; override; function GetClipBox(DC : hDC; lpRect : PRect) : Longint; override;
function GetClipRGN(DC: hDC; RGN: hRGN): Longint; override; (*function GetClipRGN(DC: hDC; RGN: hRGN): Longint; override;
function GetCmdLineParamDescForInterface: string; override; function GetCmdLineParamDescForInterface: string; override;
function GetCurrentObject(DC: HDC; uObjectType: UINT): HGDIOBJ; override;*) function GetCurrentObject(DC: HDC; uObjectType: UINT): HGDIOBJ; override;*)
function GetCursorPos(var lpPoint: TPoint ): Boolean; override; function GetCursorPos(var lpPoint: TPoint ): Boolean; override;