source: trunk/Demo/Packages/TemplateGenerics/Specialized/SpecializedRectangle.pas

Last change on this file was 60, checked in by chronos, 12 years ago
File size: 1.6 KB
Line 
1unit SpecializedRectangle;
2
3{$mode Delphi}{$H+}
4
5interface
6
7uses
8 Classes, SysUtils, SpecializedPoint, Types;
9
10type
11{$MACRO ON}
12
13// TRectangle = TGRectangle<Integer>
14{$DEFINE TGRectangleDimension := Integer}
15{$DEFINE TGRectangle := TBaseRectangle}
16{$DEFINE TGRectanglePoint := TPoint}
17{$DEFINE INTERFACE}
18{$I 'GenericRectangle.inc'}
19 TRectangle = class(TBaseRectangle)
20 private
21 procedure SetTRect(const AValue: TRect);
22 function GetTRect: TRect;
23 public
24 property AsTRect: TRect read GetTRect write SetTRect;
25 end;
26
27// TRectangleDouble = TGRectangle<Double>
28{$DEFINE TGRectangleDimension := Double}
29{$DEFINE TGRectangle := TRectangleDouble}
30{$DEFINE TGRectanglePoint := TPointDouble}
31{$DEFINE INTERFACE}
32{$I 'GenericRectangle.inc'}
33
34implementation
35
36{$DEFINE IMPLEMENTATION_USES}
37{$I 'GenericRectangle.inc'}
38
39// TRectangleInteger = TGRectangle<Integer>
40{$DEFINE TGRectangleDimension := Integer}
41{$DEFINE TGRectangle := TBaseRectangle}
42{$DEFINE TGRectanglePoint := TPoint}
43{$DEFINE IMPLEMENTATION}
44{$I 'GenericRectangle.inc'}
45
46function TRectangle.GetTRect: TRect;
47begin
48 Result.Left := Left;
49 Result.Top := Top;
50 Result.Bottom := Bottom;
51 Result.Right := Right;
52end;
53
54procedure TRectangle.SetTRect(const AValue: TRect);
55begin
56 Left := AValue.Left;
57 Top := AValue.Top;
58 Bottom := AValue.Bottom;
59 Right := AValue.Right;
60end;
61
62// TRectangleDouble = TGRectangle<Double>
63{$DEFINE TGRectangleDimension := Double}
64{$DEFINE TGRectangle := TRectangleDouble}
65{$DEFINE TGRectanglePoint := TPointDouble}
66{$DEFINE IMPLEMENTATION}
67{$I 'GenericRectangle.inc'}
68
69end.
70
Note: See TracBrowser for help on using the repository browser.