MG: moved RectVisible, ExcludeClipRect and IntersectClipRect to interface dependent functions

git-svn-id: trunk@1755 -
This commit is contained in:
lazarus 2002-06-21 15:41:57 +00:00
parent 1d603e185c
commit b48f7ec110
4 changed files with 193 additions and 192 deletions

View File

@ -189,6 +189,11 @@ begin
Result := InterfaceObject.Ellipse(DC,x1,y1,x2,y2); Result := InterfaceObject.Ellipse(DC,x1,y1,x2,y2);
end; end;
function ExcludeClipRect(dc: hdc; Left, Top, Right, Bottom : Integer) : Integer;
begin
Result := InterfaceObject.ExcludeClipRect(DC,Left,Top,Right,Bottom);
end;
function ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; function ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean;
begin begin
Result := InterfaceObject.ExtTextOut(DC, X, Y, Options, Rect, Str, Count, Dx); Result := InterfaceObject.ExtTextOut(DC, X, Y, Options, Rect, Str, Count, Dx);
@ -365,6 +370,27 @@ begin
Result := InterfaceObject.HideCaret(hWnd); Result := InterfaceObject.HideCaret(hWnd);
end; end;
{------------------------------------------------------------------------------
Function: IntersectClipRect
Params: dc: hdc; Left, Top, Right, Bottom: Integer
Returns: Integer
Shrinks the current clipping region in the device context dc to the boundary
defined by Left, Top, Right, Bottom.
The result can be one of the following constants
Error
NullRegion
SimpleRegion
ComplexRegion
Region_Error
------------------------------------------------------------------------------}
function IntersectClipRect(dc: hdc; Left, Top, Right, Bottom: Integer): Integer;
Begin
Result := InterfaceObject.IntersectClipRect(dc,Left,Top,Right,Bottom);
end;
Function InvalidateRect(aHandle : HWND; Rect : pRect; bErase : Boolean) : Boolean; Function InvalidateRect(aHandle : HWND; Rect : pRect; bErase : Boolean) : Boolean;
begin begin
Result := InterfaceObject.InvalidateRect(aHandle, Rect, bErase); Result := InterfaceObject.InvalidateRect(aHandle, Rect, bErase);
@ -431,6 +457,11 @@ begin
Result := InterfaceObject.Rectangle(DC, X1, Y1, X2, Y2); Result := InterfaceObject.Rectangle(DC, X1, Y1, X2, Y2);
end; end;
function RectVisible(dc : hdc; ARect: TRect) : Boolean;
begin
Result := InterfaceObject.RectVisible(dc,ARect);
end;
function ReleaseCapture: Boolean; function ReleaseCapture: Boolean;
begin begin
Result := InterfaceObject.ReleaseCapture; Result := InterfaceObject.ReleaseCapture;
@ -602,18 +633,13 @@ end;
Returns: Returns:
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function AdjustWindowRectEx( Var Rect: TRect; Style1: Word; MenuExist : Boolean; Style2 : Word) : Boolean; function AdjustWindowRectEx( Var Rect: TRect; Style1: Word; MenuExist : Boolean;
Style2 : Word) : Boolean;
begin begin
// ToDo:
Result := true; Result := true;
try if MenuExist
if MenuExist then Rect.Top := Rect.Top + 25;
then Rect.Top := Rect.Top + 25;
except
on E: Exception do begin
writeln('AdjustWindowRectEx: ',E.Message);
Result := False;
end;
end;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -655,9 +681,9 @@ end;
Returns: Returns:
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function CopyRect(var lprcDst: TRect; const lprcSrc: TRect): Boolean; function CopyRect(var DestRect: TRect; const SrcRect: TRect): Boolean;
begin begin
Move(lprcSrc, lprcDst, SizeOf(TRect)); Move(SrcRect, DestRect, SizeOf(TRect));
Result := True; Result := True;
end; end;
@ -716,16 +742,6 @@ begin
end; end;
{------------------------------------------------------------------------------
Function: ExcludeClipRect
Params:
-------------------------------------------------------------------------------}
Function ExcludeClipRect(dc: hdc; LEft,Top, Right, Bottom : Integer) : Integer;
begin
//TODO: Finish ExcludeClipRect
Result := SimpleRegion;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Function: EndPaint Function: EndPaint
Params: Params:
@ -785,106 +801,65 @@ end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Function: InflateRect Function: InflateRect
Params: Rect: points to structure that increases or decreases in size. Params: ARect: points to structure that increases or decreases in size.
dx : amount to increase or decrease the rectangle width. dx : amount to increase the rectangle width.
dy : amount to increase or decrease the rectangle height. dy : amount to increase the rectangle height.
Returns: True if succesful Returns: True if succesful
Increases or decreases the width and height of the specified rectangle. Increases or decreases the width and height of the specified rectangle.
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function InflateRect(var Rect: TRect; dx, dy: Integer): Boolean; function InflateRect(var ARect: TRect; dx, dy: Integer): Boolean;
begin begin
with Rect do // make sure, that after deflating holds: Left<=Right
begin if (dx<0) and (ARect.Right-ARect.Left+2*dx<0) then begin
Dec(Left, dx); ARect.Left:=(ARect.Left+ARect.Right) shr 1;
Inc(Right, dx); ARect.Right:=ARect.Left;
Dec(Top, dy); end else begin
Inc(Bottom, dy); dec(ARect.Left,dx);
inc(ARect.Right,dx);
end; end;
// make sure, that after deflating holds: Top<=Bottom
if (dy<0) and (ARect.Bottom-ARect.Top+2*dy<0) then begin
ARect.Top:=(ARect.Top+ARect.Bottom) shr 1;
ARect.Bottom:=ARect.Top;
end else begin
dec(ARect.Top,dy);
inc(ARect.Bottom,dy);
end;
Result := True; Result := True;
end; end;
{------------------------------------------------------------------------------
Function: IntersectClipRect
Params:
Returns:
------------------------------------------------------------------------------}
function IntersectClipRect(dc: hdc; Leftrect, Toprect, RightREct,Bottomrect : Integer): Integer;
Begin
//TODO: FInish me IntersectClipRect in winapi.inc
result := Error;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Function: IntersectRect Function: IntersectRect
Params: Params: var DestRect: TRect; const SrcRect1, SrcRect2: TRect
Returns: Returns: Boolean
Intersects SrcRect1 and SrcRect2 into DestRect.
Intersecting means that DestRect will be the overlapping area of lprcSrc1 and
lprcSrc2. If SrcRect1 and SrcRect2 does not overlapp the Result is false, else
true.
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function IntersectRect(var lprcDst: TRect; const lprcSrc1, lprcSrc2: TRect): Boolean; function IntersectRect(var DestRect: TRect;
var const SrcRect1, SrcRect2: TRect): Boolean;
URect: TRect;
h1,h2,v1,v2: Integer;
begin begin
Result := False; Result := False;
// Sanity Checks // test if rectangles intersects
if IsRectEmpty(lprcSrc1) or IsRectEmpty(lprcSrc1) then Result:=(SrcRect2.Left >= SrcRect1.Right)
begin or (SrcRect2.Right <= SrcRect1.Left)
SetRectEmpty(lprcDst); or (SrcRect2.Top >= SrcRect1.Bottom)
Exit; or (SrcRect2.Bottom <= SrcRect1.Top);
if Result then begin
DestRect.Left:=Max(SrcRect1.Left,SrcRect2.Left);
DestRect.Top:=Max(SrcRect1.Top,SrcRect2.Top);
DestRect.Right:=Min(SrcRect1.Right,SrcRect2.Right);
DestRect.Bottom:=Min(SrcRect1.Bottom,SrcRect2.Bottom);
end else begin
SetRectEmpty(DestRect);
end; end;
// next test for no intersection at all.
with lprcSrc2 do
if ((Left > lprcSrc1.Left ) and (Left >= lprcSrc1.Right ))
or ((Right <= lprcSrc1.Left) and (Right < lprcSrc1.Right ))
or ((Top > lprcSrc1.Top ) and (Top >= lprcSrc1.Bottom ))
or ((Bottom <= lprcSrc1.Top) and (Bottom < lprcSrc1.Bottom))
then begin
SetRectEmpty(lprcDst);
Exit;
end;
// we got this far, ok intersecting rects
UnionRect(URect, lprcSrc1, lprcSrc2);
with URect do
begin
if lprcSrc1.Top = lprcSrc2.Top
then h1 := Top
else if lprcSrc1.Top = Top
then h1 := lprcSrc2.Top
else h1 := lprcSrc1.Top;
if lprcSrc2.Bottom = lprcSrc1.Bottom
then h2 := Bottom
else if lprcSrc2.Bottom = Bottom
then h2 := lprcSrc1.Bottom
else h2 := lprcSrc2.Bottom;
if lprcSrc1.Left = lprcSrc2.Left
then v1 := Left
else if lprcSrc1.Left = Left
then v1 := lprcSrc2.Left
else v1 := lprcSrc1.Left;
if lprcSrc2.Right = lprcSrc1.Right
then v2 := Right
else if lprcSrc2.Right = Right
then v2 := lprcSrc1.Right
else v2 := lprcSrc2.Right;
end;
with lprcDst do
begin
Left := Min(v1, v2);
Right := Max(v1, v2);
Top := Min(h1, h2);
Bottom := Max(h1, h2);
end;
Result := True;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -902,13 +877,14 @@ end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Function: IsRectEmpty Function: IsRectEmpty
Params: Params: const lprc: TRect
Returns: Returns: Boolean
Returns true if ARect is (0,0,0,0)
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function IsRectEmpty(const lprc: TRect): Boolean; function IsRectEmpty(const ARect: TRect): Boolean;
begin begin
with lprc do with ARect do
Result := (Left = 0) and (Top = 0) and (Right = 0) and (Bottom = 0); Result := (Left = 0) and (Top = 0) and (Right = 0) and (Bottom = 0);
end; end;
@ -1001,15 +977,6 @@ Begin
); );
end; end;
{------------------------------------------------------------------------------
Function: RectVisible
-------------------------------------------------------------------------------}
Function RectVisible(dc : hdc; Rect: TRect) : Boolean;
Begin
//TODO: Finish me! RectVisible in winapi.inc
result := True;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Function: ScrollWindow In progress pbd Function: ScrollWindow In progress pbd
Params: Handle Params: Handle
@ -1020,7 +987,8 @@ end;
scrolls a window or portion of a window scrolls a window or portion of a window
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function ScrollWindow(hWnd: HWND; XAmount, YAmount: Integer; Rect, ClipRect: PRect): Boolean; function ScrollWindow(hWnd: HWND; XAmount, YAmount: Integer;
Rect, ClipRect: PRect): Boolean;
begin begin
Result := ScrollWindowEx(hWnd, XAmount, YAmount, Rect, ClipRect, 0, 0, 0); Result := ScrollWindowEx(hWnd, XAmount, YAmount, Rect, ClipRect, 0, 0, 0);
end; end;
@ -1030,33 +998,27 @@ end;
Params: Params:
Returns: Returns:
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
Function SetRect(var Rect : TRect; xLeft,yTop,xRight,yBottom : Integer) : Boolean; Function SetRect(var ARect : TRect; xLeft,yTop,xRight,yBottom : Integer) : Boolean;
Begin Begin
Result := True; Result := True;
try with ARect do begin
with Rect do Left := xLeft;
begin Top := yTop;
Left := xLeft; Right := xRight;
Top := yTop; Bottom := yBottom;
Right := xRight; end;
Bottom := yBottom;
end;
except
on E: Exception do begin
writeln('AdjustWindowRectEx: ',E.Message);
Result := False;
end;
End;
End; End;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Function: SetRectEmpty Function: SetRectEmpty
Params: Rect to clear Params: Rect to clear
Returns: essentially nothing Returns: essentially nothing
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function SetRectEmpty(var lprc: TRect): Boolean; function SetRectEmpty(var ARect: TRect): Boolean;
begin begin
FillChar(lprc, SizeOf(TRect), 0); FillChar(ARect, SizeOf(TRect), 0);
Result := True; Result := True;
end; end;
@ -1111,31 +1073,29 @@ end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Function: UnionRect pbd Function: UnionRect pbd
Params: lprcDst: TRect Result INTENT OUT Params: var DestRect: TRect; const SrcRect1, SrcRect2: TRect
lprcSrc1, lprcSrc2 TRects to Union INTENT IN
Returns: Boolean 0 on failure Returns: Boolean 0 on failure
Creates the union rectangle of SrcRect1 and SrcRect2 into DestRect.
The union rectangle encloses SrcRect1 and SrcRect2.
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function UnionRect(var lprcDst: TRect; const lprcSrc1, lprcSrc2: TRect): Boolean; function UnionRect(var DestRect: TRect;
const SrcRect1, SrcRect2: TRect): Boolean;
begin begin
Result := True; Result := True;
try DestRect.Left := Min(SrcRect1.Left, SrcRect2.Left);
lprcDst.Left := Min(lprcSrc1.Left, lprcSrc2.Left); DestRect.Top := Min(SrcRect1.Top, SrcRect2.Top);
lprcDst.Top := Min(lprcSrc1.Top, lprcSrc2.Top); DestRect.Right := Max(SrcRect1.Right, SrcRect2.Right);
lprcDst.Right := Max(lprcSrc1.Right, lprcSrc2.Right); DestRect.Bottom := Max(SrcRect1.Bottom, SrcRect2.Bottom);
lprcDst.Bottom := Max(lprcSrc1.Bottom, lprcSrc2.Bottom);
except
on E: Exception do begin
writeln('AdjustWindowRectEx: ',E.Message);
Result := False;
end;
end;
end; end;
//##apiwiz##epi## // Do not remove //##apiwiz##epi## // Do not remove
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.33 2002/06/21 15:41:56 lazarus
MG: moved RectVisible, ExcludeClipRect and IntersectClipRect to interface dependent functions
Revision 1.32 2002/06/04 15:17:22 lazarus Revision 1.32 2002/06/04 15:17:22 lazarus
MG: improved TFont for XLFD font names MG: improved TFont for XLFD font names

View File

@ -78,6 +78,7 @@ function EnableScrollBar(Wnd: HWND; wSBflags, wArrows: Cardinal): Boolean; {$IFD
function EnableWindow(hWnd: HWND; bEnable: Boolean): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} function EnableWindow(hWnd: HWND; bEnable: Boolean): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function Ellipse(DC: HDC; x1, y1, x2, y2: Integer): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} function Ellipse(DC: HDC; x1, y1, x2, y2: Integer): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
//function EqualRect --> independent //function EqualRect --> independent
Function ExcludeClipRect(dc: hdc; Left, Top, Right, Bottom : Integer) : Integer; {$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} function ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function FillRect(DC: HDC; const Rect: TRect; Brush: HBRUSH): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} function FillRect(DC: HDC; const Rect: TRect; Brush: HBRUSH): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
@ -116,6 +117,7 @@ function GetWindowOrgEx(dc : hdc; var P : TPoint): Integer; {$IFDEF IF_BASE_MEMB
function HideCaret(hWnd: HWND): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} function HideCaret(hWnd: HWND): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
//function InflateRect --> independent //function InflateRect --> independent
function IntersectClipRect(dc: hdc; Left, Top, Right,Bottom: Integer): Integer; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
//function IntersectRect --> independent //function IntersectRect --> independent
Function InvalidateRect(aHandle : HWND; Rect : pRect; bErase : Boolean) : Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} Function InvalidateRect(aHandle : HWND; Rect : pRect; bErase : Boolean) : Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
//function IsCharAlphaNumeric --> independent //function IsCharAlphaNumeric --> independent
@ -140,6 +142,7 @@ function PostMessage(hWnd: HWND; Msg: Cardinal; wParam: LongInt; lParam: LongInt
function RealizePalette(DC: HDC): Cardinal; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} function RealizePalette(DC: HDC): Cardinal; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function Rectangle(DC: HDC; X1, Y1, X2, Y2: Integer): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} function Rectangle(DC: HDC; X1, Y1, X2, Y2: Integer): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function RectVisible(dc : hdc; ARect: TRect) : Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function ReleaseCapture : Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} function ReleaseCapture : Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function ReleaseDC(hWnd: HWND; DC: HDC): Integer; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} function ReleaseDC(hWnd: HWND; DC: HDC): Integer; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function RestoreDC(DC: HDC; SavedDC: Integer): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} function RestoreDC(DC: HDC; SavedDC: Integer): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
@ -216,29 +219,28 @@ type
//##apiwiz##spi## // Do not remove //##apiwiz##spi## // Do not remove
function AdjustWindowRectEx( Var Rect: TRect; Style1: Word; MenuExist : Boolean; Style2 : Word) : Boolean; function AdjustWindowRectEx(Var Rect: TRect; Style1: Word; MenuExist : Boolean;
Style2 : Word) : Boolean;
Function BeginPaint(Handle : hwnd; var PS : TPaintStruct): hdc; Function BeginPaint(Handle : hwnd; var PS : TPaintStruct): hdc;
Function CharLowerBuff(pStr : PChar; Len : Integer): Integer; Function CharLowerBuff(pStr : PChar; Len : Integer): Integer;
function CopyRect(var lprcDst: TRect; const lprcSrc: TRect): Boolean; function CopyRect(var DestRect: TRect; const SrcRect: TRect): Boolean;
function CreateFont(Height, Width, Escapement, Orientation, Weight: Integer; function CreateFont(Height, Width, Escapement, Orientation, Weight: Integer;
Italic, Underline, StrikeOut, CharSet, OutputPrecision, ClipPrecision, Italic, Underline, StrikeOut, CharSet, OutputPrecision, ClipPrecision,
Quality, PitchAndFamily: Cardinal; FaceName: PChar): HFONT; Quality, PitchAndFamily: Cardinal; FaceName: PChar): HFONT;
function CreatePen(Style, Width: Integer; Color: TColorRef): HPEN; function CreatePen(Style, Width: Integer; Color: TColorRef): HPEN;
Function EndPaint(Handle : hwnd; var PS : TPaintStruct): Integer; Function EndPaint(Handle : hwnd; var PS : TPaintStruct): Integer;
Function ExcludeClipRect(dc: hdc; LEft,Top, Right, Bottom : Integer) : Integer;
function EqualRect(const lprc1, lprc2: TRect): Boolean; function EqualRect(const lprc1, lprc2: TRect): Boolean;
function GetScrollPos(Handle: HWND; nBar: Integer): Integer; function GetScrollPos(Handle: HWND; nBar: Integer): Integer;
function GetScrollRange(Handle: HWND; nBar: Integer; var lpMinPos, lpMaxPos: Integer): Boolean; function GetScrollRange(Handle: HWND; nBar: Integer; var lpMinPos, lpMaxPos: Integer): Boolean;
function InflateRect(var Rect: TRect; dx, dy: Integer): Boolean; function InflateRect(var ARect: TRect; dx, dy: Integer): Boolean;
function IntersectClipRect(dc: hdc; Leftrect, Toprect, RightREct,Bottomrect : Integer): Integer; function IntersectRect(var DestRect: TRect; const SrcRect1, SrcRect2: TRect): Boolean;
function IntersectRect(var lprcDst: TRect; const lprcSrc1, lprcSrc2: TRect): Boolean;
Function IsCharAlphaNumeric(c : Char) : Boolean; Function IsCharAlphaNumeric(c : Char) : Boolean;
function IsRectEmpty(const lprc: TRect): Boolean; function IsRectEmpty(const ARect: TRect): Boolean;
function OffSetRect(var Rect: TRect; dx,dy: Integer): Boolean; function OffSetRect(var Rect: TRect; dx,dy: Integer): Boolean;
@ -249,16 +251,14 @@ function MakeLResult(l, h: Word): LRESULT;
Function PtInRect(Rect : TRect; Point : TPoint) : Boolean; Function PtInRect(Rect : TRect; Point : TPoint) : Boolean;
Function PointtoSmallPoint(const P : TPoint) : TSmallPoint; Function PointtoSmallPoint(const P : TPoint) : TSmallPoint;
function RectVisible(dc : hdc; Rect: TRect) : Boolean;
function ScrollWindow(hWnd: HWND; XAmount, YAmount: Integer; Rect, ClipRect: PRect): Boolean; function ScrollWindow(hWnd: HWND; XAmount, YAmount: Integer; Rect, ClipRect: PRect): Boolean;
function SetRect(Var Rect : TRect; xLeft,yTop,xRight,yBottom : Integer) : Boolean; function SetRect(Var ARect : TRect; xLeft,yTop,xRight,yBottom : Integer) : Boolean;
function SetRectEmpty(var lprc: TRect): Boolean; function SetRectEmpty(var ARect: TRect): Boolean;
function SetScrollPos(Handle: HWND; nBar, nPos: Integer; bRedraw: Boolean): Integer; function SetScrollPos(Handle: HWND; nBar, nPos: Integer; bRedraw: Boolean): Integer;
function SetScrollRange(Handle: HWND; nBar, nMinPos, nMaxPos: Integer; bRedraw: Boolean): Boolean; function SetScrollRange(Handle: HWND; nBar, nMinPos, nMaxPos: Integer; bRedraw: Boolean): Boolean;
Function SmallPointtoPoint(const P : TSmallPoint) : Tpoint; Function SmallPointToPoint(const P : TSmallPoint) : Tpoint;
function UnionRect(var lprcDst: TRect; const lprcSrc1, lprcSrc2: TRect): Boolean; //pbd function UnionRect(var DestRect: TRect; const SrcRect1, SrcRect2: TRect): Boolean; //pbd
//##apiwiz##epi## // Do not remove //##apiwiz##epi## // Do not remove
@ -269,6 +269,9 @@ function UnionRect(var lprcDst: TRect; const lprcSrc1, lprcSrc2: TRect): Boolean
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.28 2002/06/21 15:41:56 lazarus
MG: moved RectVisible, ExcludeClipRect and IntersectClipRect to interface dependent functions
Revision 1.27 2002/06/04 15:17:22 lazarus Revision 1.27 2002/06/04 15:17:22 lazarus
MG: improved TFont for XLFD font names MG: improved TFont for XLFD font names

View File

@ -1907,6 +1907,20 @@ begin
end; end;
end; end;
{------------------------------------------------------------------------------
Function: ExcludeClipRect
Params: dc: hdc; Left, Top, Right, Bottom : Integer
Returns: integer
------------------------------------------------------------------------------}
function TgtkObject.ExcludeClipRect(dc: hdc;
Left, Top, Right, Bottom : Integer) : Integer;
begin
// ToDo:
Result:=SimpleRegion;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Function: ExtTextOut Function: ExtTextOut
Params: none Params: none
@ -3159,6 +3173,29 @@ begin
end; end;
{------------------------------------------------------------------------------
Function: IntersectClipRect
Params: dc: hdc; Left, Top, Right, Bottom: Integer
Returns: Integer
Shrinks the current clipping region in the device context dc to the boundary
defined by Left, Top, Right, Bottom.
The result can be one of the following constants
Error
NullRegion
SimpleRegion
ComplexRegion
Region_Error
------------------------------------------------------------------------------}
function TGTKObject.IntersectClipRect(dc: hdc;
Left, Top, Right, Bottom: Integer): Integer;
begin
// ToDo:
Result:=SimpleRegion;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Function: InvalidateRect Function: InvalidateRect
Params: aHandle: Params: aHandle:
@ -3171,41 +3208,23 @@ function TGTKObject.InvalidateRect(aHandle : HWND; Rect : pRect;
bErase : Boolean) : Boolean; bErase : Boolean) : Boolean;
var var
gdkRect : TGDKRectangle; gdkRect : TGDKRectangle;
{$IFDEF ClientRectBugFix}
Widget: PGtkWidget; Widget: PGtkWidget;
{$ENDIF}
begin begin
// Writeln(format('Rect = %d,%d,%d,%d',[rect^.left,rect^.top,rect^.Right,rect^.Bottom])); // Writeln(format('Rect = %d,%d,%d,%d',[rect^.left,rect^.top,rect^.Right,rect^.Bottom]));
Result := True; Result := True;
try gdkRect.X := Rect^.Left;
gdkRect.X := Rect^.Left; gdkRect.Y := Rect^.Top;
gdkRect.Y := Rect^.Top; gdkRect.Width := (Rect^.Right - Rect^.Left);
gdkRect.Width := (Rect^.Right - Rect^.Left); gdkRect.Height := (Rect^.Bottom - Rect^.Top);
gdkRect.Height := (Rect^.Bottom - Rect^.Top);
Widget:=GetFixedWidget(PGtkWidget(aHandle));
{$IFDEF ClientRectBugFix} if Widget=nil then Widget:=PgtkWidget(aHandle);
Widget:=GetFixedWidget(PGtkWidget(aHandle));
if Widget=nil then Widget:=PgtkWidget(aHandle);
if bErase then if bErase then
gdk_window_clear_area(Widget^.Window, gdk_window_clear_area(Widget^.Window,
gdkRect.X,gdkRect.Y,gdkRect.Width,gdkRect.Height); gdkRect.X,gdkRect.Y,gdkRect.Width,gdkRect.Height);
gtk_widget_draw(Widget, @gdkRect);
{$ELSE}
if bErase then
gdk_window_clear_area(PGtkWidget(aHandle)^.Window,
gdkRect.X,gdkRect.Y,gdkRect.Width,gdkRect.Height);
gtk_widget_draw(PGtkWidget(aHandle), @gdkRect);
{$ENDIF}
except
on E: Exception do begin
writeln('TGTKObject.InvalidateRect: ',E.Message);
Result := False;
end;
end;
gtk_widget_draw(Widget, @gdkRect);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -3683,6 +3702,16 @@ begin
Assert(False, Format('trace:< [TgtkObject.Rectangle] DC:0x%x, X1:%d, Y1:%d, X2:%d, Y2:%d', [DC, X1, Y1, X2, Y2])); Assert(False, Format('trace:< [TgtkObject.Rectangle] DC:0x%x, X1:%d, Y1:%d, X2:%d, Y2:%d', [DC, X1, Y1, X2, Y2]));
end; end;
{------------------------------------------------------------------------------
Function: RectVisible
Params: dc : hdc; ARect: TRect
Returns: True if ARect is not completely clipped away.
------------------------------------------------------------------------------}
function TgtkObject.RectVisible(dc : hdc; ARect: TRect) : Boolean;
begin
Result:=true;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Function: ReleaseCapture Function: ReleaseCapture
Params: none Params: none
@ -4781,6 +4810,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.80 2002/06/21 15:41:56 lazarus
MG: moved RectVisible, ExcludeClipRect and IntersectClipRect to interface dependent functions
Revision 1.79 2002/06/19 19:46:10 lazarus Revision 1.79 2002/06/19 19:46:10 lazarus
MG: Form Editing: snapping, guidelines, modified on move/resize, creating components in csDesigning, ... MG: Form Editing: snapping, guidelines, modified on move/resize, creating components in csDesigning, ...

View File

@ -62,6 +62,7 @@ function EnableMenuItem(hMenu: HMENU; uIDEnableItem: Integer; bEnable: Boolean):
function EnableScrollBar(Wnd: HWND; wSBflags, wArrows: Cardinal): Boolean; override; function EnableScrollBar(Wnd: HWND; wSBflags, wArrows: Cardinal): Boolean; override;
function EnableWindow(hWnd: HWND; bEnable: Boolean): Boolean; override; function EnableWindow(hWnd: HWND; bEnable: Boolean): Boolean; override;
function Ellipse(DC: HDC; x1,y1,x2,y2: Integer): Boolean; override; function Ellipse(DC: HDC; x1,y1,x2,y2: Integer): Boolean; override;
Function ExcludeClipRect(dc: hdc; Left, Top, Right, Bottom : Integer) : Integer; override;
function ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; override; function ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; override;
function FillRect(DC: HDC; const Rect: TRect; Brush: HBRUSH): Boolean; override; function FillRect(DC: HDC; const Rect: TRect; Brush: HBRUSH): Boolean; override;
@ -95,6 +96,7 @@ Function GetWindowSize(Handle : hwnd; var Width, Height: integer): boolean; over
function HideCaret(hWnd: HWND): Boolean; override; function HideCaret(hWnd: HWND): Boolean; override;
function IntersectClipRect(dc: hdc; Left, Top, Right, Bottom: Integer): Integer; override;
function InvalidateRect(aHandle : HWND; Rect : pRect; bErase : Boolean) : Boolean; override; function InvalidateRect(aHandle : HWND; Rect : pRect; bErase : Boolean) : Boolean; override;
function KillTimer (hWnd : HWND; uIDEvent : cardinal) : boolean; override; function KillTimer (hWnd : HWND; uIDEvent : cardinal) : boolean; override;
@ -113,6 +115,7 @@ function PostMessage(hWnd: HWND; Msg: Cardinal; wParam: LongInt; lParam: LongInt
function RealizePalette(DC: HDC): Cardinal; override; function RealizePalette(DC: HDC): Cardinal; override;
function Rectangle(DC: HDC; X1, Y1, X2, Y2: Integer): Boolean; override; function Rectangle(DC: HDC; X1, Y1, X2, Y2: Integer): Boolean; override;
function RectVisible(dc : hdc; ARect: TRect) : Boolean; override;
Function ReleaseCapture : Boolean; override; Function ReleaseCapture : Boolean; override;
function ReleaseDC(hWnd: HWND; DC: HDC): Integer; override; function ReleaseDC(hWnd: HWND; DC: HDC): Integer; override;
function RestoreDC(DC: HDC; SavedDC: Integer): Boolean; override; function RestoreDC(DC: HDC; SavedDC: Integer): Boolean; override;
@ -154,6 +157,9 @@ Function WindowFromPoint(Point : TPoint) : HWND; override;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.32 2002/06/21 15:41:57 lazarus
MG: moved RectVisible, ExcludeClipRect and IntersectClipRect to interface dependent functions
Revision 1.31 2002/06/04 15:17:26 lazarus Revision 1.31 2002/06/04 15:17:26 lazarus
MG: improved TFont for XLFD font names MG: improved TFont for XLFD font names