Files
lazarus-ccr/components/rx/rxaboutdialog.pas

125 lines
3.4 KiB
ObjectPascal
Raw Normal View History

{ RxAboutDialog
Copyright (C) 2010 Lagunov A.A. alexs@hotbox.ru
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
for more details.
You should have received a copy of the GNU Library General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
}
unit RxAboutDialog;
{$mode objfpc}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs;
type
TRxAboutDialogOption = (radHelpButton, radLicenseTab, radShowImageLogo);
TRxAboutDialogOptions = set of TRxAboutDialogOption;
{ TRxAboutDialog }
TRxAboutDialog = class(TComponent)
private
FApplicationTitle: string;
FCaption: string;
FLicenseFileName: string;
FOptions: TRxAboutDialogOptions;
FPicture: TPicture;
procedure SetPicture(const AValue: TPicture);
procedure SetRxAboutDialogOptions(const AValue: TRxAboutDialogOptions);
protected
{ Protected declarations }
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Execute;
published
property Options:TRxAboutDialogOptions read FOptions write SetRxAboutDialogOptions;
property ApplicationTitle:string read FApplicationTitle write FApplicationTitle;
property LicenseFileName:string read FLicenseFileName write FLicenseFileName;
property Caption:string read FCaption write FCaption;
property Picture: TPicture read FPicture write SetPicture;
end;
implementation
uses rxAboutFormUnit, ButtonPanel, rxconst;
{ TRxAboutDialog }
procedure TRxAboutDialog.SetRxAboutDialogOptions(
const AValue: TRxAboutDialogOptions);
begin
if FOptions=AValue then exit;
FOptions:=AValue;
end;
procedure TRxAboutDialog.SetPicture(const AValue: TPicture);
begin
if FPicture=AValue then exit;
FPicture.Assign(AValue);
end;
constructor TRxAboutDialog.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FPicture := TPicture.Create;
FCaption:=sAbout;
end;
destructor TRxAboutDialog.Destroy;
begin
FPicture.Graphic := nil;
FPicture.Free;
inherited Destroy;
end;
procedure TRxAboutDialog.Execute;
var
rxAboutFormForm: TrxAboutFormForm;
begin
rxAboutFormForm:=TrxAboutFormForm.Create(Application);
rxAboutFormForm.Caption:=FCaption;
if radLicenseTab in FOptions then
rxAboutFormForm.LoadLicense(FLicenseFileName)
else
rxAboutFormForm.TabSheet3.TabVisible:=false;
if radHelpButton in FOptions then
rxAboutFormForm.ButtonPanel1.ShowButtons:=rxAboutFormForm.ButtonPanel1.ShowButtons + [pbHelp]
else
rxAboutFormForm.ButtonPanel1.ShowButtons:=rxAboutFormForm.ButtonPanel1.ShowButtons - [pbHelp];
if FApplicationTitle <> '' then
rxAboutFormForm.lblAppTitle.Caption:=FApplicationTitle;
if radShowImageLogo in FOptions then
begin
rxAboutFormForm.Image1.Picture.Assign(Picture);
end
else
begin
end;
try
rxAboutFormForm.ShowModal;
finally
rxAboutFormForm.Free;
end;
end;
end.