* Rename TNetGradient to TCustomNetGradient and create a new class TNetGradient with the published properties

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1074 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
blikblum
2009-12-22 21:22:35 +00:00
parent c6b64473fe
commit d963aba0f0

View File

@@ -56,12 +56,12 @@ type
TMargin = 0..MaxInt; TMargin = 0..MaxInt;
TNetGradient = class; TCustomNetGradient = class;
TSubCaption = class(TPersistent) TSubCaption = class(TPersistent)
private private
{ Private-Deklarationen } { Private-Deklarationen }
Parent: TNetGradient; Parent: TCustomNetGradient;
FCaption: TCaption; FCaption: TCaption;
FFont: TFont; FFont: TFont;
FHotTrack: Boolean; FHotTrack: Boolean;
@@ -78,7 +78,7 @@ type
procedure SetVisible(Value: Boolean); virtual; procedure SetVisible(Value: Boolean); virtual;
public public
{ Public declarations } { Public declarations }
constructor Create(AOwner: TNetGradient); overload; constructor Create(AOwner: TCustomNetGradient); overload;
destructor Destroy; override; destructor Destroy; override;
published published
{ Published-Deklarationen } { Published-Deklarationen }
@@ -92,7 +92,7 @@ type
{ TNetGradient } { TNetGradient }
TNetGradient = class(TCustomControl) TCustomNetGradient = class(TCustomControl)
private private
//*** Enzo *** Bordi //*** Enzo *** Bordi
FBevelInner: TLabelBevel; FBevelInner: TLabelBevel;
@@ -160,12 +160,6 @@ type
procedure SetBevelOuter(Value: TLabelBevel); procedure SetBevelOuter(Value: TLabelBevel);
// procedure DataChange(Sender:TObject); // procedure DataChange(Sender:TObject);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure BeginUpdate;
procedure EndUpdate;
published
property CaptionAlignment: TAlignment read FAlignment write SetAlignment; property CaptionAlignment: TAlignment read FAlignment write SetAlignment;
property CaptionLayout: TTextLayout read FLayout write SetLayout default tlCenter; property CaptionLayout: TTextLayout read FLayout write SetLayout default tlCenter;
@@ -173,8 +167,7 @@ type
property BevelOuter: TLabelBevel read FBevelOuter write SetBevelOuter default bvRaised; property BevelOuter: TLabelBevel read FBevelOuter write SetBevelOuter default bvRaised;
{ Starting color of fill } { Starting color of fill }
property BeginColor: TColor read FBeginColor write SetBeginColor property BeginColor: TColor read FBeginColor write SetBeginColor default clBlue;
default clBlue;
{ Ending color of fill } { Ending color of fill }
property EndColor: TColor read FEndColor write SetEndColor default clBlack; property EndColor: TColor read FEndColor write SetEndColor default clBlack;
{ Direction of fill } { Direction of fill }
@@ -188,6 +181,38 @@ type
property Caption: String read FCaption write SetCaption; property Caption: String read FCaption write SetCaption;
property TextTop: Integer read FTextTop write SetTextTop; property TextTop: Integer read FTextTop write SetTextTop;
property TextLeft: Integer read FTextLeft write SetTextLeft; property TextLeft: Integer read FTextLeft write SetTextLeft;
property SubCapField: Boolean read FSubCapField write SetSubCapField default false;
property DataField: String Read GetDataField write SetDataField;
property DataSource: TDataSource read GetDataSource write SetDataSource;
property SubCaption: TSubCaption read FSubCaption;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure BeginUpdate;
procedure EndUpdate;
end;
TNetGradient = class (TCustomNetGradient)
published
property CaptionAlignment;
property CaptionLayout;
property BevelInner;
property BevelOuter;
property BeginColor;
property EndColor;
property FillDirection;
property NumberOfColors;
property Font;
property Caption;
property TextTop;
property TextLeft;
property SubCapField;
property DataField;
property DataSource;
property SubCaption;
//default properties
property Align; property Align;
property BorderSpacing; property BorderSpacing;
property DragCursor; property DragCursor;
@@ -205,22 +230,14 @@ type
property OnMouseDown; property OnMouseDown;
property OnMouseMove; property OnMouseMove;
property OnMouseUp; property OnMouseUp;
//*** Enzo ***
property SubCapField: Boolean read FSubCapField write SetSubCapField default false;
property DataField: String Read GetDataField write SetDataField;
property DataSource: TDataSource read GetDataSource write SetDataSource;
property SubCaption: TSubCaption read FSubCaption;
end; end;
implementation implementation
{ TNetGradient } { TCustomNetGradient }
{ Override the constructor to initialize variables } { Override the constructor to initialize variables }
constructor TNetGradient.Create(AOwner: TComponent); constructor TCustomNetGradient.Create(AOwner: TComponent);
begin begin
{ Inherit original constructor } { Inherit original constructor }
inherited Create(AOwner); inherited Create(AOwner);
@@ -258,7 +275,7 @@ begin
*) *)
end; end;
destructor TNetGradient.Destroy; destructor TCustomNetGradient.Destroy;
begin begin
FSubCaption.Destroy; FSubCaption.Destroy;
FFont.Destroy; FFont.Destroy;
@@ -267,7 +284,7 @@ begin
end; end;
{ Set begin color when property is changed } { Set begin color when property is changed }
procedure TNetGradient.SetBeginColor(Value: TColor); procedure TCustomNetGradient.SetBeginColor(Value: TColor);
begin begin
if Value <> FBeginColor then if Value <> FBeginColor then
begin begin
@@ -277,7 +294,7 @@ begin
end; end;
{ Set end color when property is changed } { Set end color when property is changed }
procedure TNetGradient.SetEndColor(Value: TColor); procedure TCustomNetGradient.SetEndColor(Value: TColor);
begin begin
if Value <> FEndColor then if Value <> FEndColor then
begin begin
@@ -287,7 +304,7 @@ begin
end; end;
{ Set the number of colors to be used in the fill } { Set the number of colors to be used in the fill }
procedure TNetGradient.SetNumberOfColors(Value: TNumberOfColors); procedure TCustomNetGradient.SetNumberOfColors(Value: TNumberOfColors);
begin begin
if Value <> FNumberOfColors then if Value <> FNumberOfColors then
begin begin
@@ -297,7 +314,7 @@ begin
end; end;
// Set the Font // Set the Font
procedure TNetGradient.SetFont(AFont: TFont); procedure TCustomNetGradient.SetFont(AFont: TFont);
begin begin
if AFont <> FFont then if AFont <> FFont then
begin begin
@@ -307,7 +324,7 @@ begin
end; end;
// Set the Caption on NG // Set the Caption on NG
procedure TNetGradient.SetCaption(const Value: String); procedure TCustomNetGradient.SetCaption(const Value: String);
begin begin
if Value <> FCaption then if Value <> FCaption then
begin begin
@@ -317,7 +334,7 @@ begin
end; end;
// Set the Position of the Caption (Top) // Set the Position of the Caption (Top)
procedure TNetGradient.SetTextTop(Value: Integer); procedure TCustomNetGradient.SetTextTop(Value: Integer);
begin begin
if Value <> FTextTop then if Value <> FTextTop then
begin begin
@@ -327,7 +344,7 @@ begin
end; end;
// Set the Position of the Caption (Left) // Set the Position of the Caption (Left)
procedure TNetGradient.SetTextLeft(Value: Integer); procedure TCustomNetGradient.SetTextLeft(Value: Integer);
begin begin
if Value <> FTextLeft then if Value <> FTextLeft then
begin begin
@@ -337,13 +354,13 @@ begin
end; end;
{ Perform the fill when paint is called } { Perform the fill when paint is called }
procedure TNetGradient.Paint; procedure TCustomNetGradient.Paint;
begin begin
GradientFill; GradientFill;
end; end;
{ Gradient fill procedure - the actual routine } { Gradient fill procedure - the actual routine }
procedure TNetGradient.GradientFill; procedure TCustomNetGradient.GradientFill;
var var
{ Set up working variables } { Set up working variables }
BeginRGBValue : array[0..2] of Byte; { Begin RGB values } BeginRGBValue : array[0..2] of Byte; { Begin RGB values }
@@ -587,7 +604,7 @@ begin
end; end;
{ Set the fill direction } { Set the fill direction }
procedure TNetGradient.SetFillDirection(Value: TFillDirection); procedure TCustomNetGradient.SetFillDirection(Value: TFillDirection);
begin begin
if Value <> FDirection then if Value <> FDirection then
begin begin
@@ -598,7 +615,7 @@ end;
//*** Enzo *** //*** Enzo ***
procedure TNetGradient.SetAlignment(Value: TAlignment); procedure TCustomNetGradient.SetAlignment(Value: TAlignment);
begin begin
if FAlignment <> Value then if FAlignment <> Value then
begin begin
@@ -607,7 +624,7 @@ begin
end; end;
end; end;
procedure TNetGradient.SetLayout(Value: TTextLayout); procedure TCustomNetGradient.SetLayout(Value: TTextLayout);
begin begin
if Value <> FLayout then if Value <> FLayout then
begin begin
@@ -616,7 +633,7 @@ begin
end; end;
end; end;
procedure TNetGradient.SetBevelInner(Value: TLabelBevel); procedure TCustomNetGradient.SetBevelInner(Value: TLabelBevel);
begin begin
if Value <> FBevelInner then begin if Value <> FBevelInner then begin
FBevelInner := Value; FBevelInner := Value;
@@ -624,7 +641,7 @@ begin
end; end;
end; end;
procedure TNetGradient.SetBevelOuter(Value: TLabelBevel); procedure TCustomNetGradient.SetBevelOuter(Value: TLabelBevel);
begin begin
if Value <> FBevelOuter then if Value <> FBevelOuter then
begin begin
@@ -635,32 +652,32 @@ end;
//*** Enzo *** //*** Enzo ***
function TNetGradient.GetSubCapField: Boolean; function TCustomNetGradient.GetSubCapField: Boolean;
begin begin
Result := FSubCapField; Result := FSubCapField;
end; end;
procedure TNetGradient.SetSubCapField(Value: Boolean); procedure TCustomNetGradient.SetSubCapField(Value: Boolean);
begin begin
FSubCapField := Value; FSubCapField := Value;
end; end;
function TNetGradient.GetDataField: STring; function TCustomNetGradient.GetDataField: STring;
begin begin
Result := FDataLink.FieldName; Result := FDataLink.FieldName;
end; end;
procedure TNetGradient.SetDataField (const Value: string); procedure TCustomNetGradient.SetDataField (const Value: string);
begin begin
FDataLink.FieldName := Value; FDataLink.FieldName := Value;
end; end;
function TNetGradient.GetDataSource: TDataSource; function TCustomNetGradient.GetDataSource: TDataSource;
begin begin
Result := FDataLink.DataSource; Result := FDataLink.DataSource;
end; end;
procedure TNetGradient.SetDataSource (Value: TDataSource); procedure TCustomNetGradient.SetDataSource (Value: TDataSource);
procedure ChangeDataSource(AControl: TControl; Link: TDataLink; procedure ChangeDataSource(AControl: TControl; Link: TDataLink;
NewDataSource: TDataSource); NewDataSource: TDataSource);
@@ -682,13 +699,13 @@ begin
Value.FreeNotification (Value);} Value.FreeNotification (Value);}
end; end;
function TNetGradient.GetField: TField; function TCustomNetGradient.GetField: TField;
begin begin
Result := FDataLink.Field; Result := FDataLink.Field;
end; end;
// data link event handler // data link event handler
procedure TNetGradient.DataChange (Sender: TObject); procedure TCustomNetGradient.DataChange (Sender: TObject);
begin begin
if FDataLink.DataSet.Active = true then begin if FDataLink.DataSet.Active = true then begin
//enzo //enzo
@@ -701,17 +718,17 @@ begin
end; end;
end; end;
procedure TNetGradient.OnFontChanged(Sender: TObject); procedure TCustomNetGradient.OnFontChanged(Sender: TObject);
begin begin
Changed; Changed;
end; end;
procedure TNetGradient.BeginUpdate; procedure TCustomNetGradient.BeginUpdate;
begin begin
Inc(FUpdateCount); Inc(FUpdateCount);
end; end;
procedure TNetGradient.Changed; procedure TCustomNetGradient.Changed;
begin begin
if (FUpdateCount = 0) and not (csLoading in ComponentState) then if (FUpdateCount = 0) and not (csLoading in ComponentState) then
begin begin
@@ -719,7 +736,7 @@ begin
end; end;
end; end;
procedure TNetGradient.EndUpdate; procedure TCustomNetGradient.EndUpdate;
begin begin
if FUpdateCount > 0 then if FUpdateCount > 0 then
Dec(FUpdateCount); Dec(FUpdateCount);
@@ -728,7 +745,7 @@ end;
//********** //**********
constructor TSubCaption.Create(AOwner: TNetGradient); constructor TSubCaption.Create(AOwner: TCustomNetGradient);
begin begin
inherited Create; inherited Create;
Parent := AOwner; Parent := AOwner;