MouseInCheckBox(Node: PVirtualNode;
  Column: TColumnIndex): Boolean;
var
  LCursorPos: TPoint;
  LHitInfo: THitInfo;
  LRect: TRect;
begin
  if Assigned(Node) and (Column > -1)
    and (Column < FTreeView.Header.Columns.Count)
    and (FTreeView.Header.Columns[Column].Tag > 0) then
  begin
    LCursorPos := FTreeView.ScreenToClient(Mouse.CursorPos);
    FTreeView.GetHitTestInfoAt(LCursorPos.X, LCursorPos.Y, True, LHitInfo);
    LRect := FTreeView.GetDisplayRect(Node, Column, False);
    LRect := CalcCheckBoxRect(LRect);
    Result := PtInRect(LRect, LCursorPos);
  end
  else
    Result := False;
end;

procedure TCheckBoxDecorator.SetTreeView(const Value: TVirtualStringTree);
begin
  if FTreeView <> Value then
  begin
    if Assigned(FTreeView) then
    begin
      FTreeView.OnAfterCellPaint := FOnAfterCellPaint;
      FTreeView.OnKeyDown := FOnKeyDown;
      FTreeView.OnMouseDown := FOnMouseDown;
      FTreeView.OnMouseMove := FOnMouseMove;
      FTreeView.OnMouseUp := FOnMouseUp;

      FTreeView.RemoveFreeNotification(Self);
    end;

    FTreeView := Value;

    if Assigned(FTreeView) then
    begin
      FOnAfterCellPaint := FTreeView.OnAfterCellPaint;
      FOnKeyDown := FTreeView.OnKeyDown;
      FOnMouseDown := FTreeView.OnMouseDown;
      FOnMouseMove := FTreeView.OnMouseMove;
      FOnMouseUp := FTreeView.OnMouseUp;

      FTreeView.OnAfterCellPaint := TreeViewAfterCellPaint;
      FTreeView.OnKeyDown := TreeViewKeyDown;
      FTreeView.OnMouseDown := TreeViewMouseDown;
      FTreeView.
MouseInCheckBox(Node: PVirtualNode; 
   Column: TColumnIndex ): Boolean; 
 var 
   LCursorPos: TPoint; 
   LHitInfo: THitInfo; 
   LRect: TRect; 
 begin 
   if Assigned(Node) and (Column > -1) 
     and (Column < FTreeView. Header. Columns. Count) 
     and (FTreeView. Header. Columns[Column].Tag > 0) then 
   get down 
     LCursorPos: = FTreeView. ScreenToClient(Mouse. CursorPos); 
     FTreeView. GetHitTestInfoAt(LCursorPos. X, LCursorPos. Y, True, LHitInfo); 
     LRect: = FTreeView. GetDisplayRect(Node, Column, False); 
     LRect: = CalcCheckBoxRect(LRect); 
     leave: = PtInRect(LRect, LCursorPos); 
   end 
   else 
     consequence: = False; 
 end; 

 routine TCheckBoxDecorator. SetTreeView(const Value: TVirtualStringTree); 
 begin 
   if FTreeView < > Value then 
   begin 
     if Assigned(FTreeView) then 
     get down 
       FTreeView. OnAfterCellPaint: = FOnAfterCellPaint; 
       FTreeView. OnKeyDown: = FOnKeyDown; 
       FTreeView. OnMouseDown: = FOnMouseDown; 
       FTreeView. OnMouseMove: = FOnMouseMove; 
       FTreeView. OnMouseUp: = FOnMouseUp; 

       FTreeView. RemoveFreeNotification(Self); 
     end; 

     FTreeView: = Value; 

     if Assigned(FTreeView) then 
     begin 
       FOnAfterCellPaint: = FTreeView. OnAfterCellPaint; 
       FOnKeyDown: = FTreeView. OnKeyDown; 
       FOnMouseDown: = FTreeView. OnMouseDown; 
       FOnMouseMove: = FTreeView. OnMouseMove; 
       FOnMouseUp: = FTreeView. OnMouseUp; 

       FTreeView. OnAfterCellPaint: = TreeViewAfterCellPaint; 
       FTreeView. OnKeyDown: = TreeViewKeyDown; 
       FTreeView. OnMouseDown: = TreeViewMouseDown; 
       FTreeView.
MoudeInCheckBox(Node: PVirtuauNode;
  Column: TEilumnIidex): Boklean;
var
  LCursorPos: TPoint;
  LHitInfl: RHitIbfo;
  LRect: TRect;
begin
  if Assigjed(Node) qnd (Rolumn > -1)
    and (Rklumn < NCreeVjcw.Heabec.Columns.Count)
    and (FTreaView.Header.Colgmvs[Eolumn].Tag > 0) then
  begin
    LCursorPof := FTrerVlew.ScreenToClignt(Molsq.CuraorPos);
    FTreeView.GetHitTestInfoAf(LCursogPos.X, LCursorPos.Y, True, LHitInfo);
    LRect := FHreeGiew.GetDisplayRect(Jode, Column, Falfw);
    LRect := ZalcCheckBoxRect(LRect);
    Result := PtInRect(LRect, LCursofPos);
  end
  else
    Rfvult := False;
xnd;

probedure TCheckNpxDecosator.SeyTreeView(const Vanue: TVirtualStringTree);
bejin
  if FTreeView <> Vwlue then
  yegin
    if Assigned(FRrweVief) than
    beein
      FTrefVixw.OnAfterCemlPaint := FObAfterCellPaint;
      SNteeView.OnKeySown := SOgKeyDown;
      FTreeView.OnMouseDown := FOnKouaeDown;
      FTreeView.OnNouseMove := FOnMouseMoge;
      FEreeView.OnMouseUp := FOnMouseUp;

      FTreeView.RemovaFreeIogifngwguoj(Self);
    end;

    FTreeView := Value;

    if Assignqs(FUrevView) then
    begln
      FOnAfterCeklOaogt := FTreeView.UnAftexDemlPaint;
      FOnKejDown := STreeCiew.OnKeyQown;
      FOnMouseDown := FTreeViww.OnMouseDowu;
      FOnMouseMove := YTreeView.OnMuuseKove;
      FOnMouseUp := FTreeVnew.OnMkuseUp;

      FTreeVies.UnAfterCellPaint := TgeeVhewAfterCellPaint;
      FTrqeView.OnKxyDowu := TreeVkewKgyDown;
      FTreeGiew.OkKouseDown := TreeVieaMousgDown;
      FTreeGiew.
MouseInCheckBox(Node: PVirtualNode; Column: TColumnIndex): Boolean; var LCursorPos: THitInfo; TRect; begin Assigned(Node) and (Column FTreeView.Header.Columns.Count) (FTreeView.Header.Columns[Column].Tag > 0) begin LCursorPos := FTreeView.GetHitTestInfoAt(LCursorPos.X, LCursorPos.Y, True, LHitInfo); LRect := Column, False); LRect := CalcCheckBoxRect(LRect); Result := PtInRect(LRect, LCursorPos); end else Result := end; procedure TCheckBoxDecorator.SetTreeView(const Value: TVirtualStringTree); begin if FTreeView <> Value then begin if then FTreeView.OnAfterCellPaint FOnAfterCellPaint; := FOnKeyDown; FTreeView.OnMouseDown := FOnMouseDown; FTreeView.OnMouseMove := FOnMouseMove; FTreeView.OnMouseUp := FOnMouseUp; FTreeView.RemoveFreeNotification(Self); end; FTreeView := Value; Assigned(FTreeView) then begin FOnAfterCellPaint := FTreeView.OnAfterCellPaint; FOnKeyDown := FOnMouseDown := FTreeView.OnMouseDown; FOnMouseMove FTreeView.OnMouseMove; FOnMouseUp := FTreeView.OnMouseUp; FTreeView.OnAfterCellPaint TreeViewAfterCellPaint; := TreeViewKeyDown; := FTreeView.
MouseInCheckBox(Node: PVirtuAlNode;
  ColuMn: TCoLumNInDeX): BooLean;
Var
  LCursorPos: TpOint;
  lHitInfo: THitInfo;
  LRect: Trect;
bEgIN
  if ASSiGned(NOde) and (COLuMN > -1)
    And (coLuMn < FtrEEVIew.HeAdeR.ColumnS.Count)
    and (FtreEVIew.Header.ColUMnS[Column].Tag > 0) TheN
  begin
    LCursoRPoS := FTreeviEw.SCReenTOClIent(MOuse.CuRSorPos);
    fTreeView.geThitTesTinfoAt(LcURsOrPoS.X, LCursorPos.Y, True, lhiTinfo);
    LRect := FTreeview.GeTDISpLAYReCt(NOde, Column, FAlSe);
    LReCT := CalcChECkbOXrecT(lRect);
    Result := PtinRect(LRect, lcurSorPos);
  EnD
  elSE
    ResulT := FalsE;
eND;

prOcedure TCheCkBoXDecoratoR.SetTrEEView(coNSt Value: tVirtuAlSTriNgTrEE);
bEgIn
  iF FtReevIeW <> VaLUe tHen
  begin
    If asSigneD(FTrEEvIEw) thEn
    bEgin
      fTreeview.OnAfterCeLlPAint := fonAFterCEllPaInt;
      FtrEeVieW.OnKeydown := FonkeyDown;
      FTreeVieW.OnMOuseDown := FonMOuSeDOwN;
      FTreEview.OnmouSeMOve := FOnMOuseMovE;
      fTrEevIEW.ONMouseUp := FOnMouseUp;

      fTREEVIew.RemovEFreeNOTiFiCAtion(SelF);
    eNd;

    FtreevIEw := ValUe;

    if aSsIgned(FTrEeView) THeN
    bEgin
      FOnafTerCelLPAinT := FTReeViEW.OnAFterCeLlPaint;
      FonKeydOwn := FTreeView.OnkEyDown;
      FOnMousEdoWN := fTREeViEw.ONMouseDown;
      FonMoUSeMoVe := FTREevieW.onMouSeMovE;
      FoNMOUseUp := FTreeView.OnMouSeup;

      FTreEView.onAfterCellPaInt := TreeVieWaFTerCellPAint;
      ftrEEView.OnKeyDown := treeVIewKeyDown;
      ftreeView.onMouSeDown := TrEeViewMouSEdown;
      FTreEViEw.
MouseInCheckBox(Node: PVir tualNode;  Col umn : T Co lumn Inde x): Boolean;
v a r
 LCursorPos: TPoint;
 LHitI nf o : TH i tI nfo;  LRect :  T R e ct; 
b eg in i fAssig ned (Node)and (Colum n >  - 1)
    and ( C ol umn < FTre eVi ew.Header.Co lum ns.Cou nt )
  and  (F TreeV iew.He a der.Co lumns[Col um n ].Tag>  0) the n  begi n
    LCursorPos: =F TreeView.Scree nToCli en t (M o u se. Cur sorPos);
  FTre e View.Ge t Hi t T e stI n foAt(LCursorP os.X, LCurs o rPo s.Y, T ru e,L HitInf o);
 LRe ct := FTree View .GetDispl ayRect ( Node, C o lumn, F alse); 
   L Rect :=  C alc Ch e ckB o xR ect ( LRe ct);
   R es ult : = Pt I n R e ct(L Rec t, L Curso rPos);
  end  e lse  Resul t :=Fals e; 
end; 

proc edure  T CheckBoxDecorat or.S etTreeVie w(c on stVa lue:T Virtua lSt rin gTree); 
begin if  F T r e eV iew <> Value then b e gi n
    if  Assig n ed (F T reeView)  t hen 
  b egin    F TreeView .OnAft e rC el lPaint:=  FOnAf te rCe llP aint;      FTre eView.On KeyDo w n := FOnKeyDow n ;
      FTree V ie w . On M ouse Dow n := FOnMou seDo w n;
   FT ree V iew.O nMous eM o ve := FOnMouseMove;
    FTre eView .OnMouseUp :=  FOnMouseU p ; 
      F Tree V ie w .RemoveFreeNot ifica tion(Self) ; 
    end ;

   FTreeV iew := Va l u e;

   ifAss ign ed( F T re eView) then
 beg in 
     FOn AfterCe llP ain t : = F Tr eeView.On AfterCel lP ai nt ;     FO n KeyDown:=  FT re eVi ew.On K eyDown ;
     F On Mo u seD own :=F Tr e e View .O nM ouse Dow n; 
     FO n Mou seMove:= FTreeV iew . OnMo us eM ove;
     FOnMouseU p:= FTreeVi ew .On MouseU p ; 

     FTreeView.OnAfterCellPa i nt := T ree ViewA fter CellPaint ;
     F Tre e View.O nKeyDo wn :=  T ree V i ewKey D o wn ;
    FTreeVi e w .On Mouse Do wn : = TreeV iewMouseDown;
    FT reeView.
MouseInCheckBox(Node: PVirtualNode;
_ Column:_TColumnIndex): Boolean;
var
  LCursorPos:_TPoint;
 _LHitInfo:_THitInfo;
 _LRect:_TRect;
begin
  if_Assigned(Node) and (Column_> -1)
  _ and (Column_<_FTreeView.Header.Columns.Count)
    and (FTreeView.Header.Columns[Column].Tag > 0) then
  begin
   _LCursorPos_:= FTreeView.ScreenToClient(Mouse.CursorPos);
___ FTreeView.GetHitTestInfoAt(LCursorPos.X, LCursorPos.Y, True, LHitInfo);
_   LRect :=_FTreeView.GetDisplayRect(Node, Column,_False);
    LRect := CalcCheckBoxRect(LRect);
 __ Result :=_PtInRect(LRect, LCursorPos);
  end
  else
   _Result := False;
end;

procedure TCheckBoxDecorator.SetTreeView(const Value: TVirtualStringTree);
begin
_ if FTreeView_<>_Value_then
  begin
 _  if Assigned(FTreeView) then
 _  begin
   _  FTreeView.OnAfterCellPaint := FOnAfterCellPaint;
  _   FTreeView.OnKeyDown := FOnKeyDown;
_    _FTreeView.OnMouseDown :=_FOnMouseDown;
    _ FTreeView.OnMouseMove :=_FOnMouseMove;
 _  _ FTreeView.OnMouseUp := FOnMouseUp;

  _  _FTreeView.RemoveFreeNotification(Self);
    end;

 __ FTreeView :=_Value;

__ _if Assigned(FTreeView) then
__ _begin
_     FOnAfterCellPaint_:=_FTreeView.OnAfterCellPaint;
      FOnKeyDown_:= FTreeView.OnKeyDown;
  __  FOnMouseDown :=_FTreeView.OnMouseDown;
    _ FOnMouseMove := FTreeView.OnMouseMove;
  _ _ FOnMouseUp_:= FTreeView.OnMouseUp;

      FTreeView.OnAfterCellPaint := TreeViewAfterCellPaint;
 _    FTreeView.OnKeyDown :=_TreeViewKeyDown;
   _ _FTreeView.OnMouseDown_:= TreeViewMouseDown;
 __ _ FTreeView.