* Synchronize with main VTV repository up to svn rev 488

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3405 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
blikblum
2014-08-02 00:08:05 +00:00
parent c72e94c749
commit 697c55c0ac

View File

@ -3,7 +3,7 @@ unit VirtualTrees;
{$mode delphi}{$H+} {$mode delphi}{$H+}
{$packset 1} {$packset 1}
// Version 5.0.1 // Version 5.1.2
// //
// The contents of this file are subject to the Mozilla Public License // The contents of this file are subject to the Mozilla Public License
// Version 1.1 (the "License"); you may not use this file except in compliance // Version 1.1 (the "License"); you may not use this file except in compliance
@ -104,8 +104,8 @@ const
{$endif} {$endif}
VTMajorVersion = 5; VTMajorVersion = 5;
VTMinorVersion = 0; VTMinorVersion = 1;
VTReleaseVersion = 1; VTReleaseVersion = 2;
VTTreeStreamVersion = 2; VTTreeStreamVersion = 2;
VTHeaderStreamVersion = 6; // The header needs an own stream version to indicate changes only relevant to the header. VTHeaderStreamVersion = 6; // The header needs an own stream version to indicate changes only relevant to the header.
@ -2505,6 +2505,7 @@ type
{$endif} {$endif}
{$endif ThemeSupport} {$endif ThemeSupport}
procedure WMVScroll(var Message: TLMVScroll); message LM_VSCROLL; procedure WMVScroll(var Message: TLMVScroll); message LM_VSCROLL;
function GetRangeX: Cardinal;
protected protected
procedure AddToSelection(Node: PVirtualNode); overload; virtual; procedure AddToSelection(Node: PVirtualNode); overload; virtual;
procedure AddToSelection(const NewItems: TNodeArray; NewLength: Integer; ForceInsert: Boolean = False); overload; virtual; procedure AddToSelection(const NewItems: TNodeArray; NewLength: Integer; ForceInsert: Boolean = False); overload; virtual;
@ -2819,7 +2820,7 @@ type
property HotPlusBM: TBitmap read FHotPlusBM; property HotPlusBM: TBitmap read FHotPlusBM;
property MinusBM: TBitmap read FMinusBM; property MinusBM: TBitmap read FMinusBM;
property PlusBM: TBitmap read FPlusBM; property PlusBM: TBitmap read FPlusBM;
property RangeX: Cardinal read FRangeX; property RangeX: Cardinal read GetRangeX;// Returns the width of the virtual tree in pixels, (not ClientWidth). If there are columns it returns the total width of all of them; otherwise it returns the maximum of the all the line's data widths.
property RangeY: Cardinal read FRangeY; property RangeY: Cardinal read FRangeY;
property RootNodeCount: Cardinal read GetRootNodeCount write SetRootNodeCount default 0; property RootNodeCount: Cardinal read GetRootNodeCount write SetRootNodeCount default 0;
property ScrollBarOptions: TScrollBarOptions read FScrollBarOptions write SetScrollBarOptions; property ScrollBarOptions: TScrollBarOptions read FScrollBarOptions write SetScrollBarOptions;
@ -3457,6 +3458,7 @@ type
function GetOptionsClass: TTreeOptionsClass; override; function GetOptionsClass: TTreeOptionsClass; override;
public public
property Canvas; property Canvas;
property RangeX;
published published
{$ifdef EnableAccessible} {$ifdef EnableAccessible}
property AccessibleName; property AccessibleName;
@ -6756,7 +6758,7 @@ begin
if not (coUseCaptionAlignment in FOptions) or (FCaptionAlignment <> Value) then if not (coUseCaptionAlignment in FOptions) or (FCaptionAlignment <> Value) then
begin begin
FCaptionAlignment := Value; FCaptionAlignment := Value;
Exclude(FOptions, coUseCaptionAlignment); Include(FOptions, coUseCaptionAlignment);
// Setting the alignment affects also the tree, hence invalidate it too. // Setting the alignment affects also the tree, hence invalidate it too.
Owner.Header.Invalidate(Self); Owner.Header.Invalidate(Self);
end; end;
@ -7013,6 +7015,7 @@ begin
if FText <> Value then if FText <> Value then
begin begin
FText := Value; FText := Value;
FCaptionText := '';
Changed(False); Changed(False);
end; end;
end; end;
@ -8080,7 +8083,7 @@ begin
HitInfo.HitPosition := [hhiNoWhere]; HitInfo.HitPosition := [hhiNoWhere];
end; end;
if (hoHeaderClickAutoSort in Header.Options) and (HitInfo.Button = mbLeft) and not DblClick and (HitInfo.Column >= 0) then begin if (hoHeaderClickAutoSort in Header.Options) and (HitInfo.Button = mbLeft) and not DblClick and not (hhiOnCheckbox in HitInfo.HitPosition) and (HitInfo.Column >= 0) then begin
// handle automatic setting of SortColumn and toggling of the sort order // handle automatic setting of SortColumn and toggling of the sort order
if HitInfo.Column<>Header.SortColumn then begin if HitInfo.Column<>Header.SortColumn then begin
// set sort column // set sort column
@ -9743,7 +9746,7 @@ begin
begin begin
FSortDirection := Value; FSortDirection := Value;
Invalidate(nil); Invalidate(nil);
if (toAutoSort in Treeview.FOptions.FAutoOptions) and (Treeview.FUpdateCount = 0) then if ((toAutoSort in Treeview.FOptions.FAutoOptions) or (hoHeaderClickAutoSort in Options)) and (Treeview.FUpdateCount = 0) then
Treeview.SortTree(FSortColumn, FSortDirection, True); Treeview.SortTree(FSortColumn, FSortDirection, True);
end; end;
end; end;
@ -10015,7 +10018,7 @@ begin
FSortColumn := Value; FSortColumn := Value;
if FSortColumn > NoColumn then if FSortColumn > NoColumn then
Invalidate(Columns[FSortColumn]); Invalidate(Columns[FSortColumn]);
if (toAutoSort in Treeview.FOptions.FAutoOptions) and (Treeview.FUpdateCount = 0) then if ((toAutoSort in Treeview.FOptions.FAutoOptions) or (hoHeaderClickAutoSort in Options)) and (Treeview.FUpdateCount = 0) then
Treeview.SortTree(FSortColumn, FSortDirection, True); Treeview.SortTree(FSortColumn, FSortDirection, True);
end; end;
end; end;
@ -13096,6 +13099,11 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TBaseVirtualTree.GetRangeX: Cardinal;
begin
Result := Max(0, FRangeX);
end;
function TBaseVirtualTree.GetRootNodeCount: Cardinal; function TBaseVirtualTree.GetRootNodeCount: Cardinal;
begin begin
@ -14000,7 +14008,8 @@ begin
if (Node.CheckType <> Value) and not (toReadOnly in FOptions.FMiscOptions) then if (Node.CheckType <> Value) and not (toReadOnly in FOptions.FMiscOptions) then
begin begin
Node.CheckType := Value; Node.CheckType := Value;
Node.CheckState := csUncheckedNormal; if (Value <> ctTriStateCheckBox) and (Node.CheckState in [csMixedNormal, csMixedPressed]) then
Node.CheckState := csUncheckedNormal;// reset check state if it doesn't fit the new check type
// For check boxes with tri-state check box parents we have to initialize differently. // For check boxes with tri-state check box parents we have to initialize differently.
if (toAutoTriStateTracking in FOptions.FAutoOptions) and (Value in [ctCheckBox, ctTriStateCheckBox]) and if (toAutoTriStateTracking in FOptions.FAutoOptions) and (Value in [ctCheckBox, ctTriStateCheckBox]) and
(Node.Parent <> FRoot) then (Node.Parent <> FRoot) then
@ -22104,14 +22113,11 @@ begin
begin begin
Count := Node.ChildCount; Count := Node.ChildCount;
DoInitChildren(Node, Count); DoInitChildren(Node, Count);
if Count = 0 then if Count = Node.ChildCount then
begin exit;// value has not chnaged, so nothing to do
// Remove any child node which is already there.
DeleteChildren(Node);
Exclude(Node.States, vsHasChildren);
end
else
SetChildCount(Node, Count); SetChildCount(Node, Count);
if Count = 0 then
Exclude(Node.States, vsHasChildren);
end; end;
end; end;
@ -27745,12 +27751,14 @@ function TBaseVirtualTree.GetNodeData(Node: PVirtualNode): Pointer;
begin begin
Assert(FNodeDataSize > 0, 'NodeDataSize not initialized.'); Assert(FNodeDataSize > 0, 'NodeDataSize not initialized.');
if (FNodeDataSize <= 0) or (Node = nil) or (Node = FRoot) then if (FNodeDataSize <= 0) or (Node = nil) or (Node = FRoot) then
Result := nil Result := nil
else else begin
if ([vsInitialized, vsInitialUserData] * Node.States = []) then
InitNode(Node);
Result := PByte(@Node.Data) + FTotalInternalDataSize; Result := PByte(@Node.Data) + FTotalInternalDataSize;
end; end;
end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------