1 | unit uflashplayersetup;
|
---|
2 |
|
---|
3 | {$mode objfpc}{$H+}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Forms, StdCtrls, ExtCtrls, BGRABitmap, BGRAVirtualScreen, BGRAButton,
|
---|
9 | BGRAFlashProgressBar, Classes, SysUtils;
|
---|
10 |
|
---|
11 | type
|
---|
12 |
|
---|
13 | { TfrmFlashPlayerSetup }
|
---|
14 |
|
---|
15 | TfrmFlashPlayerSetup = class(TForm)
|
---|
16 | btnQuit: TBGRAButton;
|
---|
17 | btnInstall: TBGRAButton;
|
---|
18 | FlashProgressbar: TBGRAFlashProgressBar;
|
---|
19 | LabelPercent: TLabel;
|
---|
20 | LabelPercentShadow: TLabel;
|
---|
21 | LabelPos: TLabel;
|
---|
22 | LabelPosShadow: TLabel;
|
---|
23 | Timer1: TTimer;
|
---|
24 | vsBody: TBGRAVirtualScreen;
|
---|
25 | vsButtonPanel: TBGRAVirtualScreen;
|
---|
26 | procedure Quit(Sender: TObject);
|
---|
27 | procedure FormCreate(Sender: TObject);
|
---|
28 | procedure vsBodyRedraw(Sender: TObject; Bitmap: TBGRABitmap);
|
---|
29 | procedure vsButtonPanelRedraw(Sender: TObject; Bitmap: TBGRABitmap);
|
---|
30 | procedure Button1Click(Sender: TObject);
|
---|
31 | procedure Timer1Timer(Sender: TObject);
|
---|
32 | public
|
---|
33 | procedure SetStatus(AText: string);
|
---|
34 | end;
|
---|
35 |
|
---|
36 | var
|
---|
37 | frmFlashPlayerSetup: TfrmFlashPlayerSetup;
|
---|
38 |
|
---|
39 | implementation
|
---|
40 |
|
---|
41 | {$R *.lfm}
|
---|
42 |
|
---|
43 | uses
|
---|
44 | bgrasamples;
|
---|
45 |
|
---|
46 | { TfrmFlashPlayerSetup }
|
---|
47 |
|
---|
48 | procedure TfrmFlashPlayerSetup.Quit(Sender: TObject);
|
---|
49 | begin
|
---|
50 | Close;
|
---|
51 | end;
|
---|
52 |
|
---|
53 | procedure TfrmFlashPlayerSetup.FormCreate(Sender: TObject);
|
---|
54 | begin
|
---|
55 | StyleButtonsSample(vsButtonPanel, ssFlashPlayer);
|
---|
56 | end;
|
---|
57 |
|
---|
58 | procedure TfrmFlashPlayerSetup.vsBodyRedraw(Sender: TObject; Bitmap: TBGRABitmap);
|
---|
59 | begin
|
---|
60 | DrawFlashPlayerBody(Bitmap);
|
---|
61 | end;
|
---|
62 |
|
---|
63 | procedure TfrmFlashPlayerSetup.vsButtonPanelRedraw(Sender: TObject;
|
---|
64 | Bitmap: TBGRABitmap);
|
---|
65 | begin
|
---|
66 | DrawFlashPlayerButtonPanel(Bitmap);
|
---|
67 | end;
|
---|
68 |
|
---|
69 | procedure TfrmFlashPlayerSetup.Button1Click(Sender: TObject);
|
---|
70 | begin
|
---|
71 | Timer1.Enabled := False;
|
---|
72 | FlashProgressbar.Value := 0;
|
---|
73 | Timer1.Enabled := True;
|
---|
74 | btnInstall.Enabled := False;
|
---|
75 | SetStatus('Initializing...');
|
---|
76 | end;
|
---|
77 |
|
---|
78 | procedure TfrmFlashPlayerSetup.Timer1Timer(Sender: TObject);
|
---|
79 | begin
|
---|
80 | if FlashProgressbar.Value < FlashProgressbar.MaxValue then
|
---|
81 | begin
|
---|
82 | FlashProgressbar.Value := FlashProgressbar.Value + 128;
|
---|
83 | SetStatus(IntToStr(FlashProgressbar.Value) + 'k/' + IntToStr(
|
---|
84 | FlashProgressbar.MaxValue) + 'k');
|
---|
85 | end
|
---|
86 | else
|
---|
87 | begin
|
---|
88 | Timer1.Enabled := False;
|
---|
89 | btnInstall.Enabled := True;
|
---|
90 | SetStatus('Done');
|
---|
91 | end;
|
---|
92 | end;
|
---|
93 |
|
---|
94 | procedure TfrmFlashPlayerSetup.SetStatus(AText: string);
|
---|
95 | var
|
---|
96 | percent: string;
|
---|
97 | begin
|
---|
98 | LabelPos.Caption := AText;
|
---|
99 | LabelPosShadow.Caption := AText;
|
---|
100 | percent := IntToStr(round(FlashProgressbar.Value / FlashProgressbar.MaxValue *
|
---|
101 | 100)) + '%';
|
---|
102 | LabelPercent.Caption := percent;
|
---|
103 | LabelPercentShadow.Caption := percent;
|
---|
104 | end;
|
---|
105 |
|
---|
106 | end.
|
---|