lcl: TTreeView fixes by Anton Kavalenka

- call OnGetImageIndex, OnGetSelectedIndex when we need them,
  - don't start text editing when we click on icon
(issue #0013325)

git-svn-id: trunk@18990 -
This commit is contained in:
paul 2009-03-14 16:01:51 +00:00
parent 918eaf1a50
commit af8f77fb82

View File

@ -10,7 +10,7 @@
* * * *
* This file is part of the Lazarus Component Library (LCL) * * This file is part of the Lazarus Component Library (LCL) *
* * * *
* See the file COPYING.modifiedLGPL.txt, included in this distribution, * * See the file COPYING.modifiedLGPL.txt, included in this distribution, *
* for details about the copyright. * * for details about the copyright. *
* * * *
* This program is distributed in the hope that it will be useful, * * This program is distributed in the hope that it will be useful, *
@ -4446,13 +4446,19 @@ begin
// draw icon // draw icon
if (Images<>nil) and PaintImages then if (Images<>nil) and PaintImages then
begin begin
if FSelectedNode<>Node then if FSelectedNode <> Node then
ImgIndex:=Node.ImageIndex begin
GetImageIndex(Node);
ImgIndex := Node.ImageIndex
end
else else
ImgIndex:=Node.SelectedIndex; begin
if (ImgIndex>=0) and (ImgIndex<Images.Count) then GetSelectedIndex(Node);
Images.Draw(Canvas,x+1,NodeRect.Top,ImgIndex,true); ImgIndex := Node.SelectedIndex;
inc(x,Images.Width+2); end;
if (ImgIndex >= 0) and (ImgIndex < Images.Count) then
Images.Draw(Canvas, x + 1, NodeRect.Top, ImgIndex, True);
inc(x, Images.Width + 2);
end; end;
// draw state icon // draw state icon
@ -4661,7 +4667,7 @@ begin
and (LogicalX<CursorNode.DisplayExpandSignRight) then begin and (LogicalX<CursorNode.DisplayExpandSignRight) then begin
// mousedown occured on expand sign -> expand/collapse // mousedown occured on expand sign -> expand/collapse
CursorNode.Expanded:=not CursorNode.Expanded; CursorNode.Expanded:=not CursorNode.Expanded;
end else if LogicalX>=CursorNode.DisplayIconLeft then begin end else if LogicalX>=CursorNode.DisplayTextLeft then begin
// mousedown occured in text or icon // mousedown occured in text or icon
// -> select node and begin drag operation // -> select node and begin drag operation
{$IFDEF VerboseDrag} {$IFDEF VerboseDrag}