Changeset 244 for Docking/CoolDocking/Common/URectangle.pas
- Timestamp:
- May 19, 2011, 3:14:19 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Docking/CoolDocking/Common/URectangle.pas
r213 r244 18 18 function GetBottomRight: TPoint; 19 19 function GetHeight: Integer; 20 function GetSize: TPoint; 20 21 function GetTopLeft: TPoint; 21 22 function GetTopRight: TPoint; 22 23 function GetTRect: TRect; 23 24 function GetWidth: Integer; 25 procedure SetBottom(const AValue: Integer); 24 26 procedure SetBottomLeft(const AValue: TPoint); 25 27 procedure SetBottomRight(const AValue: TPoint); 26 28 procedure SetHeight(const AValue: Integer); 29 procedure SetLeft(const AValue: Integer); 30 procedure SetRight(const AValue: Integer); 31 procedure SetSize(const AValue: TPoint); 32 procedure SetTop(const AValue: Integer); 27 33 procedure SetTopLeft(const AValue: TPoint); 28 34 procedure SetTopRight(const AValue: TPoint); … … 30 36 procedure SetWidth(const AValue: Integer); 31 37 public 32 Left: Integer; 33 Top: Integer; 34 Right: Integer; 35 Bottom: Integer; 38 FLeft: Integer; 39 FTop: Integer; 40 FRight: Integer; 41 FBottom: Integer; 42 KeepSize: Boolean; 43 44 property Left: Integer read FLeft write SetLeft; 45 property Top: Integer read FTop write SetTop; 46 property Right: Integer read FRight write SetRight; 47 property Bottom: Integer read FBottom write SetBottom; 36 48 37 49 procedure Assign(Source: TRectangle); … … 46 58 property BottomRight: TPoint read GetBottomRight write SetBottomRight; 47 59 60 property Size: TPoint read GetSize write SetSize; 61 48 62 property AsTRect: TRect read GetTRect write SetTRect; 49 63 end; … … 68 82 begin 69 83 Result := Bottom - Top; 84 end; 85 86 function TRectangle.GetSize: TPoint; 87 begin 88 Result := Point(Width, Height); 70 89 end; 71 90 … … 95 114 end; 96 115 116 procedure TRectangle.SetBottom(const AValue: Integer); 117 begin 118 if FBottom = AValue then exit; 119 if KeepSize then Inc(FTop, AValue - FBottom); 120 FBottom := AValue; 121 end; 122 97 123 procedure TRectangle.SetBottomLeft(const AValue: TPoint); 98 124 begin … … 110 136 begin 111 137 Bottom := Top + AValue; 138 end; 139 140 procedure TRectangle.SetLeft(const AValue: Integer); 141 begin 142 if FLeft = AValue then Exit; 143 if KeepSize then Inc(FRight, AValue - FLeft); 144 FLeft := AValue; 145 end; 146 147 procedure TRectangle.SetRight(const AValue: Integer); 148 begin 149 if FRight = AValue then Exit; 150 if KeepSize then Inc(FLeft, AValue - FRight); 151 FRight := AValue; 152 end; 153 154 procedure TRectangle.SetSize(const AValue: TPoint); 155 begin 156 Width := AValue.X; 157 Height := AValue.Y; 158 end; 159 160 procedure TRectangle.SetTop(const AValue: Integer); 161 begin 162 if FTop = AValue then Exit; 163 if KeepSize then Inc(FBottom, AValue - FTop); 164 FTop := AValue; 112 165 end; 113 166
Note:
See TracChangeset
for help on using the changeset viewer.