вторник, 13 октября 2015 г.

#850. Progress visualizer

Original in Russian: http://18delphi.blogspot.ru/2013/05/blog-post_7718.html

unit afwLongProcessVisualizer;
 
interface
 
uses
  afwInterfaces,
  l3Base,
  l3AsincMessageWindow
  ;
 
type
 TafwLongProcessVisualizer = class(Tl3Base, IafwLongProcessVisualizer)
 private
 // private fields
   f_Wnd : Tl3AsincMessageWindow;
    {* The message window.}
 protected
 // overridden protected methods
   procedure Cleanup; override;
     {* Object fields clean up function. }
 public
 // public methods
   constructor Create(const aCaption: IafwCString;
    anAttachWnd: THandle = 0;
    anInitialTimeout: Cardinal = afw_lpwTimeout;
    anImageList: TafwCustomImageList = nil;
    anImageIndex: Integer = -1); reintroduce;
     {* Creates class instant }
   class function Make(const aCaption: IafwCString;
    anAttachWnd: THandle = 0;
    anInitialTimeout: Cardinal = afw_lpwTimeout;
    anImageList: TafwCustomImageList = nil;
    anImageIndex: Integer = -1): IafwLongProcessVisualizer; reintroduce;
     {* Creates class instant in the form of interface IafwLongProcessVisualizer. }
 end;//TafwLongProcessVisualizer
 
implementation
 
// start class TafwLongProcessVisualizer
 
constructor TafwLongProcessVisualizer.Create(const aCaption: IafwCString;
  anAttachWnd: THandle = 0;
  anInitialTimeout: Cardinal = afw_lpwTimeout;
  anImageList: TafwCustomImageList = nil;
  anImageIndex: Integer = -1);
begin
 inherited Create;
 f_Wnd := Tl3AsincMessageWindow.Create(aCaption, anImageList, anImageIndex,
                                       anAttachWnd, anInitialTimeout);
end;//TafwLongProcessVisualizer.Create
 
class function TafwLongProcessVisualizer.Make(const aCaption: IafwCString;
  anAttachWnd: THandle = 0;
  anInitialTimeout: Cardinal = afw_lpwTimeout;
  anImageList: TafwCustomImageList = nil;
  anImageIndex: Integer = -1): IafwLongProcessVisualizer;
var
 l_Inst : TafwLongProcessVisualizer;
begin
 l_Inst := Create(aCaption, anAttachWnd, anInitialTimeout, anImageList, anImageIndex);
 try
  Result := l_Inst;
 finally
  l_Inst.Free;
 end;//try..finally
end;
 
procedure TafwLongProcessVisualizer.Cleanup;
begin
 FreeAndNil(f_Wnd);
 inherited;
end;//TafwLongProcessVisualizer.Cleanup
 
end.


Комментариев нет:

Отправить комментарий