reduced speedbutton invalidates, added TCanvas.Frame

git-svn-id: trunk@2701 -
This commit is contained in:
mattias 2002-08-18 04:56:52 +00:00
parent cf4fe82fbb
commit 378eff0913
2 changed files with 89 additions and 27 deletions

View File

@ -538,8 +538,20 @@ type
Procedure CopyRect(const Dest : TRect; Canvas : TCanvas; const Source : TRect);
Procedure Draw(X,Y: Integer; Graphic : TGraphic);
procedure StretchDraw(const Rect: TRect; Graphic: TGraphic);
procedure Ellipse(const ARect: TRect);
procedure Ellipse(x1, y1, x2, y2: Integer);
procedure Ellipse(const Rect: TRect);
Procedure FillRect(const ARect : TRect);
Procedure FillRect(X1,Y1,X2,Y2 : Integer);
procedure FloodFill(X, Y: Integer; FillColor: TColor; FillStyle: TFillStyle);
procedure Frame3d(var Rect : TRect; const FrameWidth : integer;
const Style : TBevelCut);
procedure Frame(const ARect: TRect); // border using pen
procedure Frame(X1,Y1,X2,Y2 : Integer); // border using pen
procedure FrameRect(const ARect: TRect); // border using brush
procedure FrameRect(X1,Y1,X2,Y2 : Integer); // border using brush
Procedure Line(X1,Y1,X2,Y2 : Integer); // short for MoveTo();LineTo();
Procedure LineTo(X1,Y1 : Integer);
Procedure MoveTo(X1,Y1 : Integer);
procedure Pie(x,y,width,height,angle1,angle2 : Integer);
procedure Pie(x,y,width,height,SX,SY,EX,EY : Integer);
procedure PolyBezier(Points: PPoint; NumPts: Integer;
@ -561,17 +573,10 @@ type
NumPts: Integer {$IFDEF VER1_1} = -1{$ENDIF});
procedure Polyline(Points: PPoint; NumPts: Integer);
procedure Polyline(const Points: array of TPoint);
Procedure FillRect(const Rect : TRect);
procedure FloodFill(X, Y: Integer; FillColor: TColor; FillStyle: TFillStyle);
procedure Frame3d(var Rect : TRect; const FrameWidth : integer;
const Style : TBevelCut);
Procedure Rectangle(X1,Y1,X2,Y2 : Integer);
Procedure Rectangle(const Rect: TRect);
Procedure RoundRect(X1, Y1, X2, Y2: Integer; RX,RY : Integer);
Procedure RoundRect(const Rect : TRect; RX,RY : Integer);
Procedure Line(X1,Y1,X2,Y2 : Integer);
Procedure MoveTo(X1,Y1 : Integer);
Procedure LineTo(X1,Y1 : Integer);
procedure TextOut(X,Y: Integer; const Text: String);
procedure TextRect(Rect: TRect; X, Y: integer; const Text : string);
procedure TextRect(Rect: TRect; X, Y: integer; const Text : string;
@ -580,10 +585,9 @@ type
function TextHeight(const Text: string): Integer;
function TextWidth(const Text: string): Integer;
function HandleAllocated: boolean;
public
property ClipRect: TRect read GetCanvasClipRect;
property PenPos: TPoint read GetPenPos write SetPenPos;
property OnChange : TNotifyEvent read FOnChange write FOnChange;
property OnChanging: TNotifyEvent read FOnChanging write FOnChanging;
property Pixels[X, Y: Integer]: TColor read GetPixel write SetPixel;
property Handle: HDC read GetHandle write SetHandle;
property TextStyle : TTextStyle read FTextStyle write FTextStyle;
@ -596,6 +600,8 @@ type
property Pen: TPen read FPen write SetPen;
property Region: TRegion read FRegion write SetRegion;
property Color: TColor read GetColor write SetColor;
property OnChange : TNotifyEvent read FOnChange write FOnChange;
property OnChanging: TNotifyEvent read FOnChanging write FOnChanging;
end;
@ -955,6 +961,9 @@ end.
{ =============================================================================
$Log$
Revision 1.59 2003/01/27 13:49:16 mattias
reduced speedbutton invalidates, added TCanvas.Frame
Revision 1.58 2002/12/28 17:43:43 mattias
fixed FindControl and searching overloaded procs

View File

@ -495,27 +495,35 @@ end;
{------------------------------------------------------------------------------
Method: TCanvas.Ellipse
Params: X1, Y1, X2, Y2
Params: ARect: TRect
Returns: Nothing
Use Ellipse to draw a filled circle or ellipse on the canvas.
------------------------------------------------------------------------------}
procedure TCanvas.Ellipse(const Rect: TRect);
procedure TCanvas.Ellipse(const ARect: TRect);
begin
Ellipse(Rect.Left,Rect.Top,Rect.Right,Rect.Bottom);
Ellipse(ARect.Left,ARect.Top,ARect.Right,ARect.Bottom);
end;
{------------------------------------------------------------------------------
Method: TCanvas.FillRect
Params: Rect
Params: ARect
Returns: Nothing
------------------------------------------------------------------------------}
procedure TCanvas.FillRect(const Rect : TRect);
procedure TCanvas.FillRect(const ARect : TRect);
begin
RequiredState([csHandleValid, csBrushValid]);
LCLLinux.FillRect(FHandle, Rect, Brush.Handle);
LCLLinux.FillRect(FHandle, ARect, Brush.Handle);
end;
{------------------------------------------------------------------------------
procedure TCanvas.FillRect(X1,Y1,X2,Y2 : Integer);
------------------------------------------------------------------------------}
procedure TCanvas.FillRect(X1,Y1,X2,Y2 : Integer);
begin
FillRect(Rect(X1,Y1,X2,Y2));
end;
{------------------------------------------------------------------------------
@ -543,6 +551,48 @@ begin
LCLLinux.Frame3d(FHandle, Rect, FrameWidth, Style);
end;
{------------------------------------------------------------------------------
procedure TCanvas.Frame(const ARect: TRect);
Drawing the border of a rectangle with the current pen
------------------------------------------------------------------------------}
procedure TCanvas.Frame(const ARect: TRect);
begin
RequiredState([csHandleValid, csPenValid]);
LCLLinux.Frame(FHandle, ARect);
end;
{------------------------------------------------------------------------------
procedure TCanvas.Frame(const ARect: TRect);
Drawing the border of a rectangle with the current pen
------------------------------------------------------------------------------}
procedure TCanvas.Frame(X1, Y1, X2, Y2: Integer);
begin
Frame(Rect(X1, Y1, X2, Y2));
end;
{------------------------------------------------------------------------------
procedure TCanvas.FrameRect(const ARect: TRect);
Drawing the border of a rectangle with the current brush
------------------------------------------------------------------------------}
procedure TCanvas.FrameRect(const ARect: TRect);
begin
RequiredState([csHandleValid, csBrushValid]);
LCLLinux.FrameRect(FHandle, ARect, Brush.GetHandle);
end;
{------------------------------------------------------------------------------
procedure TCanvas.FrameRect(const ARect: TRect);
Drawing the border of a rectangle with the current brush
------------------------------------------------------------------------------}
procedure TCanvas.FrameRect(X1, Y1, X2, Y2: Integer);
begin
FrameRect(Rect(X1, Y1, X2, Y2));
end;
{------------------------------------------------------------------------------
Method: TCanvas.Rectangle
Params: X1,Y1,X2,Y2
@ -602,18 +652,18 @@ end;
{------------------------------------------------------------------------------
Method: TCanvas.TextRect
Params: Rect, X, Y, Text, Style
Params: ARect, X, Y, Text, Style
Returns: Nothing
------------------------------------------------------------------------------}
procedure TCanvas.TextRect(Rect: TRect; X, Y : Integer; const Text : String;
procedure TCanvas.TextRect(ARect: TRect; X, Y : Integer; const Text : String;
const Style : TTextStyle);
var
Options : Longint;
fRect : TRect;
begin
Rect.Left := Rect.Left + X;
Rect.Top := Rect.Top + Y;
ARect.Left := ARect.Left + X;
ARect.Top := ARect.Top + Y;
Options := 0;
case Style.Alignment of
taRightJustify : Options := DT_RIGHT;
@ -643,15 +693,16 @@ begin
else
RequiredState([csHandleValid, csFontValid]);
fRect := Rect;
DrawText(Self.Handle, pChar(Text), Length(Text), fRect, DT_CALCRECT or Options);
fRect := ARect;
DrawText(Self.Handle,pChar(Text),Length(Text),fRect, DT_CALCRECT or Options);
case Style.Alignment of
taRightJustify : OffsetRect(fRect, Rect.Right - fRect.Right, 0);
taCenter : OffsetRect(fRect, (Rect.Right - fRect.Right) div 2, 0);
taRightJustify : OffsetRect(fRect, ARect.Right - fRect.Right, 0);
taCenter : OffsetRect(fRect, (ARect.Right - fRect.Right) div 2, 0);
end;
case Style.Layout of
tlCenter : OffsetRect(fRect, 0, (Rect.Bottom - Rect.Top) div 2 - (fRect.Bottom - fRect.Top) div 2);
tlBottom : OffsetRect(fRect, 0, Rect.Bottom - fRect.Bottom);
tlCenter : OffsetRect(fRect, 0, (ARect.Bottom - ARect.Top) div 2
- (fRect.Bottom - fRect.Top) div 2);
tlBottom : OffsetRect(fRect, 0, ARect.Bottom - fRect.Bottom);
end;
If Style.Opaque then begin
RequiredState([csHandleValid, csBrushValid]);
@ -725,7 +776,6 @@ end;
------------------------------------------------------------------------------}
procedure TCanvas.Line(X1,Y1,X2,Y2 : Integer);
begin
//?? Additional function ??
MoveTo(X1, Y1);
LineTo(X2, Y2);
end;
@ -1097,6 +1147,9 @@ end;
{ =============================================================================
$Log$
Revision 1.37 2003/01/27 13:49:16 mattias
reduced speedbutton invalidates, added TCanvas.Frame
Revision 1.36 2002/12/01 22:00:34 mattias
fixed DeleteCriticalSection