-
Notifications
You must be signed in to change notification settings - Fork 0
/
DigIt_Form_Progress.pas
178 lines (144 loc) · 4.73 KB
/
DigIt_Form_Progress.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
(*******************************************************************************
** DigIt **
** **
** (s) 2023 Massimo Magnano **
** **
********************************************************************************
** Main Form **
*******************************************************************************)
unit DigIt_Form_Progress;
{$mode ObjFPC}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, ComCtrls, ExtCtrls, StdCtrls, Buttons,
Digit_Bridge_Intf;
type
{ TDigIt_Progress }
TDigIt_Progress = class(TForm, IDigIt_Progress)
btCancel: TBitBtn;
capTotal: TLabel;
labTotal: TLabel;
capCurrent: TLabel;
panelCancel: TPanel;
panelTotal: TPanel;
panelCurrent: TPanel;
progressTotal: TProgressBar;
progressCurrent: TProgressBar;
procedure btCancelClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
curEventCallBack: IDigIt_ProgressCallback;
public
procedure SetTotalVisible(AVisible: Boolean); stdcall;
procedure SetTotalLabel(const ALabel: PChar); stdcall;
procedure SetTotal(AMin, AMax, AValue: Integer; isMarquee: Boolean); stdcall;
procedure SetTotalCaption(const ACaption: PChar); stdcall;
procedure SetTotalValue(AValue: Integer); stdcall;
procedure SetCurrentVisible(AVisible: Boolean); stdcall;
procedure SetCurrent(AMin, AMax, AValue: Integer; isMarquee: Boolean); stdcall;
procedure SetCurrentCaption(const ACaption: PChar); stdcall;
procedure SetCurrentValue(AValue: Integer); stdcall;
procedure SetEventCallBack(const AEventCallBack: IDigIt_ProgressCallback); stdcall;
procedure Show(const ACaption: PChar); stdcall;
procedure Hide; stdcall;
end;
var
DigIt_Progress: TDigIt_Progress;
implementation
{$R *.lfm}
{ TDigIt_Progress }
procedure TDigIt_Progress.FormCreate(Sender: TObject);
begin
curEventCallBack:= nil;
{$ifopt D+}
FormStyle:= fsNormal;
{$endif}
end;
procedure TDigIt_Progress.btCancelClick(Sender: TObject);
begin
if (curEventCallBack <> nil)
then curEventCallBack.ProgressCancelClick(progressTotal.Position, progressCurrent.Position);
end;
procedure TDigIt_Progress.SetTotalVisible(AVisible: Boolean); stdcall;
begin
panelTotal.Visible:= AVisible;
Application.ProcessMessages;
end;
procedure TDigIt_Progress.SetTotalLabel(const ALabel: PChar); stdcall;
begin
labTotal.Caption:= ALabel;
Application.ProcessMessages;
end;
procedure TDigIt_Progress.SetTotal(AMin, AMax, AValue: Integer; isMarquee: Boolean); stdcall;
begin
if isMarquee
then begin
progressTotal.Smooth:= False;
progressTotal.Style:= pbstMarquee;
end
else begin
progressTotal.Smooth:= True;
progressTotal.Style:= pbstNormal;
end;
progressTotal.Min:= AMin;
progressTotal.Max:= AMax;
progressTotal.Position:= AValue;
Application.ProcessMessages;
end;
procedure TDigIt_Progress.SetTotalCaption(const ACaption: PChar); stdcall;
begin
capTotal.Caption:= ACaption;
Application.ProcessMessages;
end;
procedure TDigIt_Progress.SetTotalValue(AValue: Integer); stdcall;
begin
progressTotal.Position:= AValue;
Application.ProcessMessages;
end;
procedure TDigIt_Progress.SetCurrentVisible(AVisible: Boolean); stdcall;
begin
panelCurrent.Visible:= AVisible;
Application.ProcessMessages;
end;
procedure TDigIt_Progress.SetCurrent(AMin, AMax, AValue: Integer; isMarquee: Boolean); stdcall;
begin
if isMarquee
then begin
progressCurrent.Smooth:= False;
progressCurrent.Style:= pbstMarquee;
end
else begin
progressCurrent.Smooth:= True;
progressCurrent.Style:= pbstNormal;
end;
progressCurrent.Min:= AMin;
progressCurrent.Max:= AMax;
progressCurrent.Position:= AValue;
Application.ProcessMessages;
end;
procedure TDigIt_Progress.SetCurrentCaption(const ACaption: PChar); stdcall;
begin
capCurrent.Caption:= ACaption;
Application.ProcessMessages;
end;
procedure TDigIt_Progress.SetCurrentValue(AValue: Integer); stdcall;
begin
progressCurrent.Position:= AValue;
Application.ProcessMessages;
end;
procedure TDigIt_Progress.SetEventCallBack(const AEventCallBack: IDigIt_ProgressCallback); stdcall;
begin
curEventCallBack:= AEventCallBack;
end;
procedure TDigIt_Progress.Show(const ACaption: PChar); stdcall;
begin
Caption:= ACaption;
Visible:= True;
Application.ProcessMessages;
end;
procedure TDigIt_Progress.Hide; stdcall;
begin
Visible:= False;
Application.ProcessMessages;
end;
end.