initial commit
[rofl0r-KOL.git] / controls / formsave / mckFormSave.pas
blob6aea6c557954a56d806088b5ae9bfcc328db872d
1 unit mckFormSave;
3 interface
5 uses
6 Windows, Classes, Messages, Forms, SysUtils,
7 mirror, mckCtrls, Graphics;
9 type
11 TKOLFormSave = class(TKOLObj)
12 private
13 fRegistry: boolean;
14 fFileName: string;
15 fSection: string;
16 protected
17 constructor Create(AOwner: TComponent); override;
18 function AdditionalUnits: string; override;
19 procedure SetupFirst( SL: TStringList; const AName, AParent, Prefix: String ); override;
20 procedure SetupLast( SL: TStringList; const AName, AParent, Prefix: String ); override;
21 procedure AssignEvents( SL: TStringList; const AName: String ); override;
22 procedure SetRegistry(Value: boolean);
23 procedure SetFileName(Value: string);
24 procedure SetSection(Value: string);
25 public
26 published
27 property FileName: string read fFileName write SetFileName;
28 property Registry: boolean read fRegistry write SetRegistry;
29 property Section: string read fSection write SetSection;
30 end;
32 procedure Register;
34 implementation
36 {$R *.dcr}
38 constructor TKOLFormSave.Create;
39 begin
40 inherited;
41 Registry := True;
42 FileName := '';
43 fSection := AOwner.Name;
44 end;
46 function TKOLFormSave.AdditionalUnits;
47 begin
48 Result := ', FormSave';
49 end;
51 procedure TKOLFormSave.SetupFirst;
52 begin
53 SL.Add( Prefix + AName + ' := NewFormSave(Result.Form);' );
54 if fRegistry then
55 SL.Add( Prefix + AName + '.Registry := True;');
56 if fFileName <> '' then
57 SL.Add( Prefix + AName + '.FileName := ''' + fFileName + ''';' );
58 if fSection <> '' then
59 SL.Add( Prefix + AName + '.Section := ''' + fSection + ''';' );
60 SL.Add( Prefix + AName + '.SaveWindow(False);' );
61 end;
63 procedure TKOLFormSave.SetupLast;
64 begin
65 end;
67 procedure TKOLFormSave.AssignEvents;
68 begin
69 inherited;
70 end;
72 procedure TKOLFormSave.SetRegistry;
73 begin
74 fRegistry := Value;
75 Change;
76 end;
78 procedure TKOLFormSave.SetFileName;
79 begin
80 if Value <> '' then begin
81 fFileName := Value;
82 Change;
83 end;
84 end;
86 procedure TKOLFormSave.SetSection;
87 begin
88 if Value <> '' then begin
89 fSection := Value;
90 end;
91 end;
93 procedure Register;
94 begin
95 RegisterComponents('KOLUtil', [TKOLFormSave]);
96 end;
98 end.