Componentes.Terceros.RemObj.../official/5.0.24.615/Data Abstract for Delphi/Source/uDAPleaseWaitForm.pas

120 lines
3.7 KiB
ObjectPascal

unit uDAPleaseWaitForm;
{----------------------------------------------------------------------------}
{ Data Abstract Library - Core Library }
{ }
{ compiler: Delphi 6 and up, Kylix 3 and up }
{ platform: Win32, Linux }
{ }
{ (c)opyright RemObjects Software. all rights reserved. }
{ }
{ Using this code requires a valid license of the Data Abstract }
{ which can be obtained at http://www.remobjects.com. }
{----------------------------------------------------------------------------}
{$I DataAbstract.inc}
interface
uses
{$IFDEF FPC}LResources,{$ENDIF}
{$IFDEF MSWINDOWS}uROPleaseWaitForm,{$ENDIF}
{$IFDEF LINUX}uROPleaseWaitForm_Kylix,{$ENDIF}
Classes;
type
IROPleaseWaitForm = interface
['{32003A95-B7F4-4ED6-B65E-78B4204DF2AF}']
procedure Show(const iCaption:string=''); overload;
procedure Hide;
procedure Free;
end;
function CreatePleaseWaitForm(aOwner: TComponent; const aCaption: string; aShow: boolean; aLogo:string; aWindowCaption:string=''): IROPleaseWaitForm; overload;
function CreatePleaseWaitForm(aOwner: TComponent; const aCaption: string; aShow: boolean = true): IROPleaseWaitForm; overload;
function CreatePleaseWaitForm(const aCaption: string; aShow: boolean = true): IROPleaseWaitForm; overload;
implementation
uses
{$IFDEF MSWINDOWS}Graphics, {$ENDIF}
{$IFDEF LINUX}QGraphics, {$ENDIF}
SysUtils;
{$IFNDEF FPC}
{$IFDEF MSWINDOWS}
{$R IDE\DataAbstract_IDE_AdditionalResources.res}
{$ENDIF}
{$IFDEF LINUX}
{$R IDE/DataAbstract_IDE_AdditionalResources.res}
{$ENDIF}
{$ENDIF FPC}
type
TROPleaseWaitFormWrapper = class(TInterfacedObject, IROPleaseWaitForm)
private
fForm: TPleaseWaitForm;
public
constructor Create(aForm: TPleaseWaitForm);
destructor Destroy; override;
procedure Show(const iCaption:string=''); overload;
procedure Hide;
procedure Free;
end;
function CreatePleaseWaitForm(aOwner: TComponent; const aCaption: string; aShow: boolean; aLogo:string; aWindowCaption:string): IROPleaseWaitForm; overload;
var
lBitmap: TBitmap;
begin
if aWindowCaption = '' then aWindowCaption := 'Data Abstract';
lBitmap := TBitmap.Create();
lBitmap.LoadFromResourceName(hInstance, aLogo);
result := TROPleaseWaitFormWrapper.Create(TPleaseWaitForm.Create(aOwner, aCaption, aWindowCaption, lBitmap, true));
if aShow then result.Show();
end;
function CreatePleaseWaitForm(aOwner: TComponent; const aCaption: string; aShow: boolean = true): IROPleaseWaitForm;
begin
result := CreatePleaseWaitForm(aOWner, aCaption, aShow, 'dalogo');
end;
function CreatePleaseWaitForm(const aCaption: string; aShow: boolean = true): IROPleaseWaitForm;
begin
result := CreatePleaseWaitForm(nil, aCaption, aShow);
end;
{ TROPleaseWaitFormWrapper }
constructor TROPleaseWaitFormWrapper.Create(aForm: TPleaseWaitForm);
begin
fForm := aForm;
end;
destructor TROPleaseWaitFormWrapper.Destroy;
begin
FreeAndNil(fForm);
inherited;
end;
procedure TROPleaseWaitFormWrapper.Free;
begin
{ no-op }
end;
procedure TROPleaseWaitFormWrapper.Hide;
begin
fForm.Hide();
end;
procedure TROPleaseWaitFormWrapper.Show(const iCaption: string='');
begin
fForm.Show(iCaption);
end;
{$IFDEF FPC}
initialization
{$I IDE/DataAbstract_IDE_AdditionalResources.lrs}
{$ENDIF}
end.