-
Notifications
You must be signed in to change notification settings - Fork 0
/
SAVECONF.PAS
105 lines (92 loc) · 2.05 KB
/
SAVECONF.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
{$I COMPILER.INC}
unit SaveConf;
interface
uses
AplObj,
AplConst,
AplTypes,
Controls,
Lists,
Veridian,
ListView,
Views,
VeriType,
Drawing,
Dialogs;
type
PSaveConfirmDialog = ^TSaveConfirmDialog;
TSaveConfirmDialog = object(TDialog)
private
public
FileListView: PCheckListView;
Windows: PControlList;
constructor Create(var AWindows: PControlList);
function Execute: TModalResult; virtual;
procedure Init; virtual;
procedure AfterShow; virtual;
procedure Layout; virtual;
destructor Free; virtual;
end;
implementation
uses
FontWind;
constructor TSaveConfirmDialog.Create(var AWindows: PControlList);
var
index: integer;
begin
Windows := AWindows;
inherited Create('', 'Save Changes', [mbYes, mbNo, mbCancel]);
end;
function TSaveConfirmDialog.Execute: TModalResult;
begin
Execute := ShowDialog;
end;
procedure TSaveConfirmDialog.Init;
var
index: integer;
window: PFontWindow;
item: PCheckListItem;
begin
inherited Init;
VeridianApp^.DisableDrawing;
FileListView := New(PCheckListView, CreateParent('FileListBox', @self));
FileListView^.Padding.CreateValue(3);
FileListView^.ScrollType := scAsNeeded;
ButtonAlign := haCenter;
for index := 0 to Windows^.Count - 1 do begin
window := PFontWindow(Windows^.GetItem(index));
item := FileListView^.AddItemValue(window^.CurrentFont^.GetId, window);
item^.SetChecked(true);
end;
FileListView^.SetSelectedIndex(0);
VeridianApp^.EnableDrawing;
Include(WindowOptions, woResizeable);
Width := 250;
Height := 150;
end;
procedure TSaveConfirmDialog.AfterShow;
begin
inherited AfterShow;
FileListView^.TabOrder := 0;
SetButtonTabOrders(1);
end;
procedure TSaveConfirmDialog.Layout;
var
rect, buttonRect: TRect;
begin
inherited Layout;
GetContentRect(rect);
GetButtonArea(buttonRect);
FileListView^.Position := rpParentContent;
FileListView^.SetBounds(
0,
0,
rect.Width,
rect.Height - buttonRect.Height - Padding.Bottom
);
end;
destructor TSaveConfirmDialog.Free;
begin
inherited Free;
end;
end.