/[projects]/dao/DelphiScanner/Components/tpsystools_4.04/source/StNVSCol.pas
ViewVC logotype

Contents of /dao/DelphiScanner/Components/tpsystools_4.04/source/StNVSCol.pas

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2671 - (show annotations) (download)
Tue Aug 25 18:15:15 2015 UTC (8 years, 9 months ago) by torben
File size: 5402 byte(s)
Added tpsystools component
1 // Upgraded to Delphi 2009: Sebastian Zierer
2
3 (* ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * The Original Code is TurboPower SysTools
17 *
18 * The Initial Developer of the Original Code is
19 * TurboPower Software
20 *
21 * Portions created by the Initial Developer are Copyright (C) 1996-2002
22 * the Initial Developer. All Rights Reserved.
23 *
24 * Contributor(s):
25 *
26 * ***** END LICENSE BLOCK ***** *)
27
28 {*********************************************************}
29 {* SysTools: StNVSCol.pas 4.04 *}
30 {*********************************************************}
31 {* SysTools: non visual component for TStSortedCollection*}
32 {*********************************************************}
33
34 {$I StDefine.inc}
35
36 unit StNVSCol;
37
38 interface
39
40 uses
41 Windows, Classes,
42 StBase, StColl, StNVCont;
43
44 type
45 TStNVSortedCollection = class(TStNVContainerBase)
46 {.Z+}
47 protected {private}
48 {property variables}
49 FContainer : TStSortedCollection; {instance of the container}
50 FDuplicates : Boolean;
51 FPageElements : Integer;
52
53 {property methods}
54 procedure SetDuplicates(Value : Boolean);
55 procedure SetPageElements(Value : Integer);
56
57 {internal methods}
58 procedure RecreateContainer;
59
60 protected
61 function GetOnCompare : TStCompareEvent;
62 override;
63 function GetOnDisposeData : TStDisposeDataEvent;
64 override;
65 function GetOnLoadData : TStLoadDataEvent;
66 override;
67 function GetOnStoreData : TStStoreDataEvent;
68 override;
69 procedure SetOnCompare(Value : TStCompareEvent);
70 override;
71 procedure SetOnDisposeData(Value : TStDisposeDataEvent);
72 override;
73 procedure SetOnLoadData(Value : TStLoadDataEvent);
74 override;
75 procedure SetOnStoreData(Value : TStStoreDataEvent);
76 override;
77
78 public
79 constructor Create(AOwner : TComponent);
80 override;
81 destructor Destroy;
82 override;
83 {.Z-}
84
85 property Container : TStSortedCollection
86 read FContainer;
87
88 published
89 property Duplicates : Boolean
90 read FDuplicates
91 write SetDuplicates default False;
92
93 property PageElements : Integer
94 read FPageElements
95 write SetPageElements default 1000;
96
97 property OnCompare;
98 property OnDisposeData;
99 property OnLoadData;
100 property OnStoreData;
101 end;
102
103
104 implementation
105
106 {*** TStNVSortedCollection ***}
107
108 constructor TStNVSortedCollection.Create(AOwner : TComponent);
109 begin
110 inherited Create(AOwner);
111
112 {defaults}
113 FPageElements := 1000;
114 FDuplicates := False;
115
116 if Classes.GetClass(TStSortedCollection.ClassName) = nil then
117 RegisterClass(TStSortedCollection);
118
119 FContainer := TStSortedCollection.Create(FPageElements);
120 end;
121
122 destructor TStNVSortedCollection.Destroy;
123 begin
124 FContainer.Free;
125 FContainer := nil;
126
127 inherited Destroy;
128 end;
129
130 function TStNVSortedCollection.GetOnCompare : TStCompareEvent;
131 begin
132 Result := FContainer.OnCompare;
133 end;
134
135 function TStNVSortedCollection.GetOnDisposeData : TStDisposeDataEvent;
136 begin
137 Result := FContainer.OnDisposeData;
138 end;
139
140 function TStNVSortedCollection.GetOnLoadData : TStLoadDataEvent;
141 begin
142 Result := FContainer.OnLoadData;
143 end;
144
145 function TStNVSortedCollection.GetOnStoreData : TStStoreDataEvent;
146 begin
147 Result := FContainer.OnStoreData;
148 end;
149
150 procedure TStNVSortedCollection.RecreateContainer;
151 var
152 HoldOnCompare : TStCompareEvent;
153 HoldOnDisposeData : TStDisposeDataEvent;
154 HoldOnLoadData : TStLoadDataEvent;
155 HoldOnStoreData : TStStoreDataEvent;
156 begin
157 HoldOnCompare := FContainer.OnCompare;
158 HoldOnDisposeData := FContainer.OnDisposeData;
159 HoldOnLoadData := FContainer.OnLoadData;
160 HoldOnStoreData := FContainer.OnStoreData;
161 FContainer.Free;
162 FContainer := TStSortedCollection.Create(FPageElements);
163 FContainer.OnCompare := HoldOnCompare;
164 FContainer.OnDisposeData := HoldOnDisposeData;
165 FContainer.OnLoadData := HoldOnLoadData;
166 FContainer.OnStoreData := HoldOnStoreData;
167 end;
168
169 procedure TStNVSortedCollection.SetOnCompare(Value : TStCompareEvent);
170 begin
171 FContainer.OnCompare := Value;
172 end;
173
174 procedure TStNVSortedCollection.SetOnDisposeData(Value : TStDisposeDataEvent);
175 begin
176 FContainer.OnDisposeData := Value;
177 end;
178
179 procedure TStNVSortedCollection.SetOnLoadData(Value : TStLoadDataEvent);
180 begin
181 FContainer.OnLoadData := Value;
182 end;
183
184 procedure TStNVSortedCollection.SetOnStoreData(Value : TStStoreDataEvent);
185 begin
186 FContainer.OnStoreData := Value;
187 end;
188
189 procedure TStNVSortedCollection.SetDuplicates(Value : Boolean);
190 begin
191 FDuplicates := Value;
192 FContainer.Duplicates := FDuplicates;
193 end;
194
195 procedure TStNVSortedCollection.SetPageElements(Value : Integer);
196 begin
197 FPageElements := Value;
198 RecreateContainer;
199 FContainer.Duplicates := FDuplicates;
200 end;
201
202
203 end.

  ViewVC Help
Powered by ViewVC 1.1.20