initial commit
[rofl0r-KOL.git] / units / flash / mckFlash.pas
blob93ea51bca3923aa445af834ad7622a8d8333288b
1 //////////////////////////////////////////////////
2 // //
3 // //
4 // TKOLFlash v1.0 //
5 // //
6 // Author: Dimaxx (dimaxx@atnet.ru) //
7 // //
8 // //
9 //////////////////////////////////////////////////
10 unit mckFlash;
12 interface
14 uses Classes, Kol, Mirror;
16 type
17 TShockwaveFlashOnReadyStateChange = procedure(Sender: TObject; newState: Integer) of object;
18 TShockwaveFlashOnProgress = procedure(Sender: TObject; percentDone: Integer) of object;
19 TShockwaveFlashFSCommand = procedure(Sender: TObject; const command: WideString; const args: WideString) of object;
21 TKOLFlash = class(TKOLCustomControl)
22 private
23 FOnFlashReadyStateChange: TShockwaveFlashOnReadyStateChange;
24 FOnFlashProgress: TShockwaveFlashOnProgress;
25 FOnFlashFSCommand: TShockwaveFlashFSCommand;
26 public
27 constructor Create(Owner: TComponent); override;
28 protected
29 function AdditionalUnits: string; override;
30 procedure SetupFirst(SL: TStringList; const AName,AParent,Prefix: string); override;
31 procedure AssignEvents(SL: TStringList; const AName: string); override;
32 procedure SetOnFlashReadyStateChange(E: TShockwaveFlashOnReadyStateChange);
33 procedure SetOnFlashProgress(E: TShockwaveFlashOnProgress);
34 procedure SetOnFlashFSCommand(E: TShockwaveFlashFSCommand);
35 published
36 property Align;
37 property Visible;
38 property OnEnter;
39 property OnExit;
40 property OnFlashReadyStateChange: TShockwaveFlashOnReadyStateChange read FOnFlashReadyStateChange write SetOnFlashReadyStateChange;
41 property OnFlashProgress: TShockwaveFlashOnProgress read FOnFlashProgress write SetOnFlashProgress;
42 property OnFlashFSCommand: TShockwaveFlashFSCommand read FOnFlashFSCommand write SetOnFlashFSCommand;
43 end;
45 procedure Register;
47 {$R mckFlash.dcr}
49 implementation
51 procedure Register;
52 begin
53 RegisterComponents('KOL', [TKOLFlash]);
54 end;
56 constructor TKOLFlash.Create;
57 begin
58 inherited Create(Owner);
59 end;
61 function TKOLFlash.AdditionalUnits;
62 begin
63 Result:=', KOLFlash';
64 end;
66 procedure TKOLFlash.SetupFirst;
67 begin
68 SL.Add(Prefix+AName+' := NewKOLFlash(Result.Form); ');
69 AssignEvents(SL,AName);
70 end;
72 procedure TKOLFlash.AssignEvents;
73 begin
74 inherited;
75 DoAssignEvents(SL,AName,
76 ['OnFlashReadyStateChange','OnFlashProgress','OnFlashFSCommand'],
77 [@OnFlashReadyStateChange,@OnFlashProgress,@OnFlashFSCommand]);
78 end;
80 procedure TKOLFlash.SetOnFlashReadyStateChange;
81 begin
82 FOnFlashReadyStateChange:=E;
83 Change;
84 end;
86 procedure TKOLFlash.SetOnFlashProgress;
87 begin
88 FOnFlashProgress:=E;
89 Change;
90 end;
92 procedure TKOLFlash.SetOnFlashFSCommand;
93 begin
94 FOnFlashFSCommand:=E;
95 Change;
96 end;
98 end.