forked from unxed/dn2l
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_dialogs.pas
653 lines (560 loc) · 18.2 KB
/
_dialogs.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
unit _Dialogs;
(******
DN/2 Plugin Interface - object model
Copyright (C) 2002 Aleksej Kozlov (Cat)
2:5030/1326.13
******)
{&Delphi+}
{&Use32+}
interface
uses
_Defines, _Streams, _Collect, _Views
;
type
PDialog = ^TDialog;
TDialog = object(TWindow)
DirectLink: array [1..9] of PView;
constructor Init(var Bounds: TRect; const ATitle: String);
constructor Load(var S: TStream);
{function GetPalette: PPalette; virtual;}
{procedure HandleEvent(var Event: TEvent); virtual;}
{function Valid(Command: Word): Boolean; virtual;}
procedure Store(var S: TStream);
end;
PInputline = ^TInputLine;
TInputLine = object(TView)
Data: AnsiString;
MaxLen: LongInt;
CurPos: LongInt;
FirstPos: LongInt;
SelStart: LongInt;
SelEnd: LongInt;
Validator: Pointer {PValidator};
LC, RC: Char;
C: array [1..4] of Byte;
constructor Init(var Bounds: TRect; AMaxLen: LongInt);
constructor Load(var S: TStream);
{destructor Done; virtual;}
{function DataSize: Word; virtual;}
{procedure Draw; virtual;}
{procedure GetData(var Rec); virtual;}
{function GetPalette: PPalette; virtual;}
{procedure HandleEvent(var Event: TEvent); virtual;}
procedure SelectAll(Enable: Boolean);
{procedure SetData(var Rec); virtual;}
{procedure SetState(AState: Word; Enable: Boolean); virtual;}
procedure SetValidator(AValid: Pointer {PValidator});
procedure Store(var S: TStream);
{function Valid(Command: Word): Boolean; virtual;}
function CanScroll(Delta: Integer): Boolean;
end;
PButton = ^TButton;
TButton = object(TView)
Title: PString;
Command: AWord;
Flags: Byte;
AmDefault: Boolean;
constructor Init(var Bounds: TRect; const ATitle: String;
ACommand: Word; AFlags: Word);
constructor Load(var S: TStream);
{destructor Done; virtual;}
{procedure Draw; virtual;}
procedure DrawState(Down: Boolean);
{function GetPalette: PPalette; virtual;}
{procedure HandleEvent(var Event: TEvent); virtual;}
procedure MakeDefault(Enable: Boolean);
procedure Press; virtual;
{procedure SetState(AState: Word; Enable: Boolean); virtual;}
procedure Store(var S: TStream);
end;
PCluster = ^TCluster;
TCluster = object(TView)
Value: LongInt;
Sel: AInt;
EnableMask: LongInt;
Strings: TStringCollection;
constructor Init(var Bounds: TRect; AStrings: PSItem);
constructor Load(var S: TStream);
{destructor Done; virtual;}
function ButtonState(Item: Integer): Boolean;
{function DataSize: Word; virtual;}
procedure DrawBox(const Icon: String; Marker: Char);
procedure DrawMultiBox(const Icon, Marker: String);
{procedure GetData(var Rec); virtual;}
{function GetHelpCtx: Word; virtual;}
{function GetPalette: PPalette; virtual;}
{procedure HandleEvent(var Event: TEvent); virtual;}
function Mark(Item: Integer): Boolean; virtual;
function MultiMark(Item: Integer): Byte; virtual;
procedure Press(Item: Integer); virtual;
procedure MovedTo(Item: Integer); virtual;
procedure SetButtonState(AMask: LongInt; Enable: Boolean);
{procedure SetData(var Rec); virtual;}
{procedure SetState(AState: Word; Enable: Boolean); virtual;}
procedure Store(var S: TStream);
end;
PRadioButtons = ^TRadioButtons;
TRadioButtons = object(TCluster)
{procedure Draw; virtual;}
{function Mark(Item: Integer): Boolean; virtual;}
{procedure MovedTo(Item: Integer); virtual;}
{procedure Press(Item: Integer); virtual;}
{procedure SetData(var Rec); virtual;}
end;
PCheckBoxes = ^TCheckBoxes;
TCheckBoxes = object(TCluster)
{procedure Draw; virtual;}
{function Mark(Item: Integer): Boolean; virtual;}
{procedure Press(Item: Integer); virtual;}
end;
PMultiCheckBoxes = ^TMultiCheckBoxes;
TMultiCheckBoxes = object(TCluster)
SelRange: Byte;
Flags: AWord;
States: PString;
constructor Init(var Bounds: TRect; AStrings: PSItem;
ASelRange: Byte; AFlags: Word; const AStates: String);
constructor Load(var S: TStream);
{destructor Done; virtual;}
{function DataSize: Word; virtual;}
{procedure Draw; virtual;}
{procedure GetData(var Rec); virtual;}
{function MultiMark(Item: Integer): Byte; virtual;}
{procedure Press(Item: Integer); virtual;}
{procedure SetData(var Rec); virtual;}
procedure Store(var S: TStream);
end;
PScroller = ^TScroller;
TScroller = object(TView)
HScrollBar: PScrollBar;
VScrollBar: PScrollBar;
Delta: TPoint;
Limit: TPoint;
DrawLock: Byte;
DrawFlag: Boolean;
constructor Init(var Bounds: TRect;
AHScrollBar, AVScrollBar: PScrollBar);
constructor Load(var S: TStream);
{procedure ChangeBounds(var Bounds: TRect); virtual;}
{function GetPalette: PPalette; virtual;}
{procedure HandleEvent(var Event: TEvent); virtual;}
procedure ScrollDraw; virtual;
procedure ScrollTo(X, Y: LongInt);
procedure SetLimit(X, Y: LongInt);
{procedure SetState(AState: Word; Enable: Boolean); virtual;}
procedure Store(var S: TStream);
end;
PListViewer = ^TListViewer;
TListViewer = object(TView)
HScrollBar: PScrollBar;
VScrollBar: PScrollBar;
NumCols: LongInt;
TopItem: LongInt;
Focused: LongInt;
Range: LongInt;
constructor Init(var Bounds: TRect; ANumCols: LongInt;
AHScrollBar, AVScrollBar: PScrollBar);
constructor Load(var S: TStream);
{procedure ChangeBounds(var Bounds: TRect); virtual;}
{procedure Draw; virtual;}
procedure FocusItem(Item: LongInt); virtual;
{function GetPalette: PPalette; virtual;}
function GetText(Item: LongInt; MaxLen: Integer): String; virtual;
function IsSelected(Item: LongInt): Boolean; virtual;
{procedure HandleEvent(var Event: TEvent); virtual;}
procedure SelectItem(Item: LongInt); virtual;
procedure SetRange(ARange: LongInt);
{procedure SetState(AState: Word; Enable: Boolean); virtual;}
procedure Store(var S: TStream);
procedure FocusItemNum(Item: LongInt); virtual;
end;
PListBox = ^TListBox;
TListBox = object(TListViewer)
List: PCollection;
constructor Init(var Bounds: TRect; ANumCols: Word;
AScrollBar: PScrollBar);
constructor Load(var S: TStream);
{function DataSize: Word; virtual;}
{procedure GetData(var Rec); virtual;}
{function GetText(Item: LongInt; MaxLen: Integer): String; virtual;}
procedure NewLisT(AList: PCollection); virtual;
{procedure SetData(var Rec); virtual;}
procedure Store(var S: TStream);
end;
PStaticText = ^TStaticText;
TStaticText = object(TView)
Text: PString;
constructor Init(var Bounds: TRect; const AText: String);
constructor Load(var S: TStream);
{destructor Done; virtual;}
{procedure Draw; virtual;}
{function GetPalette: PPalette; virtual;}
procedure GetText(var S: String); virtual;
procedure Store(var S: TStream);
end;
PParamText = ^TParamText;
TParamText = object(TStaticText)
ParamCount: AInt;
ParamList: Pointer;
constructor Init(var Bounds: TRect; const AText: String;
AParamCount: AInt);
constructor Load(var S: TStream);
{function DataSize: Word; virtual;}
{procedure GetText(var S: String); virtual;}
{procedure SetData(var Rec); virtual;}
procedure Store(var S: TStream);
end;
PLabel = ^TLabel;
TLabel = object(TStaticText)
Link: PView;
Light: Boolean;
constructor Init(var Bounds: TRect; const AText: String; ALink: PView);
constructor Load(var S: TStream);
{procedure Draw; virtual;}
{function GetPalette: PPalette; virtual;}
{procedure HandleEvent(var Event: TEvent); virtual;}
procedure Store(var S: TStream);
end;
PHistoryViewer = ^THistoryViewer;
THistoryViewer = object(TListViewer)
HistoryId: AWord;
SearchPos: AWord;
constructor Init(var Bounds: TRect;
AHScrollBar, AVScrollBar: PScrollBar; AHistoryId: AWord);
{function GetPalette: PPalette; virtual;}
{function GetText(Item: LongInt; MaxLen: Integer): String; virtual;}
{procedure HandleEvent(var Event: TEvent); virtual;}
function HistoryWidth: Integer;
end;
PHistoryWindow = ^THistoryWindow;
THistoryWindow = object(TWindow)
Viewer: PListViewer;
constructor Init(var Bounds: TRect; HistoryId: AWord);
{function GetPalette: PPalette; virtual;}
function GetSelection: String; virtual;
procedure InitViewer(HistoryId: AWord); virtual;
end;
PHistory = ^THistory;
THistory = object(TView)
Link: PInputline;
HistoryId: AWord;
constructor Init(var Bounds: TRect; ALink: PInputline;
AHistoryId: AWord);
constructor Load(var S: TStream);
{procedure Draw; virtual;}
{function GetPalette: PPalette; virtual;}
{procedure HandleEvent(var Event: TEvent); virtual;}
function InitHistoryWindow(var Bounds: TRect): PHistoryWindow; virtual;
procedure RecordHistory(const S: String); virtual;
procedure Store(var S: TStream);
end;
PComboBox = ^TComboBox;
TComboBox = object(TView)
(* Selected: Word; // ⥪ã騩 ®¬¥à ¢ ਠâ (㬥à æ¨ï ®â 1)
Count: Word; { ¥ ®âàë¢ âì ®â Selected! ¬. Load,Store}
Menu: PMenu;
Items: array[1..10] of PMenuItem; // ¯àï¬ë¥ áá뫪¨ ¢ ¬¥î
constructor Init(var Bounds: TRect; AStrings: PSItem);
procedure BuildMenu(AStrings: PSItem);
destructor Done; virtual;
procedure SetState(AState: Word; Enable: Boolean); virtual;
procedure Draw; virtual;
procedure HandleEvent(var Event: TEvent); virtual;
function DataSize: Word; virtual;
procedure GetData(var Rec); virtual;
procedure SetData(var Rec); virtual;
constructor Load(var S: TStream);
procedure Store(var S: TStream); *)
end;
implementation
uses
_DNFuncs
;
constructor TDialog.Init(var Bounds: TRect; const ATitle: String);
begin
_TDialog^.Init(Bounds, ATitle, nil, @Self);
end;
constructor TDialog.Load(var S: TStream);
begin
_TDialog^.Load(_Model1.TStream(S), nil, @Self);
end;
procedure TDialog.Store(var S: TStream);
begin
_TDialog^.Store(_Model1.TStream(S), @Self);
end;
constructor TInputLine.Init(var Bounds: TRect; AMaxLen: LongInt);
begin
_TInputLine^.Init(Bounds, AMaxLen, nil, @Self);
end;
constructor TInputLine.Load(var S: TStream);
begin
_TInputLine^.Load(_Model1.TStream(S), nil, @Self);
end;
procedure TInputLine.SelectAll(Enable: Boolean);
begin
_TInputLine^.SelectAll(Enable, @Self);
end;
procedure TInputLine.SetValidator(AValid: Pointer {PValidator});
begin
_TInputLine^.SetValidator(AValid, @Self);
end;
procedure TInputLine.Store(var S: TStream);
begin
_TInputLine^.Store(_Model1.TStream(S), @Self);
end;
function TInputLine.CanScroll(Delta: Integer): Boolean;
begin
Result := _TInputLine^.CanScroll(Delta, @Self);
end;
constructor TButton.Init(var Bounds: TRect; const ATitle: String;
ACommand: Word; AFlags: Word);
begin
_TButton^.Init(Bounds, ATitle, ACommand, AFlags, nil, @Self);
end;
constructor TButton.Load(var S: TStream);
begin
_TButton^.Load(_Model1.TStream(S), nil, @Self);
end;
procedure TButton.DrawState(Down: Boolean);
begin
_TButton^.DrawState(Down, @Self);
end;
procedure TButton.MakeDefault(Enable: Boolean);
begin
_TButton^.MakeDefault(Enable, @Self);
end;
procedure TButton.Press;
assembler; {&Frame-}
asm
end;
procedure TButton.Store(var S: TStream);
begin
_TButton^.Store(_Model1.TStream(S), @Self);
end;
constructor TCluster.Init(var Bounds: TRect; AStrings: PSItem);
begin
_TCluster^.Init(Bounds, AStrings, nil, @Self);
end;
constructor TCluster.Load(var S: TStream);
begin
_TCluster^.Load(_Model1.TStream(S), nil, @Self);
end;
function TCluster.ButtonState(Item: Integer): Boolean;
begin
Result := _TCluster^.ButtonState(Item, @Self);
end;
procedure TCluster.DrawBox(const Icon: String; Marker: Char);
begin
_TCluster^.DrawBox(Icon, Marker, @Self);
end;
procedure TCluster.DrawMultiBox(const Icon, Marker: String);
begin
_TCluster^.DrawMultiBox(Icon, Marker, @Self);
end;
function TCluster.Mark(Item: Integer): Boolean;
assembler; {&Frame-}
asm
end;
function TCluster.MultiMark(Item: Integer): Byte;
assembler; {&Frame-}
asm
end;
procedure TCluster.Press(Item: Integer);
assembler; {&Frame-}
asm
end;
procedure TCluster.MovedTo(Item: Integer);
assembler; {&Frame-}
asm
end;
procedure TCluster.SetButtonState(AMask: LongInt; Enable: Boolean);
begin
_TCluster^.SetButtonState(AMask, Enable, @Self);
end;
procedure TCluster.Store(var S: TStream);
begin
_TCluster^.Store(_Model1.TStream(S), @Self);
end;
constructor TMultiCheckBoxes.Init(var Bounds: TRect; AStrings: PSItem;
ASelRange: Byte; AFlags: Word; const AStates: String);
begin
_TMultiCheckBoxes^.Init(Bounds, AStrings, ASelRange, AFlags, AStates,
nil, @Self);
end;
constructor TMultiCheckBoxes.Load(var S: TStream);
begin
_TMultiCheckBoxes^.Load(_Model1.TStream(S), nil, @Self);
end;
procedure TMultiCheckBoxes.Store(var S: TStream);
begin
_TMultiCheckBoxes^.Store(_Model1.TStream(S), @Self);
end;
constructor TScroller.Init(var Bounds: TRect;
AHScrollBar, AVScrollBar: PScrollBar);
begin
_TScroller^.Init(Bounds, _Model1.PScrollBar(AHScrollBar),
_Model1.PScrollBar(AVScrollBar), nil, @Self);
end;
constructor TScroller.Load(var S: TStream);
begin
_TScroller^.Load(_Model1.TStream(S), nil, @Self);
end;
procedure TScroller.ScrollDraw;
assembler; {&Frame-}
asm
end;
procedure TScroller.ScrollTo(X, Y: LongInt);
begin
_TScroller^.ScrollTo(X, Y, @Self);
end;
procedure TScroller.SetLimit(X, Y: LongInt);
begin
_TScroller^.SetLimit(X, Y, @Self);
end;
procedure TScroller.Store(var S: TStream);
begin
_TScroller^.Store(_Model1.TStream(S), @Self);
end;
constructor TListViewer.Init(var Bounds: TRect; ANumCols: LongInt;
AHScrollBar, AVScrollBar: PScrollBar);
begin
_TListViewer^.Init(Bounds, ANumCols, _Model1.PScrollBar(AHScrollBar),
_Model1.PScrollBar(AVScrollBar), nil, @Self);
end;
constructor TListViewer.Load(var S: TStream);
begin
_TListViewer^.Load(_Model1.TStream(S), nil, @Self);
end;
procedure TListViewer.FocusItem(Item: LongInt);
assembler; {&Frame-}
asm
end;
function TListViewer.GetText(Item: LongInt; MaxLen: Integer): String;
assembler; {&Frame-}
asm
end;
function TListViewer.IsSelected(Item: LongInt): Boolean;
assembler; {&Frame-}
asm
end;
procedure TListViewer.SelectItem(Item: LongInt);
assembler; {&Frame-}
asm
end;
procedure TListViewer.SetRange(ARange: LongInt);
begin
_TListViewer^.SetRange(ARange, @Self);
end;
procedure TListViewer.Store(var S: TStream);
begin
_TListViewer^.Store(_Model1.TStream(S), @Self);
end;
procedure TListViewer.FocusItemNum(Item: LongInt);
assembler; {&Frame-}
asm
end;
constructor TListBox.Init(var Bounds: TRect; ANumCols: Word;
AScrollBar: PScrollBar);
begin
_TListBox^.Init(Bounds, ANumCols, _Model1.PScrollBar(AScrollBar), nil,
@Self);
end;
constructor TListBox.Load(var S: TStream);
begin
_TListBox^.Load(_Model1.TStream(S), nil, @Self);
end;
procedure TListBox.NewLisT(AList: PCollection);
assembler; {&Frame-}
asm
end;
procedure TListBox.Store(var S: TStream);
begin
_TListBox^.Store(_Model1.TStream(S), @Self);
end;
constructor TStaticText.Init(var Bounds: TRect; const AText: String);
begin
_TStaticText^.Init(Bounds, AText, nil, @Self);
end;
constructor TStaticText.Load(var S: TStream);
begin
_TStaticText^.Load(_Model1.TStream(S), nil, @Self);
end;
procedure TStaticText.GetText(var S: String);
assembler; {&Frame-}
asm
end;
procedure TStaticText.Store(var S: TStream);
begin
_TStaticText^.Store(_Model1.TStream(S), @Self);
end;
constructor TParamText.Init(var Bounds: TRect; const AText: String;
AParamCount: AInt);
begin
_TParamText^.Init(Bounds, AText, AParamCount, nil, @Self);
end;
constructor TParamText.Load(var S: TStream);
begin
_TParamText^.Load(_Model1.TStream(S), nil, @Self);
end;
procedure TParamText.Store(var S: TStream);
begin
_TParamText^.Store(_Model1.TStream(S), @Self);
end;
constructor TLabel.Init(var Bounds: TRect; const AText: String;
ALink: PView);
begin
_TLabel^.Init(Bounds, AText, _Model1.PView(ALink), nil, @Self);
end;
constructor TLabel.Load(var S: TStream);
begin
_TLabel^.Load(_Model1.TStream(S), nil, @Self);
end;
procedure TLabel.Store(var S: TStream);
begin
_TLabel^.Store(_Model1.TStream(S), @Self);
end;
constructor THistoryViewer.Init(var Bounds: TRect;
AHScrollBar, AVScrollBar: PScrollBar; AHistoryId: AWord);
begin
_THistoryViewer^.Init(Bounds, _Model1.PScrollBar(AHScrollBar),
_Model1.PScrollBar(AVScrollBar), AHistoryId, nil, @Self);
end;
function THistoryViewer.HistoryWidth: Integer;
begin
Result := _THistoryViewer^.HistoryWidth(@Self);
end;
constructor THistoryWindow.Init(var Bounds: TRect; HistoryId: AWord);
begin
_THistoryWindow^.Init(Bounds, HistoryId, nil, @Self);
end;
function THistoryWindow.GetSelection: String;
assembler; {&Frame-}
asm
end;
procedure THistoryWindow.InitViewer(HistoryId: AWord);
assembler; {&Frame-}
asm
end;
constructor THistory.Init(var Bounds: TRect; ALink: PInputline;
AHistoryId: AWord);
begin
_THistory^.Init(Bounds, _Model1.PInputline(ALink), AHistoryId, nil,
@Self);
end;
constructor THistory.Load(var S: TStream);
begin
_THistory^.Load(_Model1.TStream(S), nil, @Self);
end;
function THistory.InitHistoryWindow(var Bounds: TRect): PHistoryWindow;
assembler; {&Frame-}
asm
end;
procedure THistory.RecordHistory(const S: String);
assembler; {&Frame-}
asm
end;
procedure THistory.Store(var S: TStream);
begin
_THistory^.Store(_Model1.TStream(S), @Self);
end;
end.