unit ALSTDlg;
interface
uses
{$IFDEF WIN32}Windows,
{$ELSE}WinTypes, WinProcs,
{$ENDIF}
Messages, SysUtils, Classes, Graphics, Controls, Forms,
DesignIntf, DesignEditors, Dialogs, INIFiles
{$IFDEF WIN32}, Registry
{$ENDIF};
type
TALSShowPos = (posScreenCenter, posFormCenter);
TTipLocation = (locEmbeded,
{$IFDEF WIN32}locRegistry,
{$ENDIF} locINIFile);
TRegRoot = (CURRENT_USER,LOCAL_MACHINE,CURRENT_CONFIG);
TTipDialogEditor =
class(TDefaultEditor)
public
procedure ExecuteVerb(
Index : Integer);
override;
function GetVerb(
Index : Integer):
string;
override;
function GetVerbCount : Integer;
override;
procedure Edit;
override;
end;
TAbout =
class(TPropertyEditor)
public
procedure Edit;
override;
function GetAttributes: TPropertyAttributes;
override;
function GetValue:
string;
override;
end;
TFileNameProperty =
class (TStringProperty)
public
function getattributes: TPropertyattributes;
override;
procedure Edit;
override;
end;
TALSTipDlg =
class(TComponent)
private
FAbout : TAbout;
FDlgCaption :
string;
FTipTitle :
string;
FTips : TStrings;
FTipTitleFont : TFont;
FTipFont : TFont;
FRegRoot : TRegRoot;
FRegKey :
string;
FINIFile :
string;
FINISection :
string;
FTipsLocation : TTipLocation;
FPanelColor : TColor;
FCRLFSubst :
string;
FRandomTips : boolean;
FShowAtStartup: boolean;
FPosition : TALSShowPos;
protected
{$IFDEF WIN32}
function ReadFromRegistry : boolean;
{$ENDIF}
function ReadFromINIFile : boolean;
public
constructor Create(AOwner: TComponent);
override;
destructor Destroy;
override;
procedure SetTipValues(Value: TStrings);
procedure SetTitleFont(Value: TFont);
procedure SetTipFont(Value: TFont);
function Execute : boolean;
published
property About
: TAbout
read FAbout
write FAbout;
property DlgCaption:
string read FDlgCaption
write FDlgCaption;
property TipTitle:
string read FTipTitle
write FTipTitle;
property Tips: TStrings
read FTips
write SetTipValues;
property TipTitleFont: TFont
read FTipTitleFont
write SetTitleFont;
property TipFont: TFont
read FTipFont
write SetTipFont;
{$IFDEF WIN32}
property RegistryRoot: TRegRoot
read FRegRoot
write FRegRoot
default CURRENT_USER;
property RegistryKey:
string read FRegKey
write FRegKey;
{$ENDIF}
property INIFile:
string read FINIFile
write FINIFile;
property INISection:
string read FINISection
write FINISection;
property TipsLocation: TTipLocation
read FTipsLocation
write FTipsLocation
default locEmbeded;
property PanelColor: TColor
read FPanelColor
write FPanelColor
default
{$IFDEF VER120}clInfoBk
{$ELSE} TColor($00E1FFFF)
{$ENDIF};
property CRLFSubstitute :
string read FCRLFSubst
write FCRLFSubst;
property RandomTips: boolean
read FRandomTips
write FRandomTips
default False;
property ShowAtStartup: boolean
read FShowAtStartup
write FShowAtStartup
default True;
property Position: TALSShowPos
read FPosition
write FPosition;
end;
procedure Register;
implementation
uses TipFrm;
{$IFDEF WIN32}
{$R ALSTDLG.R32}
{$ELSE}
{$R ALSTDLG.R16}
{$ENDIF}
procedure Register;
begin
RegisterComponents('
Samples', [TALSTipDlg]);
RegisterComponentEditor(TALSTipDlg, TTipDialogEditor);
RegisterPropertyEditor(TypeInfo(TAbout), TALSTipDlg, '
ABOUT', TAbout);
RegisterPropertyEditor(Typeinfo(
string), TALSTipDlg, '
INIFile', TFileNameProperty);
end;