TGradButton:

- Added TGradCustomControl
- Added DropDown-SplitButton Support

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1455 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
eugene1
2011-01-23 00:17:36 +00:00
parent d2ef0b3cca
commit bdd5f9aaec
4 changed files with 593 additions and 295 deletions

View File

@ -0,0 +1,71 @@
unit gradcustomcontrol;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Controls, Graphics;
type
{ TGradCustomControl }
TGradCustomControl = class(TCustomControl)
protected
FBuffer: TBitmap;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure ChangeBounds(ALeft, ATop, AWidth, AHeight: integer;
KeepBase: boolean); override;
procedure Paint; override;
procedure PaintTo(ACanvas: TCanvas; X, Y: Integer); overload;
procedure _Paint(ACanvas: TCanvas); virtual; abstract;
end;
implementation
{ TGradCustomControl }
constructor TGradCustomControl.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FBuffer := TBitmap.Create;
end;
destructor TGradCustomControl.Destroy;
begin
FBuffer.Free;
inherited Destroy;
end;
procedure TGradCustomControl.ChangeBounds(ALeft, ATop, AWidth,
AHeight: integer; KeepBase: boolean);
begin
FBuffer.SetSize(AWidth, AHeight);
_Paint(FBuffer.Canvas);
inherited ChangeBounds(ALeft, ATop, AWidth, AHeight, KeepBase);
end;
procedure TGradCustomControl.Paint;
begin
if not HasParent then
Exit;
Canvas.Draw(0,0, FBuffer);
inherited Paint;
end;
procedure TGradCustomControl.PaintTo(ACanvas: TCanvas; X, Y: Integer);
begin
ACanvas.Draw(0,0, FBuffer);
end;
end.