| 1 | unit SpecializedRectangle;
|
|---|
| 2 |
|
|---|
| 3 | {$mode Delphi}{$H+}
|
|---|
| 4 |
|
|---|
| 5 | interface
|
|---|
| 6 |
|
|---|
| 7 | uses
|
|---|
| 8 | Classes, SysUtils, SpecializedPoint, Types;
|
|---|
| 9 |
|
|---|
| 10 | type
|
|---|
| 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 |
|
|---|
| 34 | implementation
|
|---|
| 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 |
|
|---|
| 46 | function TRectangle.GetTRect: TRect;
|
|---|
| 47 | begin
|
|---|
| 48 | Result.Left := Left;
|
|---|
| 49 | Result.Top := Top;
|
|---|
| 50 | Result.Bottom := Bottom;
|
|---|
| 51 | Result.Right := Right;
|
|---|
| 52 | end;
|
|---|
| 53 |
|
|---|
| 54 | procedure TRectangle.SetTRect(const AValue: TRect);
|
|---|
| 55 | begin
|
|---|
| 56 | Left := AValue.Left;
|
|---|
| 57 | Top := AValue.Top;
|
|---|
| 58 | Bottom := AValue.Bottom;
|
|---|
| 59 | Right := AValue.Right;
|
|---|
| 60 | end;
|
|---|
| 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 |
|
|---|
| 69 | end.
|
|---|
| 70 |
|
|---|