Ignore:
Timestamp:
May 19, 2011, 3:14:19 PM (13 years ago)
Author:
george
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Docking/CoolDocking/Common/URectangle.pas

    r213 r244  
    1818    function GetBottomRight: TPoint;
    1919    function GetHeight: Integer;
     20    function GetSize: TPoint;
    2021    function GetTopLeft: TPoint;
    2122    function GetTopRight: TPoint;
    2223    function GetTRect: TRect;
    2324    function GetWidth: Integer;
     25    procedure SetBottom(const AValue: Integer);
    2426    procedure SetBottomLeft(const AValue: TPoint);
    2527    procedure SetBottomRight(const AValue: TPoint);
    2628    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);
    2733    procedure SetTopLeft(const AValue: TPoint);
    2834    procedure SetTopRight(const AValue: TPoint);
     
    3036    procedure SetWidth(const AValue: Integer);
    3137  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;
    3648
    3749    procedure Assign(Source: TRectangle);
     
    4658    property BottomRight: TPoint read GetBottomRight write SetBottomRight;
    4759
     60    property Size: TPoint read GetSize write SetSize;
     61
    4862    property AsTRect: TRect read GetTRect write SetTRect;
    4963  end;
     
    6882begin
    6983  Result := Bottom - Top;
     84end;
     85
     86function TRectangle.GetSize: TPoint;
     87begin
     88  Result := Point(Width, Height);
    7089end;
    7190
     
    95114end;
    96115
     116procedure TRectangle.SetBottom(const AValue: Integer);
     117begin
     118  if FBottom = AValue then exit;
     119  if KeepSize then Inc(FTop, AValue - FBottom);
     120  FBottom := AValue;
     121end;
     122
    97123procedure TRectangle.SetBottomLeft(const AValue: TPoint);
    98124begin
     
    110136begin
    111137  Bottom := Top + AValue;
     138end;
     139
     140procedure TRectangle.SetLeft(const AValue: Integer);
     141begin
     142  if FLeft = AValue then Exit;
     143  if KeepSize then Inc(FRight, AValue - FLeft);
     144  FLeft := AValue;
     145end;
     146
     147procedure TRectangle.SetRight(const AValue: Integer);
     148begin
     149  if FRight = AValue then Exit;
     150  if KeepSize then Inc(FLeft, AValue - FRight);
     151  FRight := AValue;
     152end;
     153
     154procedure TRectangle.SetSize(const AValue: TPoint);
     155begin
     156  Width := AValue.X;
     157  Height := AValue.Y;
     158end;
     159
     160procedure TRectangle.SetTop(const AValue: Integer);
     161begin
     162  if FTop = AValue then Exit;
     163  if KeepSize then Inc(FBottom, AValue - FTop);
     164  FTop := AValue;
    112165end;
    113166
Note: See TracChangeset for help on using the changeset viewer.