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: StNVColl.pas 4.04 *}
|
30 |
{*********************************************************}
|
31 |
{* SysTools: non visual component for TStCollection *}
|
32 |
{*********************************************************}
|
33 |
|
34 |
{$I StDefine.inc}
|
35 |
|
36 |
unit StNVColl;
|
37 |
|
38 |
interface
|
39 |
|
40 |
uses
|
41 |
Windows, Classes,
|
42 |
StBase, StColl, StNVCont;
|
43 |
|
44 |
type
|
45 |
TStNVCollection = class(TStNVContainerBase)
|
46 |
{.Z+}
|
47 |
protected {private}
|
48 |
{property variables}
|
49 |
FContainer : TStCollection; {instance of the container}
|
50 |
FPageElements : Integer;
|
51 |
|
52 |
{property methods}
|
53 |
procedure SetPageElements(Value : Integer);
|
54 |
|
55 |
{internal methods}
|
56 |
procedure RecreateContainer;
|
57 |
|
58 |
protected
|
59 |
function GetOnCompare : TStCompareEvent;
|
60 |
override;
|
61 |
function GetOnDisposeData : TStDisposeDataEvent;
|
62 |
override;
|
63 |
function GetOnLoadData : TStLoadDataEvent;
|
64 |
override;
|
65 |
function GetOnStoreData : TStStoreDataEvent;
|
66 |
override;
|
67 |
procedure SetOnCompare(Value : TStCompareEvent);
|
68 |
override;
|
69 |
procedure SetOnDisposeData(Value : TStDisposeDataEvent);
|
70 |
override;
|
71 |
procedure SetOnLoadData(Value : TStLoadDataEvent);
|
72 |
override;
|
73 |
procedure SetOnStoreData(Value : TStStoreDataEvent);
|
74 |
override;
|
75 |
|
76 |
public
|
77 |
constructor Create(AOwner : TComponent);
|
78 |
override;
|
79 |
destructor Destroy;
|
80 |
override;
|
81 |
{.Z-}
|
82 |
|
83 |
property Container : TStCollection
|
84 |
read FContainer;
|
85 |
|
86 |
published
|
87 |
property PageElements : Integer
|
88 |
read FPageElements
|
89 |
write SetPageElements default 1000;
|
90 |
|
91 |
property OnCompare;
|
92 |
property OnDisposeData;
|
93 |
property OnLoadData;
|
94 |
property OnStoreData;
|
95 |
end;
|
96 |
|
97 |
|
98 |
implementation
|
99 |
|
100 |
{*** TStNVCollection ***}
|
101 |
|
102 |
constructor TStNVCollection.Create(AOwner : TComponent);
|
103 |
begin
|
104 |
inherited Create(AOwner);
|
105 |
|
106 |
{defaults}
|
107 |
FPageElements := 1000;
|
108 |
|
109 |
if Classes.GetClass(TStCollection.ClassName) = nil then
|
110 |
RegisterClass(TStCollection);
|
111 |
|
112 |
FContainer := TStCollection.Create(FPageElements);
|
113 |
end;
|
114 |
|
115 |
destructor TStNVCollection.Destroy;
|
116 |
begin
|
117 |
FContainer.Free;
|
118 |
FContainer := nil;
|
119 |
|
120 |
inherited Destroy;
|
121 |
end;
|
122 |
|
123 |
function TStNVCollection.GetOnCompare : TStCompareEvent;
|
124 |
begin
|
125 |
Result := FContainer.OnCompare;
|
126 |
end;
|
127 |
|
128 |
function TStNVCollection.GetOnDisposeData : TStDisposeDataEvent;
|
129 |
begin
|
130 |
Result := FContainer.OnDisposeData;
|
131 |
end;
|
132 |
|
133 |
function TStNVCollection.GetOnLoadData : TStLoadDataEvent;
|
134 |
begin
|
135 |
Result := FContainer.OnLoadData;
|
136 |
end;
|
137 |
|
138 |
function TStNVCollection.GetOnStoreData : TStStoreDataEvent;
|
139 |
begin
|
140 |
Result := FContainer.OnStoreData;
|
141 |
end;
|
142 |
|
143 |
procedure TStNVCollection.RecreateContainer;
|
144 |
var
|
145 |
HoldOnCompare : TStCompareEvent;
|
146 |
HoldOnDisposeData : TStDisposeDataEvent;
|
147 |
HoldOnLoadData : TStLoadDataEvent;
|
148 |
HoldOnStoreData : TStStoreDataEvent;
|
149 |
begin
|
150 |
HoldOnCompare := FContainer.OnCompare;
|
151 |
HoldOnDisposeData := FContainer.OnDisposeData;
|
152 |
HoldOnLoadData := FContainer.OnLoadData;
|
153 |
HoldOnStoreData := FContainer.OnStoreData;
|
154 |
FContainer.Free;
|
155 |
FContainer := TStCollection.Create(FPageElements);
|
156 |
FContainer.OnCompare := HoldOnCompare;
|
157 |
FContainer.OnDisposeData := HoldOnDisposeData;
|
158 |
FContainer.OnLoadData := HoldOnLoadData;
|
159 |
FContainer.OnStoreData := HoldOnStoreData;
|
160 |
end;
|
161 |
|
162 |
procedure TStNVCollection.SetOnCompare(Value : TStCompareEvent);
|
163 |
begin
|
164 |
FContainer.OnCompare := Value;
|
165 |
end;
|
166 |
|
167 |
procedure TStNVCollection.SetOnDisposeData(Value : TStDisposeDataEvent);
|
168 |
begin
|
169 |
FContainer.OnDisposeData := Value;
|
170 |
end;
|
171 |
|
172 |
procedure TStNVCollection.SetOnLoadData(Value : TStLoadDataEvent);
|
173 |
begin
|
174 |
FContainer.OnLoadData := Value;
|
175 |
end;
|
176 |
|
177 |
procedure TStNVCollection.SetOnStoreData(Value : TStStoreDataEvent);
|
178 |
begin
|
179 |
FContainer.OnStoreData := Value;
|
180 |
end;
|
181 |
|
182 |
procedure TStNVCollection.SetPageElements(Value : Integer);
|
183 |
begin
|
184 |
FPageElements := Value;
|
185 |
RecreateContainer;
|
186 |
end;
|
187 |
|
188 |
|
189 |
end.
|