Ignore:
Timestamp:
May 8, 2013, 1:52:33 PM (12 years ago)
Author:
chronos
Message:
  • Added: Support for mouse move handling. Now forms can be moved by dragging title bar.
  • Fixed: Clearing background during painting in screen and forms.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Xvcl/Xvcl.Classes.pas

    r20 r23  
    1111    function Substract(Point: TPoint): TPoint;
    1212    function IsZero: Boolean;
     13    class operator Add(A, B: TPoint): TPoint;
     14    class operator Subtract(A, B: TPoint): TPoint;
    1315  end;
    1416
     
    5759  TNotifyEvent = procedure (Sender: TObject) of object;
    5860
     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
    5972
    6073implementation
     
    157170end;
    158171
     172class operator TPoint.Add(A, B: TPoint): TPoint;
     173begin
     174  Result.X := A.X + B.X;
     175  Result.Y := A.Y + B.Y;
     176end;
     177
    159178constructor TPoint.Create(X, Y: Integer);
    160179begin
     
    169188end;
    170189
     190class operator TPoint.Subtract(A, B: TPoint): TPoint;
     191begin
     192  Result.X := A.X - B.X;
     193  Result.Y := A.Y - B.Y;
     194end;
     195
    171196function TPoint.Substract(Point: TPoint): TPoint;
    172197begin
     
    174199end;
    175200
     201{ TUpdateLock }
     202
     203procedure TUpdateLock.Start;
     204begin
     205  Inc(Counter);
     206end;
     207
     208procedure TUpdateLock.Stop;
     209begin
     210  if Counter > 0 then begin
     211    Dec(Counter);
     212    Update;
     213  end;
     214end;
     215
     216procedure TUpdateLock.Update;
     217begin
     218  if (Counter = 0) and Assigned(FOnUpdate) then
     219    FOnUpdate(Self);
     220end;
     221
    176222end.
Note: See TracChangeset for help on using the changeset viewer.