Changeset 23 for branches/Xvcl/Xvcl.Classes.pas
- Timestamp:
- May 8, 2013, 1:52:33 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Xvcl/Xvcl.Classes.pas
r20 r23 11 11 function Substract(Point: TPoint): TPoint; 12 12 function IsZero: Boolean; 13 class operator Add(A, B: TPoint): TPoint; 14 class operator Subtract(A, B: TPoint): TPoint; 13 15 end; 14 16 … … 57 59 TNotifyEvent = procedure (Sender: TObject) of object; 58 60 61 TUpdateLock = class 62 private 63 FOnUpdate: TNotifyEvent; 64 published 65 Counter: Integer; 66 procedure Start; 67 procedure Stop; 68 procedure Update; 69 property OnUpdate: TNotifyEvent read FOnUpdate write FOnUpdate; 70 end; 71 59 72 60 73 implementation … … 157 170 end; 158 171 172 class operator TPoint.Add(A, B: TPoint): TPoint; 173 begin 174 Result.X := A.X + B.X; 175 Result.Y := A.Y + B.Y; 176 end; 177 159 178 constructor TPoint.Create(X, Y: Integer); 160 179 begin … … 169 188 end; 170 189 190 class operator TPoint.Subtract(A, B: TPoint): TPoint; 191 begin 192 Result.X := A.X - B.X; 193 Result.Y := A.Y - B.Y; 194 end; 195 171 196 function TPoint.Substract(Point: TPoint): TPoint; 172 197 begin … … 174 199 end; 175 200 201 { TUpdateLock } 202 203 procedure TUpdateLock.Start; 204 begin 205 Inc(Counter); 206 end; 207 208 procedure TUpdateLock.Stop; 209 begin 210 if Counter > 0 then begin 211 Dec(Counter); 212 Update; 213 end; 214 end; 215 216 procedure TUpdateLock.Update; 217 begin 218 if (Counter = 0) and Assigned(FOnUpdate) then 219 FOnUpdate(Self); 220 end; 221 176 222 end.
Note:
See TracChangeset
for help on using the changeset viewer.