1
0
mirror of https://bitbucket.org/Dennis07/lina-components.git synced 2024-11-24 08:02:12 +02:00
lina-components/Source/uFrmCtrls.pas
Dennis07 e3fd503026 Version 1.0 DEV 1.05
Signed-off-by: Dennis07 <den.goehlert@t-online.de>
2014-09-11 02:43:39 +02:00

987 lines
29 KiB
ObjectPascal

unit uFrmCtrls;
//////////////////////////////////////
/// Lina Form Controls Unit ///
/// **************************** ///
/// (c) 2014 Dennis Göhlert a.o. ///
//////////////////////////////////////
interface
uses
{ Standard-Units }
SysUtils, Classes, Controls, Forms, StdCtrls, ComCtrls, ExtCtrls, Graphics,
{ Andere Package-Units }
uBase, uSysTools, uBattery, uWebCtrls;
type
{ Hilfsklassen }
TSplashScreenMode = (ssmDefault,ssmModal);
TSplashScreenAnimation = (ssaNone,ssaShallow);
TProgressBarManagerMode = (pmmNone,pmmBattery,pmmDownload);
TListBoxManagerMode = (lmmNone,lmmEdit,lmmComboBox);
TParamReferenceType = (prtAutomatic,prtChar,prtString,prtInteger,prtFloat);
type
{ Ereignisse }
TSplashCreateEvent = procedure(Sender: TObject) of object;
TSplashDestroyEvent = procedure(Sender: TObject) of object;
TSplashShowEvent = procedure(Sender: TObject) of object;
TSplashHideEvent = procedure(Sender: TObject) of object;
TSplashChangeEvent = procedure(Sender: TObject) of object;
TSplashTimerEvent = procedure(Sender: TObject) of object;
TComponentManagerUpdateEvent = procedure(Sender: TObject) of object;
type
{ Hauptklassen }
{ TSplash... }
TSplashForm = class
private
{ Private-Deklarationen }
FBorderStyle: TFormBorderStyle;
FBorderIcons: TBorderIcons;
FLeft: Integer;
FTop: Integer;
FWidth: Integer;
FHeight: Integer;
FAlign: TAlign;
FAlphaBlend: Boolean;
FAlphaBlendValue: Byte;
FCaption: TCaption;
FColor: TColor;
FEnabled: Boolean;
FWindowState: TWindowState;
FPosition: TPosition;
FCursor: TCursor;
public
{ Public-Deklarationen }
constructor Create;
destructor Destroy; override;
published
{ Published-Deklarationen }
property BorderStyle: TFormBorderStyle read FBorderStyle write FBorderStyle default bsNone;
property BorderIcons: TBorderIcons read FBorderIcons write FBorderIcons default [];
property Left: Integer read FLeft write FLeft default 0;
property Top: Integer read FTop write FTop default 0;
property Width: Integer read FWidth write FWidth default 600;
property Height: Integer read FHeight write FHeight default 400;
property Align: TAlign read FAlign write FAlign default alNone;
property AlphaBlend: Boolean read FAlphaBlend write FAlphaBlend default False;
property AlphaBlendValue: Byte read FAlphaBlendValue write FAlphaBlendValue default 255;
property Caption: TCaption read FCaption write FCaption;
property Color: TColor read FColor write FColor default clBtnFace;
property Enabled: Boolean read FEnabled write FEnabled default True;
property WindowState: TWindowState read FWindowState write FWindowState default wsNormal;
property Position: TPosition read FPosition write FPosition default poScreenCenter;
property Cursor: TCursor read FCursor write FCursor default crHourGlass;
end;
TSplashProgressBar = class
private
{ Private-Deklarationen }
FLeft: Integer;
FTop: Integer;
FWidth: Integer;
FHeight: Integer;
FVisible: Boolean;
FPosition: Integer;
FMin: Integer;
FMax: Integer;
FAlign: TAlign;
FBackgroundColor: TColor;
FBarColor: TColor;
FState: TProgressBarState;
FStyle: TProgressBarStyle;
FSmooth: Boolean;
FSmoothReverse: Boolean;
FMarqueeInterval: Integer;
FStep: Integer;
public
{ Public-Deklarationen }
constructor Create;
destructor Destroy; override;
published
{ Published-Deklarationen }
property Left: Integer read FLeft write FLeft default 250;
property Top: Integer read FTop write FTop default 250;
property Width: Integer read FWidth write FWidth default 100;
property Height: Integer read FHeight write FHeight default 50;
property Visible: Boolean read FVisible write FVisible default True;
property Position: Integer read FPosition write FPosition default 0;
property Max: Integer read FMax write FMax default 100;
property Min: Integer read FMin write FMin default 0;
property Align: TAlign read FAlign write FAlign default alNone;
property BackgroundColor: TColor read FBackgroundColor write FBackgroundColor default clDefault;
property BarColor: TColor read FBarColor write FBarColor default clDefault;
property State: TProgressBarState read FState write FState default pbsNormal;
property Style: TProgressBarStyle read FStyle write FStyle default pbstNormal;
property Smooth: Boolean read FSmooth write FSmooth default False;
property SmoothReverse: Boolean read FSmoothReverse write FSmoothReverse default False;
property MarqueeInterval: Integer read FMarqueeInterval write FMarqueeInterval default 10;
property Step: Integer read FStep write FStep default 10;
end;
TSplashImage = class
private
{ Private-Deklarationen }
FVisible: Boolean;
FTransparent: Boolean;
FPicture: TPicture;
public
{ Public-Deklarationen }
constructor Create;
destructor Destroy; override;
published
{ Published-Deklarationen }
property Visible: Boolean read FVisible write FVisible default True;
property Transparent: Boolean read FTransparent write FTransparent default False;
property Picture: TPicture read FPicture write FPicture;
end;
TSplashTimer = class
private
{ Private-Deklarationen }
FEnabled: Boolean;
FInterval: Cardinal;
public
{ Public-Deklarationen }
constructor Create;
destructor Destroy;
published
{ Published-Deklarationen }
property Enabled: Boolean read FEnabled write FEnabled default False;
property Interval: Cardinal read FInterval write FInterval default 1000;
end;
TSplashScreen = class(TComponent)
private
{ Private-Deklarationen }
FormObject: TForm;
ProgressBarObject: TProgressBar;
ImageObject: TImage;
TimerObject: TTimer;
AnimationTimerShow: TTimer;
AnimationTimerHide: TTimer;
FAbout: TComponentAbout;
FSplashForm: TSplashForm;
FSplashProgressBar: TSplashProgressBar;
FSplashImage: TSplashImage;
FSplashTimer: TSplashTimer;
FDisplayTime: Cardinal;
FAutoShow: Boolean;
FMode: TSplashScreenMode;
FAnimation: TSplashScreenAnimation;
FAnimationSpeed: Byte;
FVisible: Boolean;
{ Ereignisse }
FCreateEvent: TSplashCreateEvent;
FDestroyEvent: TSplashDestroyEvent;
FShowEvent: TSplashShowEvent;
FHideEvent: TSplashHideEvent;
FChangeEvent: TSplashChangeEvent;
FTimerEvent: TSplashTimerEvent;
{ Methoden }
procedure SetVisible(Value: Boolean);
procedure FormObjectShow(Sender: TObject);
procedure FormObjectHide(Sender: TObject);
procedure TimerObjectTimer(Sender: TObject);
procedure AnimationTimerShowTimer(Sender: TObject);
procedure AnimationTimerHideTimer(Sender: TObject);
protected
{ Protected-Deklarationen }
procedure Refresh; //Vorberaitung (benutzerdefinierte Werte)
procedure Reset; //Vorbereitung (standardmäßige Werte)
public
{ Public-Deklarationen }
property Visible: Boolean read FVisible write SetVisible;
constructor Create(AOwnder: TComponent); override;
destructor Destroy; override;
procedure ApplyChanges; //Änderungen übernehmen
procedure Show; //Anzeigen
procedure Hide; //Verstecken (schließen)
published
{ Published-Deklarationen }
{ Ereignisse }
property OnCreate: TSplashCreateEvent read FCreateEvent write FCreateEvent;
property OnDestroy: TSplashDestroyEvent read FDestroyEvent write FDestroyEvent;
property OnShow: TSplashShowEvent read FShowEvent write FShowEvent;
property OnHide: TSplashHideEvent read FHideEvent write FHideEvent;
property OnChange: TSplashChangeEvent read FChangeEvent write FChangeEvent;
property OnTimer: TSplashTimerEvent read FTimerEvent write FTimerEvent;
{ Eigenschaften }
property About: TComponentAbout read FAbout;
property SplashForm: TSplashForm read FSplashForm write FSplashForm;
property SplashProgressBar: TSplashProgressBar read FSplashProgressBar write FSplashProgressBar;
property SplashImage: TSplashImage read FSplashImage write FSplashImage;
property SplashTimer: TSplashTimer read FSplashTimer write FSplashTimer;
property DisplayTime: Cardinal read FDisplayTime write FDisplayTime default 2000;
property AutoShow: Boolean read FAutoShow write FAutoShow default False;
property Mode: TSplashScreenMode read FMode write FMode default ssmDefault;
property Animation: TSplashScreenAnimation read FAnimation write FAnimation default ssaNone;
property AnimationSpeed: Byte read FAnimationSpeed write FAnimationSpeed default 10;
end;
{ T...Manager }
TComponentManager = class(TComponent)
private
{ Private-Deklarationen }
FAbout: TComponentAbout;
{ Ereignisse }
FUpdateEvent: TComponentManagerUpdateEvent;
public
{ Public-Deklarationen }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Update;
published
{ Published-Deklarationen }
{ Ereignisse }
property OnUpdate: TComponentManagerUpdateEvent read FUpdateEvent write FUpdateEvent;
{ Eigenschaften }
property About: TComponentAbout read FAbout;
end;
TProgressBarManager = class(TComponentManager)
private
{ Private-Deklarationen }
FAbout: TComponentAbout;
FTarget: TProgressBar;
FSourceBattery: TBattery;
FSourceDownload: TDownload;
FMode: TProgressBarManagerMode;
{ Methoden }
procedure SetTarget(Value: TProgressBar);
procedure SetSourceBattery(Value: TBattery);
procedure SetSourceDownload(Value: TDownload);
procedure SetMode(Value: TProgressBarManagerMode);
public
{ Public-Deklarationen }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Update;
published
{ Published-Deklarationen }
property Target: TProgressBar read FTarget write SetTarget;
property SourceBattery: TBattery read FSourceBattery write SetSourceBattery;
property SourceDownload: TDownload read FSourceDownload write SetSourceDownload;
property Mode: TProgressBarManagerMode read FMode write SetMode default pmmNone;
end;
TListBoxManager = class(TComponentManager)
private
{ Private-Deklarationen }
FilteredList: TFilteredStringList;
FTarget: TListBox;
FSourceEdit: TEdit;
FSourceComboBox: TComboBox;
FMode: TListBoxManagerMode;
FFilterOptions: TStringFilterOptions;
{ Methoden }
procedure SetTarget(Value: TListBox);
procedure SetSourceEdit(Value: TEdit);
procedure SetSourceComboBox(Value: TComboBox);
procedure SetMode(Value: TListBoxManagerMode);
procedure SetFilterOptions(Value: TStringFilterOptions);
public
{ Public-Deklarationen }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Update;
procedure LoadList;
published
{ Published-Deklarationen }
property Target: TListBox read FTarget write SetTarget;
property SourceEdit: TEdit read FSourceEdit write SetSourceEdit;
property SourceComboBox: TComboBox read FSourceComboBox write SetSourceComboBox;
property Mode: TListBoxManagerMode read FMode write SetMode default lmmNone;
property FilterOptions: TStringFilterOptions read FFilterOptions write SetFilterOptions default [sfoCaseSensitive,sfoForceTrim,sfoDefaultVisible];
end;
{ TParam... }
TParamFormat = class
private
{ Private-Deklarationen }
FPrefix: String;
FSuffix: String;
FSeperator: String;
public
{ Public-Deklarationen }
constructor Create;
destructor Destroy; override;
published
{ Published-Deklarationen }
property Prefix: String read FPrefix write FPrefix;
property Suffix: String read FSuffix write FSuffix;
property Seperator: String read FSeperator write FSeperator;
end;
TParamReference = class
private
{ Private-Deklarationen }
FParamType: TParamReferenceType;
FDefaultValue: Variant;
FConnector: Pointer;
FFormat: TParamFormat;
public
{ Public-Deklarationen }
constructor Create;
destructor Destroy; override;
published
{ Published-Deklarationen }
property ParamType: TParamReferenceType read FParamType write FParamType default prtAutomatic;
property DefaultValue: Variant read FDefaultValue write FDefaultValue;
// property Connector: Pointer read FConnector write FConnector;
property Format: TParamFormat read FFormat write FFormat;
end;
TParamDefiner = class(TComponent)
private
{ Private-Deklarationen }
FAbout: TComponentAbout;
// FReferences: TObjectList;
public
{ Public-Deklarationen }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
// property References [Index]: TParamReference read FReferences write FReferences;
published
{ Published-Deklarationen }
property About: TComponentAbout read FAbout;
end;
procedure Register;
const
{ Meta-Daten }
SplashScreenComponent_Name = 'SplashScreen';
SplashScreenComponent_Version = 1.0;
SplashScreenComponent_Copyright = 'Copyright © 2014';
SplashScreenComponent_Author = 'Dennis Göhlert a.o.';
ProgressBarManagerComponent_Name = 'ProgressBarManager';
ProgressBarManagerComponent_Version = 1.0;
ProgressBarManagerComponent_Copyright = 'Copyright © 2014';
ProgressBarManagerComponent_Author = 'Dennis Göhlert a.o.';
ListBoxManagerComponent_Name = 'ListBoxManager';
ListBoxManagerComponent_Version = 1.0;
ListBoxManagerComponent_Copyright = 'Copyright © 2014';
ListBoxManagerComponent_Author = 'Dennis Göhlert a.o.';
ParamDefinerComponent_Name = 'ParamDefiner';
ParamDefinerComponent_Version = 1.0;
ParamDefinerComponent_Copyright = 'Copyright © 2014';
ParamDefinerComponent_Author = 'Dennis Göhlert a.o.';
implementation
procedure Register;
begin
RegisterComponents(ComponentsPage,[TSplashScreen,TProgressBarManager,TListBoxManager]);
end;
{ ----------------------------------------------------------------------------
TSplashForm
---------------------------------------------------------------------------- }
constructor TSplashForm.Create;
begin
//...
end;
destructor TSplashForm.Destroy;
begin
//...
inherited;
end;
{ ----------------------------------------------------------------------------
TSplashProgressBar
---------------------------------------------------------------------------- }
constructor TSplashProgressBar.Create;
begin
//...
end;
destructor TSplashProgressBar.Destroy;
begin
//...
inherited;
end;
{ ----------------------------------------------------------------------------
TSplashImage
---------------------------------------------------------------------------- }
constructor TSplashImage.Create;
begin
FPicture := TPicture.Create;
end;
destructor TSplashImage.Destroy;
begin
FPicture.Free;
inherited;
end;
{ ----------------------------------------------------------------------------
TSplashTimer
---------------------------------------------------------------------------- }
constructor TSplashTimer.Create;
begin
//...
end;
destructor TSplashTimer.Destroy;
begin
//...
inherited;
end;
{ ----------------------------------------------------------------------------
TSplashScreen
---------------------------------------------------------------------------- }
constructor TSplashScreen.Create(AOwnder: TComponent);
begin
inherited;
FDisplayTime := 2000;
FAutoShow := False;
FMode := ssmDefault;
FAnimation := ssaNone;
FAnimationSpeed := 10;
FVisible := False;
FAbout := TComponentAbout.Create(SplashScreenComponent_Name,SplashScreenComponent_Version,SplashScreenComponent_Copyright,SplashScreenComponent_Author);
FSplashForm := TSplashForm.Create;
FSplashProgressBar := TSplashProgressBar.Create;
FSplashImage := TSplashImage.Create;
FSplashTimer := TSplashTimer.Create;
FormObject := TForm.Create(Self);
FormObject.OnShow := FormObjectShow;
FormObject.OnHide := FormObjectHide;
FormObject.Visible := False;
ProgressBarObject := TProgressBar.Create(Self);
ProgressBarObject.Parent := FormObject;
ImageObject := TImage.Create(Self);
ImageObject.Parent := FormObject;
TimerObject := TTimer.Create(Self);
TimerObject.OnTimer := TimerObjectTimer;
TimerObject.Enabled := False;
AnimationTimerShow := TTimer.Create(Self);
AnimationTimerShow.OnTimer := AnimationTimerShowTimer;
AnimationTimerShow.Enabled := False;
AnimationTimerShow.Interval := 50;
AnimationTimerHide := TTimer.Create(Self);
AnimationTimerHide.OnTimer := AnimationTimerHideTimer;
AnimationTimerHide.Enabled := False;
AnimationTimerHide.Interval := 50;
Reset;
if Assigned(OnCreate) then
begin
OnCreate(Self);
end;
{ Erst NACHDEM fertig erstellt wurde und OnCreate-Event ausgeführt wurde... }
if AutoShow = True then
begin
Show;
end;
end;
destructor TSplashScreen.Destroy;
begin
if Assigned(OnDestroy) then
begin
OnDestroy(Self);
end;
FAbout.Free;
FSplashForm.Free;
FSplashProgressBar.Free;
FSplashImage.Free;
FSplashTimer.Free;
FormObject.Close;
FormObject.Free;
//ProgressBarObject.Free; _
//ImageObject.Free; |
//TimerObject.Free; |____\ Automatisch
//AnimationTimerShow.Free; | / freigegeben
//AnimationTimerHide.Free; _|
inherited;
end;
procedure TSplashScreen.Show;
begin
ApplyChanges;
if Mode = ssmModal then
begin
FormObject.ShowModal;
end else
begin
FormObject.Show;
end;
if Animation = ssaShallow then
begin
FormObject.AlphaBlend := True;
FormObject.AlphaBlendValue := 0;
AnimationTimerHide.Enabled := False;
AnimationTimerShow.Enabled := True;
end;
FVisible := True;
FormObject.BringToFront;
if Assigned(OnShow) then
begin
OnShow(Self);
end;
end;
procedure TSplashScreen.Hide;
begin
TimerObject.Enabled := False;
if Animation = ssaNone then
begin
FormObject.Hide;
end else
begin
if Animation = ssaShallow then
begin
FormObject.AlphaBlend := True;
AnimationTimerShow.Enabled := False;
AnimationTimerHide.Enabled := True;
end;
end;
FVisible := False;
if Assigned(OnHide) then
begin
OnHide(Self);
end;
end;
procedure TSplashScreen.ApplyChanges;
begin
{ "Refresh;" ist nicht public, deswegen hier eine Referenz.
Falls beim übernehmen der Änderungen noch sonstige Dinge getan werden
müssen, können diese hier definiert werden. }
Refresh;
end;
procedure TSplashScreen.Refresh;
begin
{ TSplashForm -> TForm }
FormObject.BorderStyle := SplashForm.BorderStyle;
FormObject.BorderIcons := SplashForm.BorderIcons;
FormObject.Left := SplashForm.Left;
FormObject.Top := SplashForm.Top;
FormObject.Width := SplashForm.Width;
FormObject.Height := SplashForm.Height;
FormObject.Align := SplashForm.Align;
FormObject.AlphaBlend := SplashForm.AlphaBlend;
FormObject.AlphaBlendValue := SplashForm.AlphaBlendValue;
FormObject.Caption := SplashForm.Caption;
FormObject.Color := SplashForm.Color;
FormObject.Enabled := SplashForm.Enabled;
FormObject.WindowState := SplashForm.WindowState;
FormObject.Position := SplashForm.Position;
FormObject.Cursor := SplashForm.Cursor;
{ TSplashProgressBar -> TProgressBar }
ProgressBarObject.Left := SplashProgressBar.Left;
ProgressBarObject.Top := SplashProgressBar.Top;
ProgressBarObject.Width := SplashProgressBar.Width;
ProgressBarObject.Height := SplashProgressBar.Height;
ProgressBarObject.Visible := SplashProgressBar.Visible;
ProgressBarObject.Position := SplashProgressBar.Position;
ProgressBarObject.Max := SplashProgressBar.Max;
ProgressBarObject.Min := SplashProgressBar.Min;
ProgressBarObject.Cursor := FormObject.Cursor;
ProgressBarObject.Align := SplashProgressBar.Align;
ProgressBarObject.BackgroundColor := SplashProgressBar.BackgroundColor;
ProgressBarObject.BarColor := SplashProgressBar.BarColor;
ProgressBarObject.State := SplashProgressBar.State;
ProgressBarObject.Style := SplashProgressBar.Style;
ProgressBarObject.Smooth := SplashProgressBar.Smooth;
ProgressBarObject.SmoothReverse := SplashProgressBar.SmoothReverse;
ProgressBarObject.MarqueeInterval := SplashProgressBar.MarqueeInterval;
ProgressBarObject.Step := SplashProgressBar.Step;
{ TSplashImage -> TImage }
ImageObject.Visible := SplashImage.Visible;
ImageObject.Transparent := SplashImage.Transparent;
ImageObject.Picture := SplashImage.Picture;
{ TSplashTimer -> TTimer }
TimerObject.Enabled := SplashTimer.Enabled;
TimerObject.Interval := SplashTimer.Interval;
if Assigned(OnChange) then
begin
OnChange(Self);
end;
end;
procedure TSplashScreen.Reset;
begin
{ TSplashForm }
SplashForm.BorderStyle := bsNone;
SplashForm.BorderIcons := [];
SplashForm.Left := 0;
SplashForm.Top := 0;
SplashForm.Width := 600;
SplashForm.Height := 400;
SplashForm.Align := alNone;
SplashForm.AlphaBlend := False;
SplashForm.AlphaBlendValue := 255;
SplashForm.Color := clBtnFace;
SplashForm.Enabled := True;
SplashForm.WindowState := wsNormal;
SplashForm.Position := poScreenCenter;
SplashForm.Cursor := crHourGlass;
{ TSplashProgressBar }
SplashProgressBar.Left := 250;
SplashProgressBar.Top := 250;
SplashProgressBar.Width := 100;
SplashProgressBar.Height := 50;
SplashProgressBar.Visible := True;
SplashProgressBar.Position := 0;
SplashProgressBar.Max := 100;
SplashProgressBar.Min := 0;
SplashProgressBar.Align := alNone;
SplashProgressBar.BackgroundColor := clDefault;
SplashProgressBar.BarColor := clDefault;
SplashProgressBar.State := pbsNormal;
SplashProgressBar.Style := pbstNormal;
SplashProgressBar.Smooth := False;
SplashProgressBar.SmoothReverse := False;
SplashProgressBar.MarqueeInterval := 10;
SplashProgressBar.Step := 10;
{ TSplashImage }
SplashImage.Visible := True;
SplashImage.Transparent := False;
{ TSplashTimer }
SplashTimer.Enabled := False;
SplashTimer.Interval := 1000;
if Assigned(OnChange) then
begin
OnChange(Self);
end;
end;
procedure TSplashScreen.SetVisible(Value: Boolean);
begin
if Value = True then
begin
Show;
end else
begin
Hide;
end;
end;
procedure TSplashScreen.FormObjectShow(Sender: TObject);
begin
//...
end;
procedure TSplashScreen.FormObjectHide(Sender: TObject);
begin
//...
end;
procedure TSplashScreen.TimerObjectTimer(Sender: TObject);
begin
if Assigned(OnTimer) then
begin
OnTimer(Self);
end;
end;
procedure TSplashScreen.AnimationTimerShowTimer(Sender: TObject);
begin
if Animation = ssaShallow then
begin
if FormObject.AlphaBlendValue < SplashForm.AlphaBlendValue then
begin
if SplashForm.AlphaBlendValue - FormObject.AlphaBlendValue < AnimationSpeed then
begin
FormObject.AlphaBlendValue := FormObject.AlphaBlendValue + (SplashForm.AlphaBlendValue - FormObject.AlphaBlendValue);
end else
begin
FormObject.AlphaBlendValue := FormObject.AlphaBlendValue + AnimationSpeed;
end;
end else
begin
AnimationTimerShow.Enabled := False;
FormObject.AlphaBlend := SplashForm.AlphaBlend;
end;
end;
end;
procedure TSplashScreen.AnimationTimerHideTimer(Sender: TObject);
begin
if Animation = ssaShallow then
begin
if FormObject.AlphaBlendValue > 0 then
begin
if FormObject.AlphaBlendValue < AnimationSpeed then
begin
FormObject.AlphaBlendValue := FormObject.AlphaBlendValue - FormObject.AlphaBlendValue;
end else
begin
FormObject.AlphaBlendValue := FormObject.AlphaBlendValue - AnimationSpeed;
end;
end else
begin
AnimationTimerHide.Enabled := False;
FormObject.AlphaBlend := SplashForm.AlphaBlend;
FormObject.Hide;
end;
end;
end;
{ ----------------------------------------------------------------------------
TComponentManager
---------------------------------------------------------------------------- }
constructor TComponentManager.Create(AOwner: TComponent);
begin
inherited;
//...
end;
destructor TComponentManager.Destroy;
begin
//...
inherited;
end;
procedure TComponentManager.Update;
begin
//...
end;
{ ----------------------------------------------------------------------------
TProgressBarManager
---------------------------------------------------------------------------- }
constructor TProgressBarManager.Create(AOwner: TComponent);
begin
inherited;
FAbout := TComponentAbout.Create(ProgressBarManagerComponent_Name,ProgressBarManagerComponent_Version,ProgressBarManagerComponent_Copyright,ProgressBarManagerComponent_Author);
FMode := pmmNone;
Update;
end;
destructor TProgressBarManager.Destroy;
begin
FAbout.Free;
inherited;
end;
procedure TProgressBarManager.Update;
begin
inherited;
if Assigned(Target) = False then
begin
Exit;
end;
if Mode <> pmmNone then
begin
if (Mode = pmmBattery) and (Assigned(SourceBattery) = False)
or (Mode = pmmDownload) and (Assigned(SourceDownload) = False) then
begin
Exit;
end;
end;
if Mode = pmmBattery then
begin
Target.Position := (Target.Max div 100) * SourceBattery.GetBatteryPercent;
end;
if Mode = pmmDownload then
begin
Target.Position := (Target.Max div 100) * SourceDownload.GetProgressPercent;
end;
if Assigned(OnUpdate) then
begin
OnUpdate(Self);
end;
end;
procedure TProgressBarManager.SetTarget(Value: TProgressBar);
begin
FTarget := Value;
Update;
end;
procedure TProgressBarManager.SetSourceBattery(Value: TBattery);
begin
FSourceBattery := Value;
if Mode = pmmBattery then
begin
Update;
end;
end;
procedure TProgressBarManager.SetSourceDownload(Value: TDownload);
begin
FSourceDownload := Value;
if Mode = pmmDownload then
begin
Update;
end;
end;
procedure TProgressBarManager.SetMode(Value: TProgressBarManagerMode);
begin
FMode := Value;
Update;
end;
{ ----------------------------------------------------------------------------
TListBoxManager
---------------------------------------------------------------------------- }
constructor TListBoxManager.Create(AOwner: TComponent);
begin
inherited;
FAbout := TComponentAbout.Create(ListBoxManagerComponent_Name,ListBoxManagerComponent_Version,ListBoxManagerComponent_Copyright,ListBoxManagerComponent_Author);
FMode := lmmNone;
FFilterOptions := [sfoCaseSensitive,sfoForceTrim,sfoDefaultVisible];
FilteredList := TFilteredStringList.Create;
Update;
end;
destructor TListBoxManager.Destroy;
begin
FAbout.Free;
FilteredList.Free;
inherited;
end;
procedure TListBoxManager.Update;
begin
inherited;
if Assigned(Target) = False then
begin
Exit;
end;
if Mode <> lmmNone then
begin
if (Mode = lmmEdit) and (Assigned(SourceEdit) = False)
or (Mode = lmmComboBox) and (Assigned(SourceComboBox) = False) then
begin
Exit;
end;
end;
if Mode = lmmEdit then
begin
FilteredList.Filter := SourceEdit.Text;
end;
if Mode = lmmComboBox then
begin
FilteredList.Filter := SourceComboBox.Text;
end;
Target.Items.Assign(FilteredList.FilteredStrings);
if Assigned(OnUpdate) then
begin
OnUpdate(Self);
end;
end;
procedure TListBoxManager.LoadList;
begin
if Assigned(Target) then
begin
FilteredList.Assign(Target.Items);
end;
end;
procedure TListBoxManager.SetTarget(Value: TListBox);
begin
FTarget := Value;
LoadList;
Update;
end;
procedure TListBoxManager.SetSourceEdit(Value: TEdit);
begin
FSourceEdit := Value;
if Mode = lmmEdit then
begin
Update;
end;
end;
procedure TListBoxManager.SetSourceComboBox(Value: TComboBox);
begin
FSourceComboBox := Value;
if Mode = lmmComboBox then
begin
Update;
end;
end;
procedure TListBoxManager.SetMode(Value: TListBoxManagerMode);
begin
FMode := Value;
Update;
end;
procedure TListBoxManager.SetFilterOptions(Value: TStringFilterOptions);
begin
FilteredList.FilterOptions := Value;
FFilterOptions := Value;
Update;
end;
{ ----------------------------------------------------------------------------
TParamFormat
---------------------------------------------------------------------------- }
constructor TParamFormat.Create;
begin
//...
end;
destructor TParamFormat.Destroy;
begin
//...
inherited;
end;
{ ----------------------------------------------------------------------------
TParamReference
---------------------------------------------------------------------------- }
constructor TParamReference.Create;
begin
FFormat := TParamFormat.Create;
end;
destructor TParamReference.Destroy;
begin
FFormat.Free;
inherited;
end;
{ ----------------------------------------------------------------------------
TParamDefiner
---------------------------------------------------------------------------- }
constructor TParamDefiner.Create;
begin
inherited;
FAbout := TComponentAbout.Create(ParamDefinerComponent_Name,ParamDefinerComponent_Version,ParamDefinerComponent_Copyright,ParamDefinerComponent_Author);
//FReferences := TParamReferences.Create;
end;
destructor TParamDefiner.Destroy;
begin
FAbout.Free;
// FReferences.Free;
inherited;
end;
end.