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

@ -4,51 +4,63 @@
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Name Value="gradcontrols"/> <Name Value="gradcontrols"/>
<CompilerOptions> <CompilerOptions>
<Version Value="8"/> <Version Value="9"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="src\;..\"/> <IncludeFiles Value="src"/>
<OtherUnitFiles Value="src\;..\"/> <OtherUnitFiles Value="src"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<Other> <Other>
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>
</Other> </Other>
</CompilerOptions> </CompilerOptions>
<Files Count="3"> <Files Count="4">
<Item1> <Item1>
<Filename Value="src\ugradtabcontrol.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="ugradtabcontrol"/>
</Item1>
<Item2>
<Filename Value="src\ugradbtn.pas"/> <Filename Value="src\ugradbtn.pas"/>
<HasRegisterProc Value="True"/> <HasRegisterProc Value="True"/>
<UnitName Value="ugradbtn"/> <UnitName Value="ugradbtn"/>
</Item1>
<Item2>
<Filename Value="src\ugradtabcontrol.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="ugradtabcontrol"/>
</Item2> </Item2>
<Item3> <Item3>
<Filename Value="src\urotatebitmap.pas"/> <Filename Value="src\urotatebitmap.pas"/>
<UnitName Value="uRotateBitmap"/> <UnitName Value="uRotateBitmap"/>
</Item3> </Item3>
<Item4>
<Filename Value="src\gradcustomcontrol.pas"/>
<UnitName Value="gradcustomcontrol"/>
</Item4>
</Files> </Files>
<Type Value="RunAndDesignTime"/> <Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="3"> <RequiredPkgs Count="4">
<Item1> <Item1>
<PackageName Value="IDEIntf"/> <PackageName Value="multiloglaz"/>
</Item1> </Item1>
<Item2> <Item2>
<PackageName Value="LCl"/> <PackageName Value="IDEIntf"/>
</Item2> </Item2>
<Item3> <Item3>
<PackageName Value="LCl"/>
</Item3>
<Item4>
<PackageName Value="FCL"/> <PackageName Value="FCL"/>
<MinVersion Major="1" Valid="True"/> <MinVersion Major="1" Valid="True"/>
</Item3> </Item4>
</RequiredPkgs> </RequiredPkgs>
<UsageOptions> <UsageOptions>
<IncludePath Value="$(PkgOutDir)\;$(PkgOutDir)\..\"/> <IncludePath Value="$(PkgOutDir);$(PkgOutDir)\.."/>
<LibraryPath Value="$(PkgOutDir)\;$(PkgOutDir)\..\"/> <LibraryPath Value="$(PkgOutDir);$(PkgOutDir)\.."/>
<ObjectPath Value="$(PkgOutDir)\;$(PkgOutDir)\..\"/> <ObjectPath Value="$(PkgOutDir);$(PkgOutDir)\.."/>
<UnitPath Value="$(PkgOutDir)\;$(PkgOutDir)\..\"/> <UnitPath Value="$(PkgOutDir);$(PkgOutDir)\.."/>
</UsageOptions> </UsageOptions>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>

View File

@ -1,4 +1,4 @@
{ This file was automatically created by Lazarus. do not edit ! { This file was automatically created by Lazarus. Do not edit!
This source is only used to compile and install the package. This source is only used to compile and install the package.
} }
@ -7,14 +7,15 @@ unit gradcontrols;
interface interface
uses uses
ugradtabcontrol, ugradbtn, uRotateBitmap, LazarusPackageIntf; ugradbtn, ugradtabcontrol, uRotateBitmap, gradcustomcontrol,
LazarusPackageIntf;
implementation implementation
procedure Register; procedure Register;
begin begin
RegisterUnit('ugradtabcontrol', @ugradtabcontrol.Register);
RegisterUnit('ugradbtn', @ugradbtn.Register); RegisterUnit('ugradbtn', @ugradbtn.Register);
RegisterUnit('ugradtabcontrol', @ugradtabcontrol.Register);
end; end;
initialization initialization

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.

File diff suppressed because it is too large Load Diff