You've already forked lazarus-ccr
* Synchronize with main VTV repository up to svn rev 198
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2910 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -27,26 +27,14 @@ unit VirtualTrees;
|
||||
// (C) 1999-2001 digital publishing AG. All Rights Reserved.
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// April 2010
|
||||
// - Bug fix: Removed active column changing from TBaseVirtualTree.WMKeyDown to re-gain standard conforming
|
||||
// behaviour for VK_NEXT and VK_PRIOR
|
||||
// - Bug fix: Paint option toUseExplorerTheme works properly without defining columns
|
||||
// - Bug fix: TBaseVirtualTree.PrepareBitmaps now correctly closes the theme handle
|
||||
// January 2010
|
||||
// - Bug fix: TBaseVirtualTree.AdjustTotalHeight now longer calculates wrong total heights if nodes have been
|
||||
// made invisible
|
||||
// - Bug fix: TCustomVirtualStringTree.OnMeasureTextWidth now works as intended
|
||||
// - Bug fix: Added missing $IFDEFs concerning theming support
|
||||
// - Bug fix: Removed default from properties TVirtualTreeColumn.Color and TVirtualTreeColumn.BiDiMode
|
||||
// July 2009
|
||||
// - Bug fix: TWorkerThread will no longer reference the tree after it has been destroyed (Mantis issue #384)
|
||||
// - Bug fix: TBaseVirtualTree.InternalConnectNode checked the expanded state of the wrong node if Mode was
|
||||
// amAddChildFirst or amAddChildLast
|
||||
// June 2009
|
||||
// - Improvement: 'hidden nodes' are now called 'filtered nodes'
|
||||
// - Improvement: converted line endings back to CR/LF
|
||||
// - Improvement: new events TBaseVirtualTree.OnCanSplitterResizeNode and TBaseVirtualTree.OnCanSplitterResizeHeader
|
||||
// - Improvement: made TVirtualTreeColumns.DoCanSplitterResize virtual
|
||||
// - Improvement: made some methods of TVirtualTreeHintWindow protected to make subclassing easier
|
||||
// - Bug fix: fixed some issues concerning the vista theme handling
|
||||
// - Improvement: removed hidden node handling in this branch
|
||||
// - Improvement: reverted header click handling to old version to keep compatibility in this branch
|
||||
// - Improvement: removed TVTPaintOption toHideTreeLinesIfThemed
|
||||
// - Improvement: unified source code indentation
|
||||
// May 2009
|
||||
// - Improvement: new TVTMiscOption toEditOnClick, toEditOnDblClick to control if editing can be started with a single
|
||||
// click or a double click
|
||||
@ -362,9 +350,9 @@ const
|
||||
{$define ContextMenuBeforeMouseUp}
|
||||
{$endif}
|
||||
|
||||
VTMajorVersion = 4;
|
||||
VTMinorVersion = 8;
|
||||
VTReleaseVersion = 7;
|
||||
VTMajorVersion = 5;
|
||||
VTMinorVersion = 0;
|
||||
VTReleaseVersion = 0;
|
||||
VTTreeStreamVersion = 2;
|
||||
VTHeaderStreamVersion = 6; // The header needs an own stream version to indicate changes only relevant to the header.
|
||||
|
||||
@ -534,7 +522,7 @@ type
|
||||
vsMultiline, // Node text is wrapped at the cell boundaries instead of being shorted.
|
||||
vsHeightMeasured, // Node height has been determined and does not need a recalculation.
|
||||
vsToggling, // Set when a node is expanded/collapsed to prevent recursive calls.
|
||||
vsHidden // Indicates that the node should not be painted (without effecting its children).
|
||||
vsFiltered // Indicates that the node should not be painted (without effecting its children).
|
||||
);
|
||||
TVirtualNodeStates = set of TVirtualNodeState;
|
||||
|
||||
@ -724,7 +712,7 @@ type
|
||||
toFixedIndent, // Draw the tree with a fixed indent.
|
||||
toUseExplorerTheme, // Use the explorer theme if run under Windows Vista (or above).
|
||||
toHideTreeLinesIfThemed, // Do not show tree lines if theming is used.
|
||||
toShowHiddenNodes // Draw nodes even if they are hidden.
|
||||
toShowFilteredNodes // Draw nodes even if they are filtered out.
|
||||
);
|
||||
TVTPaintOptions = set of TVTPaintOption;
|
||||
|
||||
@ -1306,7 +1294,7 @@ type
|
||||
function AdjustHoverColumn(const P: TPoint): Boolean;
|
||||
procedure AdjustPosition(Column: TVirtualTreeColumn; Position: Cardinal);
|
||||
function CanSplitterResize(P: TPoint; Column: TColumnIndex): Boolean;
|
||||
procedure DoCanSplitterResize(P: TPoint; Column: TColumnIndex; var Allowed: Boolean);
|
||||
procedure DoCanSplitterResize(P: TPoint; Column: TColumnIndex; var Allowed: Boolean); virtual;
|
||||
procedure DrawButtonText(DC: HDC; Caption: String; Bounds: TRect; Enabled, Hot: Boolean; DrawFormat: Cardinal;
|
||||
WrapCaption: Boolean);
|
||||
procedure DrawXPButton(DC: HDC; const ButtonR: TRect; DrawSplitter, Down, Hover: Boolean);
|
||||
@ -1498,6 +1486,7 @@ type
|
||||
procedure SetSortDirection(const Value: TSortDirection);
|
||||
procedure SetStyle(Value: TVTHeaderStyle);
|
||||
protected
|
||||
function CanSplitterResize(P: TPoint): Boolean;
|
||||
procedure ChangeScale(M, D: Integer); virtual;
|
||||
function DetermineSplitterIndex(const P: TPoint): Boolean; virtual;
|
||||
procedure DoAfterAutoFitColumn(Column: TColumnIndex); virtual;
|
||||
@ -1506,6 +1495,7 @@ type
|
||||
function DoBeforeAutoFitColumn(Column: TColumnIndex; SmartAutoFitType: TSmartAutoFitType): Boolean; virtual;
|
||||
procedure DoBeforeColumnWidthTracking(Column: TColumnIndex; Shift: TShiftState); virtual;
|
||||
procedure DoBeforeHeightTracking(Shift: TShiftState); virtual;
|
||||
procedure DoCanSplitterResize(P: TPoint; var Allowed: Boolean); virtual;
|
||||
function DoColumnWidthDblClickResize(Column: TColumnIndex; P: TPoint; Shift: TShiftState): Boolean; virtual;
|
||||
function DoColumnWidthTracking(Column: TColumnIndex; Shift: TShiftState; var TrackPoint: TPoint; P: TPoint): Boolean; virtual;
|
||||
function DoGetPopupMenu(Column: TColumnIndex; Position: TPoint): TPopupMenu; virtual;
|
||||
@ -2010,6 +2000,7 @@ type
|
||||
TVTBeforeGetMaxColumnWidthEvent = procedure(Sender: TVTHeader; Column: TColumnIndex; var UseSmartColumnWidth: Boolean) of object;
|
||||
TVTAfterGetMaxColumnWidthEvent = procedure(Sender: TVTHeader; Column: TColumnIndex; var MaxWidth: Integer) of object;
|
||||
TVTCanSplitterResizeColumnEvent = procedure(Sender: TVTHeader; P: TPoint; Column: TColumnIndex; var Allowed: Boolean) of object;
|
||||
TVTCanSplitterResizeHeaderEvent = procedure(SendeR: TVTHeader; P: TPoint; var Allowed: Boolean) of object;
|
||||
|
||||
// move, copy and node tracking events
|
||||
TVTNodeMovedEvent = procedure(Sender: TBaseVirtualTree; Node: PVirtualNode) of object;
|
||||
@ -2022,6 +2013,8 @@ type
|
||||
var TrackPoint: TPoint; P: TPoint; var Allowed: Boolean) of object;
|
||||
TVTNodeHeightDblClickResizeEvent = procedure(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex;
|
||||
Shift: TShiftState; P: TPoint; var Allowed: Boolean) of object;
|
||||
TVTCanSplitterResizeNodeEvent = procedure(Sender: TBaseVirtualTree; P: TPoint; Node: PVirtualNode;
|
||||
Column: TColumnIndex; var Allowed: Boolean) of object;
|
||||
|
||||
// drag'n drop/OLE events
|
||||
TVTCreateDragManagerEvent = procedure(Sender: TBaseVirtualTree; out DragManager: IVTDragManager) of object;
|
||||
@ -2269,6 +2262,7 @@ type
|
||||
// parent node (probably another tree, but within the same application)
|
||||
FOnNodeCopying: TVTNodeCopyingEvent; // called when an node is copied to another parent node (probably in
|
||||
// another tree, but within the same application, can be cancelled)
|
||||
FOnCanSplitterResizeNode: TVTCanSplitterResizeNodeEvent; // called to query the application wether resizing a node is allowed
|
||||
FOnNodeHeightTracking: TVTNodeHeightTrackingEvent; // called when a node's height is being changed via mouse
|
||||
FOnNodeHeightDblClickResize: TVTNodeHeightDblClickResizeEvent; // called when a node's vertical splitter is double clicked
|
||||
FOnNodeCopied: TVTNodeCopiedEvent; // call after a node has been copied
|
||||
@ -2315,6 +2309,7 @@ type
|
||||
FOnColumnWidthTracking: TVTColumnWidthTrackingEvent;
|
||||
FOnGetHeaderCursor: TVTGetHeaderCursorEvent; // triggered to allow the app. to use customized cursors for the header
|
||||
FOnCanSplitterResizeColumn: TVTCanSplitterResizeColumnEvent;
|
||||
FOnCanSplitterResizeHeader: TVTCanSplitterResizeHeaderEvent;
|
||||
|
||||
// paint events
|
||||
FOnAfterPaint, // triggered when the tree has entirely been painted
|
||||
@ -2399,9 +2394,9 @@ type
|
||||
function GetDisabled(Node: PVirtualNode): Boolean;
|
||||
function GetDragManager: IVTDragManager;
|
||||
function GetExpanded(Node: PVirtualNode): Boolean;
|
||||
function GetFiltered(Node: PVirtualNode): Boolean;
|
||||
function GetFullyVisible(Node: PVirtualNode): Boolean;
|
||||
function GetHasChildren(Node: PVirtualNode): Boolean;
|
||||
function GetHidden(Node: PVirtualNode): Boolean;
|
||||
function GetMultiline(Node: PVirtualNode): Boolean;
|
||||
function GetNodeHeight(Node: PVirtualNode): Cardinal;
|
||||
function GetNodeParent(Node: PVirtualNode): PVirtualNode;
|
||||
@ -2456,7 +2451,7 @@ type
|
||||
procedure SetFullyVisible(Node: PVirtualNode; Value: Boolean);
|
||||
procedure SetHasChildren(Node: PVirtualNode; Value: Boolean);
|
||||
procedure SetHeader(const Value: TVTHeader);
|
||||
procedure SetHidden(Node: PVirtualNode; Value: Boolean);
|
||||
procedure SetFiltered(Node: PVirtualNode; Value: Boolean);
|
||||
procedure SetImages(const Value: TCustomImageList);
|
||||
procedure SetIndent(Value: Cardinal);
|
||||
procedure SetLineMode(const Value: TVTLineMode);
|
||||
@ -2556,6 +2551,7 @@ type
|
||||
function CalculateSelectionRect(X, Y: Integer): Boolean; virtual;
|
||||
function CanAutoScroll: Boolean; virtual;
|
||||
function CanShowDragImage: Boolean; virtual;
|
||||
function CanSplitterResizeNode(P: TPoint; Node: PVirtualNode; Column: TColumnIndex): Boolean;
|
||||
procedure Change(Node: PVirtualNode); virtual;
|
||||
procedure ChangeScale(M, D: Integer); override;
|
||||
//lcl
|
||||
@ -2591,6 +2587,8 @@ type
|
||||
procedure DoBeforePaint(Canvas: TCanvas); virtual;
|
||||
function DoCancelEdit: Boolean; virtual;
|
||||
procedure DoCanEdit(Node: PVirtualNode; Column: TColumnIndex; var Allowed: Boolean); virtual;
|
||||
procedure DoCanSplitterResizeNode(P: TPoint; Node: PVirtualNode; Column: TColumnIndex;
|
||||
var Allowed: Boolean); virtual;
|
||||
procedure DoChange(Node: PVirtualNode); virtual;
|
||||
procedure DoCheckClick(Node: PVirtualNode; NewCheckState: TCheckState); virtual;
|
||||
procedure DoChecked(Node: PVirtualNode); virtual;
|
||||
@ -2867,6 +2865,8 @@ type
|
||||
property OnBeforePaint: TVTPaintEvent read FOnBeforePaint write FOnBeforePaint;
|
||||
property OnBeforeTreeExport: TVTTreeExportEvent read FOnBeforeTreeExport write FOnBeforeTreeExport;
|
||||
property OnCanSplitterResizeColumn: TVTCanSplitterResizeColumnEvent read FOnCanSplitterResizeColumn write FOnCanSplitterResizeColumn;
|
||||
property OnCanSplitterResizeHeader: TVTCanSplitterResizeHeaderEvent read FOnCanSplitterResizeHeader write FOnCanSplitterResizeHeader;
|
||||
property OnCanSplitterResizeNode: TVTCanSplitterResizeNodeEvent read FOnCanSplitterResizeNode write FOnCanSplitterResizeNode;
|
||||
property OnChange: TVTChangeEvent read FOnChange write FOnChange;
|
||||
property OnChecked: TVTChangeEvent read FOnChecked write FOnChecked;
|
||||
property OnChecking: TVTCheckChangingEvent read FOnChecking write FOnChecking;
|
||||
@ -2989,6 +2989,8 @@ type
|
||||
{$endif}
|
||||
function GetDisplayRect(Node: PVirtualNode; Column: TColumnIndex; TextOnly: Boolean; Unclipped: Boolean = False;
|
||||
ApplyCellContentMargin: Boolean = False): TRect;
|
||||
function GetEffectivelyFiltered(Node: PVirtualNode): Boolean;
|
||||
function GetEffectivelyVisible(Node: PVirtualNode): Boolean;
|
||||
function GetFirst(ConsiderChildrenAbove: Boolean = False): PVirtualNode;
|
||||
function GetFirstChecked(State: TCheckState = csCheckedNormal; ConsiderChildrenAbove: Boolean = False): PVirtualNode;
|
||||
function GetFirstChild(Node: PVirtualNode): PVirtualNode;
|
||||
@ -2999,11 +3001,11 @@ type
|
||||
function GetFirstNoInit(ConsiderChildrenAbove: Boolean = False): PVirtualNode;
|
||||
function GetFirstSelected(ConsiderChildrenAbove: Boolean = False): PVirtualNode;
|
||||
function GetFirstVisible(Node: PVirtualNode = nil; ConsiderChildrenAbove: Boolean = True;
|
||||
IncludeHidden: Boolean = False): PVirtualNode;
|
||||
function GetFirstVisibleChild(Node: PVirtualNode; IncludeHidden: Boolean = False): PVirtualNode;
|
||||
function GetFirstVisibleChildNoInit(Node: PVirtualNode; IncludeHidden: Boolean = False): PVirtualNode;
|
||||
IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
function GetFirstVisibleChild(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
function GetFirstVisibleChildNoInit(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
function GetFirstVisibleNoInit(Node: PVirtualNode = nil; ConsiderChildrenAbove: Boolean = True;
|
||||
IncludeHidden: Boolean = False): PVirtualNode;
|
||||
IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
procedure GetHitTestInfoAt(X, Y: Integer; Relative: Boolean; var HitInfo: THitInfo); virtual;
|
||||
function GetLast(Node: PVirtualNode = nil; ConsiderChildrenAbove: Boolean = False): PVirtualNode;
|
||||
function GetLastInitialized(Node: PVirtualNode = nil; ConsiderChildrenAbove: Boolean = False): PVirtualNode;
|
||||
@ -3011,11 +3013,11 @@ type
|
||||
function GetLastChild(Node: PVirtualNode): PVirtualNode;
|
||||
function GetLastChildNoInit(Node: PVirtualNode): PVirtualNode;
|
||||
function GetLastVisible(Node: PVirtualNode = nil; ConsiderChildrenAbove: Boolean = True;
|
||||
IncludeHidden: Boolean = False): PVirtualNode;
|
||||
function GetLastVisibleChild(Node: PVirtualNode; IncludeHidden: Boolean = False): PVirtualNode;
|
||||
function GetLastVisibleChildNoInit(Node: PVirtualNode; IncludeHidden: Boolean = False): PVirtualNode;
|
||||
IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
function GetLastVisibleChild(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
function GetLastVisibleChildNoInit(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
function GetLastVisibleNoInit(Node: PVirtualNode = nil; ConsiderChildrenAbove: Boolean = True;
|
||||
IncludeHidden: Boolean = False): PVirtualNode;
|
||||
IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
function GetMaxColumnWidth(Column: TColumnIndex; UseSmartColumnWidth: Boolean = False): Integer;
|
||||
function GetNext(Node: PVirtualNode; ConsiderChildrenAbove: Boolean = False): PVirtualNode;
|
||||
function GetNextChecked(Node: PVirtualNode; State: TCheckState = csCheckedNormal;
|
||||
@ -3029,8 +3031,8 @@ type
|
||||
function GetNextSibling(Node: PVirtualNode): PVirtualNode;
|
||||
function GetNextVisible(Node: PVirtualNode; ConsiderChildrenAbove: Boolean = True): PVirtualNode;
|
||||
function GetNextVisibleNoInit(Node: PVirtualNode; ConsiderChildrenAbove: Boolean = True): PVirtualNode;
|
||||
function GetNextVisibleSibling(Node: PVirtualNode; IncludeHidden: Boolean = False): PVirtualNode;
|
||||
function GetNextVisibleSiblingNoInit(Node: PVirtualNode; IncludeHidden: Boolean = False): PVirtualNode;
|
||||
function GetNextVisibleSibling(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
function GetNextVisibleSiblingNoInit(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
function GetNodeAt(X, Y: Integer): PVirtualNode; overload;
|
||||
function GetNodeAt(X, Y: Integer; Relative: Boolean; var NodeTop: Integer): PVirtualNode; overload;
|
||||
function GetNodeData(Node: PVirtualNode): Pointer;
|
||||
@ -3047,14 +3049,14 @@ type
|
||||
function GetPreviousSibling(Node: PVirtualNode): PVirtualNode;
|
||||
function GetPreviousVisible(Node: PVirtualNode; ConsiderChildrenAbove: Boolean = True): PVirtualNode;
|
||||
function GetPreviousVisibleNoInit(Node: PVirtualNode; ConsiderChildrenAbove: Boolean = True): PVirtualNode;
|
||||
function GetPreviousVisibleSibling(Node: PVirtualNode; IncludeHidden: Boolean = False): PVirtualNode;
|
||||
function GetPreviousVisibleSiblingNoInit(Node: PVirtualNode; IncludeHidden: Boolean = False): PVirtualNode;
|
||||
function GetPreviousVisibleSibling(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
function GetPreviousVisibleSiblingNoInit(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
function GetSortedCutCopySet(Resolve: Boolean): TNodeArray;
|
||||
function GetSortedSelection(Resolve: Boolean): TNodeArray;
|
||||
procedure GetTextInfo(Node: PVirtualNode; Column: TColumnIndex; const AFont: TFont; var R: TRect;
|
||||
out Text: String); virtual;
|
||||
function GetTreeRect: TRect;
|
||||
function GetVisibleParent(Node: PVirtualNode; IncludeHidden: Boolean = False): PVirtualNode;
|
||||
function GetVisibleParent(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
function HasAsParent(Node, PotentialParent: PVirtualNode): Boolean;
|
||||
function InsertNode(Node: PVirtualNode; Mode: TVTNodeAttachMode; UserData: Pointer = nil): PVirtualNode;
|
||||
procedure InvalidateChildren(Node: PVirtualNode; Recursive: Boolean);
|
||||
@ -3063,8 +3065,6 @@ type
|
||||
procedure InvalidateToBottom(Node: PVirtualNode);
|
||||
procedure InvertSelection(VisibleOnly: Boolean);
|
||||
function IsEditing: Boolean;
|
||||
function IsEffectivelyHidden(Node: PVirtualNode): Boolean;
|
||||
function IsEffectivelyVisible(Node: PVirtualNode): Boolean;
|
||||
function IsMouseSelecting: Boolean;
|
||||
function IterateSubtree(Node: PVirtualNode; Callback: TVTGetNodeProc; Data: Pointer; Filter: TVirtualNodeStates = [];
|
||||
DoInit: Boolean = False; ChildNodesOnly: Boolean = False): PVirtualNode;
|
||||
@ -3130,7 +3130,9 @@ type
|
||||
property HasChildren[Node: PVirtualNode]: Boolean read GetHasChildren write SetHasChildren;
|
||||
property HotNode: PVirtualNode read FCurrentHotNode;
|
||||
property IsDisabled[Node: PVirtualNode]: Boolean read GetDisabled write SetDisabled;
|
||||
property IsHidden[Node: PVirtualNode]: Boolean read GetHidden write SetHidden;
|
||||
property IsEffectivelyFiltered[Node: PVirtualNode]: Boolean read GetEffectivelyFiltered;
|
||||
property IsEffectivelyVisible[Node: PVirtualNode]: Boolean read GetEffectivelyVisible;
|
||||
property IsFiltered[Node: PVirtualNode]: Boolean read GetFiltered write SetFiltered;
|
||||
property IsVisible[Node: PVirtualNode]: Boolean read GetVisible write SetVisible;
|
||||
property MultiLine[Node: PVirtualNode]: Boolean read GetMultiline write SetMultiline;
|
||||
property NodeHeight[Node: PVirtualNode]: Cardinal read GetNodeHeight write SetNodeHeight;
|
||||
@ -3526,6 +3528,8 @@ type
|
||||
property OnBeforePaint;
|
||||
property OnBeforeTreeExport;
|
||||
property OnCanSplitterResizeColumn;
|
||||
property OnCanSplitterResizeHeader;
|
||||
property OnCanSplitterResizeNode;
|
||||
property OnChange;
|
||||
property OnChecked;
|
||||
property OnChecking;
|
||||
@ -3772,6 +3776,8 @@ type
|
||||
property OnBeforePaint;
|
||||
property OnBeforeTreeExport;
|
||||
property OnCanSplitterResizeColumn;
|
||||
property OnCanSplitterResizeHeader;
|
||||
property OnCanSplitterResizeNode;
|
||||
property OnChange;
|
||||
property OnChecked;
|
||||
property OnChecking;
|
||||
@ -5467,15 +5473,15 @@ begin
|
||||
end
|
||||
else
|
||||
{$endif ThemeSupport}
|
||||
if toShowHiddenNodes in ToBeSet + ToBeCleared then
|
||||
if toShowFilteredNodes in ToBeSet + ToBeCleared then
|
||||
begin
|
||||
BeginUpdate;
|
||||
InterruptValidation;
|
||||
Run := GetFirst;
|
||||
while Assigned(Run) do
|
||||
begin
|
||||
if vsHidden in Run.States then
|
||||
if toShowHiddenNodes in ToBeSet then
|
||||
if vsFiltered in Run.States then
|
||||
if toShowFilteredNodes in ToBeSet then
|
||||
begin
|
||||
Inc(FVisibleCount);
|
||||
AdjustTotalHeight(Run.Parent, Run.NodeHeight, True);
|
||||
@ -9398,6 +9404,15 @@ end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TVTHeader.CanSplitterResize(P: TPoint): Boolean;
|
||||
|
||||
begin
|
||||
Result := hoHeightResize in FOptions;
|
||||
DoCanSplitterResize(P, Result);
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
procedure TVTHeader.SetStyle(Value: TVTHeaderStyle);
|
||||
|
||||
begin
|
||||
@ -9575,6 +9590,14 @@ end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
procedure TVTHeader.DoCanSplitterResize(P: TPoint; var Allowed: Boolean);
|
||||
begin
|
||||
if Assigned(TreeView.FOnCanSplitterResizeHeader) then
|
||||
TreeView.FOnCanSplitterResizeHeader(Self, P, Allowed);
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TVTHeader.DoColumnWidthDblClickResize(Column: TColumnIndex; P: TPoint; Shift: TShiftState): Boolean;
|
||||
|
||||
// Queries the application whether a double click on the column splitter should resize the column.
|
||||
@ -9983,7 +10006,7 @@ begin
|
||||
end;
|
||||
|
||||
IsInHeader := InHeader(P);
|
||||
IsVSplitterHit := (hoHeightResize in FOptions) and InHeaderSplitterArea(P);
|
||||
IsVSplitterHit := InHeaderSplitterArea(P) and CanSplitterResize(P);
|
||||
IsHSplitterHit := HSplitterHit;
|
||||
|
||||
if IsVSplitterHit or IsHSplitterHit then
|
||||
@ -10211,7 +10234,7 @@ begin
|
||||
begin
|
||||
//todo: see a way to store the user defined cursor.
|
||||
IsHSplitterHit := IsInHeader and HSplitterHit;
|
||||
IsVSplitterHit := (hoHeightResize in FOptions) and InHeaderSplitterArea(P);
|
||||
IsVSplitterHit := InHeaderSplitterArea(P) and CanSplitterResize(P);
|
||||
|
||||
if IsVSplitterHit or IsHSplitterHit then
|
||||
begin
|
||||
@ -12549,7 +12572,7 @@ begin
|
||||
while Assigned(Child) do
|
||||
begin
|
||||
FixupTotalHeight(Child);
|
||||
if IsEffectivelyVisible(Child) then
|
||||
if IsEffectivelyVisible[Child] then
|
||||
Inc(Node.TotalHeight, Child.TotalHeight);
|
||||
Child := Child.NextSibling;
|
||||
end;
|
||||
@ -12678,6 +12701,14 @@ end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.GetFiltered(Node: PVirtualNode): Boolean;
|
||||
|
||||
begin
|
||||
Result := vsFiltered in Node.States;
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.GetFullyVisible(Node: PVirtualNode): Boolean;
|
||||
|
||||
// Determines whether the given node has the visibility flag set as well as all its parents are expanded.
|
||||
@ -12702,14 +12733,6 @@ end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.GetHidden(Node: PVirtualNode): Boolean;
|
||||
|
||||
begin
|
||||
Result := vsHidden in Node.States;
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.GetMultiline(Node: PVirtualNode): Boolean;
|
||||
|
||||
begin
|
||||
@ -12993,7 +13016,7 @@ begin
|
||||
begin
|
||||
repeat
|
||||
Node := Node.NextSibling;
|
||||
Result := IsEffectivelyVisible(Node);
|
||||
Result := IsEffectivelyVisible[Node];
|
||||
until Result or (Node.NextSibling = nil);
|
||||
end;
|
||||
end;
|
||||
@ -13013,7 +13036,7 @@ begin
|
||||
begin
|
||||
repeat
|
||||
Node := Node.PrevSibling;
|
||||
Result := IsEffectivelyVisible(Node);
|
||||
Result := IsEffectivelyVisible[Node];
|
||||
until Result or (Node.PrevSibling = nil);
|
||||
end;
|
||||
end;
|
||||
@ -13113,7 +13136,7 @@ var
|
||||
begin
|
||||
// Find first visible child.
|
||||
Run := Parent.FirstChild;
|
||||
while Assigned(Run) and not IsEffectivelyVisible(Run) do
|
||||
while Assigned(Run) and not IsEffectivelyVisible[Run] do
|
||||
Run := Run.NextSibling;
|
||||
|
||||
Result := Assigned(Run) and (Run = Node);
|
||||
@ -13131,7 +13154,7 @@ var
|
||||
begin
|
||||
// Find last visible child.
|
||||
Run := Parent.LastChild;
|
||||
while Assigned(Run) and not IsEffectivelyVisible(Run) do
|
||||
while Assigned(Run) and not IsEffectivelyVisible[Run] do
|
||||
Run := Run.PrevSibling;
|
||||
|
||||
Result := Assigned(Run) and (Run = Node);
|
||||
@ -13771,7 +13794,7 @@ begin
|
||||
if vsExpanded in Node.States then
|
||||
begin
|
||||
AdjustTotalHeight(Node, NewHeight, True);
|
||||
if FullyVisible[Node] and not IsEffectivelyHidden(Node) then
|
||||
if FullyVisible[Node] and not IsEffectivelyFiltered[Node] then
|
||||
Inc(Integer(FVisibleCount), Count);
|
||||
end;
|
||||
|
||||
@ -13997,9 +14020,9 @@ end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
procedure TBaseVirtualTree.SetHidden(Node: PVirtualNode; Value: Boolean);
|
||||
procedure TBaseVirtualTree.SetFiltered(Node: PVirtualNode; Value: Boolean);
|
||||
|
||||
// Sets the hidden flag of the given node according to Value.
|
||||
// Sets the 'filtered' flag of the given node according to Value and updates all dependent states.
|
||||
|
||||
var
|
||||
NeedUpdate: Boolean;
|
||||
@ -14007,14 +14030,14 @@ var
|
||||
begin
|
||||
Assert(Assigned(Node) and (Node <> FRoot), 'Invalid parameter.');
|
||||
|
||||
if Value <> (vsHidden in Node.States) then
|
||||
if Value <> (vsFiltered in Node.States) then
|
||||
begin
|
||||
InterruptValidation;
|
||||
NeedUpdate := False;
|
||||
if Value then
|
||||
begin
|
||||
Include(Node.States, vsHidden);
|
||||
if (vsExpanded in Node.Parent.States) and not (toShowHiddenNodes in FOptions.FPaintOptions) then
|
||||
Include(Node.States, vsFiltered);
|
||||
if (vsExpanded in Node.Parent.States) and not (toShowFilteredNodes in FOptions.FPaintOptions) then
|
||||
AdjustTotalHeight(Node.Parent, -Integer(NodeHeight[Node]), True);
|
||||
if VisiblePath[Node] then
|
||||
begin
|
||||
@ -14029,8 +14052,8 @@ begin
|
||||
end
|
||||
else
|
||||
begin
|
||||
Exclude(Node.States, vsHidden);
|
||||
if (vsExpanded in Node.Parent.States) and not (toShowHiddenNodes in FOptions.FPaintOptions) then
|
||||
Exclude(Node.States, vsFiltered);
|
||||
if (vsExpanded in Node.Parent.States) and not (toShowFilteredNodes in FOptions.FPaintOptions) then
|
||||
AdjustTotalHeight(Node.Parent, Integer(NodeHeight[Node]), True);
|
||||
|
||||
if VisiblePath[Node] then
|
||||
@ -14207,7 +14230,7 @@ begin
|
||||
UpdateEditBounds;
|
||||
|
||||
// Stay away from touching the node cache while it is being validated.
|
||||
if not (tsValidating in FStates) and FullyVisible[Node] and not IsEffectivelyHidden(Node) then
|
||||
if not (tsValidating in FStates) and FullyVisible[Node] and not IsEffectivelyFiltered[Node] then
|
||||
begin
|
||||
InvalidateCache;
|
||||
if FUpdateCount = 0 then
|
||||
@ -14340,7 +14363,7 @@ begin
|
||||
if FSelectionCount = 0 then
|
||||
ResetRangeAnchor;
|
||||
end;
|
||||
if FullyVisible[Node] and not IsEffectivelyHidden(Node) then
|
||||
if FullyVisible[Node] and not IsEffectivelyFiltered[Node] then
|
||||
InvalidateNode(Node);
|
||||
end;
|
||||
end;
|
||||
@ -14444,7 +14467,7 @@ begin
|
||||
if Node.Align <> Value then
|
||||
begin
|
||||
Node.Align := Value;
|
||||
if FullyVisible[Node] and not IsEffectivelyHidden(Node) then
|
||||
if FullyVisible[Node] and not IsEffectivelyFiltered[Node] then
|
||||
InvalidateNode(Node);
|
||||
end;
|
||||
end;
|
||||
@ -17280,6 +17303,16 @@ end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.CanSplitterResizeNode(P: TPoint; Node: PVirtualNode; Column: TColumnIndex): Boolean;
|
||||
|
||||
begin
|
||||
Result := (toNodeHeightResize in FOptions.FMiscOptions) and Assigned(Node) and (Node <> FRoot) and
|
||||
(Column > NoColumn) and (coFixed in FHeader.FColumns[Column].FOptions);
|
||||
DoCanSplitterResizeNode(P, Node, Column, Result);
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
procedure TBaseVirtualTree.Change(Node: PVirtualNode);
|
||||
|
||||
begin
|
||||
@ -17484,8 +17517,8 @@ begin
|
||||
Node := Node.FirstChild;
|
||||
while Assigned(Node) do
|
||||
begin
|
||||
if (vsVisible in Node.States) and (not (vsHidden in Node.States) or
|
||||
(toShowHiddenNodes in FOptions.FPaintOptions)) then
|
||||
if (vsVisible in Node.States) and (not (vsFiltered in Node.States) or
|
||||
(toShowFilteredNodes in FOptions.FPaintOptions)) then
|
||||
Inc(Result, CountVisibleChildren(Node) + 1);
|
||||
Node := Node.NextSibling;
|
||||
end;
|
||||
@ -17636,7 +17669,7 @@ begin
|
||||
begin
|
||||
// Iterate through all siblings and stop when one visible is found.
|
||||
Run := Node.FirstChild;
|
||||
while Assigned(Run) and not IsEffectivelyVisible(Run) do
|
||||
while Assigned(Run) and not IsEffectivelyVisible[Run] do
|
||||
Run := Run.NextSibling;
|
||||
if Assigned(Run) then
|
||||
Exclude(Node.States, vsAllChildrenHidden)
|
||||
@ -18207,6 +18240,16 @@ end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
procedure TBaseVirtualTree.DoCanSplitterResizeNode(P: TPoint; Node: PVirtualNode; Column: TColumnIndex;
|
||||
var Allowed: Boolean);
|
||||
|
||||
begin
|
||||
if Assigned(FOnCanSplitterResizeNode) then
|
||||
FOnCanSplitterResizeNode(Self, P, Node, Column, Allowed);
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
procedure TBaseVirtualTree.DoChange(Node: PVirtualNode);
|
||||
|
||||
begin
|
||||
@ -20776,7 +20819,7 @@ begin
|
||||
if not (vsInitialized in Run.States) then
|
||||
Run := nil;
|
||||
isVisibleOnly:
|
||||
if not FullyVisible[Run] or IsEffectivelyHidden(Run) then
|
||||
if not FullyVisible[Run] or IsEffectivelyFiltered[Run] then
|
||||
Run := nil;
|
||||
end;
|
||||
end;
|
||||
@ -21047,9 +21090,8 @@ begin
|
||||
NodeSelected := IsAnyHit and (vsSelected in HitInfo.HitNode.States);
|
||||
FullRowDrag := toFullRowDrag in FOptions.FMiscOptions;
|
||||
IsHeightTracking := (Message.Msg = LM_LBUTTONDOWN) and
|
||||
(toNodeHeightResize in FOptions.FMiscOptions) and (hiOnItem in HitInfo.HitPositions) and
|
||||
([hiUpperSplitter, hiLowerSplitter] * HitInfo.HitPositions <> []) and
|
||||
((HitInfo.HitColumn > NoColumn) and (coFixed in FHeader.FColumns[HitInfo.HitColumn].Options));
|
||||
(hiOnItem in HitInfo.HitPositions) and
|
||||
([hiUpperSplitter, hiLowerSplitter] * HitInfo.HitPositions <> []);
|
||||
|
||||
// Dragging might be started in the inherited handler manually (which is discouraged for stability reasons)
|
||||
// the test for manual mode is done below (after the focused node is set).
|
||||
@ -21067,7 +21109,7 @@ begin
|
||||
else
|
||||
FHeightTrackNode := HitInfo.HitNode;
|
||||
|
||||
if Assigned(FHeightTrackNode) and (FHeightTrackNode <> FRoot) then
|
||||
if CanSplitterResizeNode(Point(Message.XPos, Message.YPos), FHeightTrackNode, HitInfo.HitColumn) then
|
||||
begin
|
||||
FHeightTrackColumn := HitInfo.HitColumn;
|
||||
NodeRect := GetDisplayRect(FHeightTrackNode, FHeightTrackColumn, False);
|
||||
@ -21412,7 +21454,7 @@ begin
|
||||
// Keep the current total height value of Node as it has already been applied
|
||||
// but might change in the load and fixup code. We have to adjust that afterwards.
|
||||
LastTotalHeight := Node.TotalHeight;
|
||||
WasFullyVisible := FullyVisible[Node] and not IsEffectivelyHidden(Node);
|
||||
WasFullyVisible := FullyVisible[Node] and not IsEffectivelyFiltered[Node];
|
||||
|
||||
// Read in the new nodes.
|
||||
ReadNode(Stream, Version, Node);
|
||||
@ -21426,7 +21468,7 @@ begin
|
||||
|
||||
// New nodes are always visible, so the visible node count has been increased already.
|
||||
// If Node is now invisible we have to take back this increment and don't need to add any visible child node.
|
||||
if not FullyVisible[Node] or IsEffectivelyHidden(Node) then
|
||||
if not FullyVisible[Node] or IsEffectivelyFiltered[Node] then
|
||||
begin
|
||||
if WasFullyVisible then
|
||||
Dec(FVisibleCount);
|
||||
@ -21667,9 +21709,9 @@ begin
|
||||
AdjustTotalCount(Destination.Parent, Node.TotalCount, True);
|
||||
|
||||
// Add the new node's height only if its parent is expanded.
|
||||
if (vsExpanded in Destination.Parent.States) and IsEffectivelyVisible(Node) then
|
||||
if (vsExpanded in Destination.Parent.States) and IsEffectivelyVisible[Node] then
|
||||
AdjustTotalHeight(Destination.Parent, Node.TotalHeight, True);
|
||||
if FullyVisible[Node] and not IsEffectivelyHidden(Node) then
|
||||
if FullyVisible[Node] and not IsEffectivelyFiltered[Node] then
|
||||
Inc(FVisibleCount, CountVisibleChildren(Node) + 1);
|
||||
end;
|
||||
amInsertAfter:
|
||||
@ -21697,9 +21739,9 @@ begin
|
||||
AdjustTotalCount(Destination.Parent, Node.TotalCount, True);
|
||||
|
||||
// Add the new node's height only if its parent is expanded.
|
||||
if (vsExpanded in Destination.Parent.States) and IsEffectivelyVisible(Node) then
|
||||
if (vsExpanded in Destination.Parent.States) and IsEffectivelyVisible[Node] then
|
||||
AdjustTotalHeight(Destination.Parent, Node.TotalHeight, True);
|
||||
if FullyVisible[Node] and not IsEffectivelyHidden(Node) then
|
||||
if FullyVisible[Node] and not IsEffectivelyFiltered[Node] then
|
||||
Inc(FVisibleCount, CountVisibleChildren(Node) + 1);
|
||||
end;
|
||||
amAddChildFirst:
|
||||
@ -21733,9 +21775,9 @@ begin
|
||||
Include(Destination.States, vsHasChildren);
|
||||
AdjustTotalCount(Destination, Node.TotalCount, True);
|
||||
// Add the new node's height only if its parent is expanded.
|
||||
if (vsExpanded in Destination.Parent.States) and IsEffectivelyVisible(Node) then
|
||||
if (vsExpanded in Destination.Parent.States) and IsEffectivelyVisible[Node] then
|
||||
AdjustTotalHeight(Destination, Node.TotalHeight, True);
|
||||
if FullyVisible[Node] and not IsEffectivelyHidden(Node) then
|
||||
if FullyVisible[Node] and not IsEffectivelyFiltered[Node] then
|
||||
Inc(FVisibleCount, CountVisibleChildren(Node) + 1);
|
||||
end;
|
||||
amAddChildLast:
|
||||
@ -21764,9 +21806,9 @@ begin
|
||||
Include(Destination.States, vsHasChildren);
|
||||
AdjustTotalCount(Destination, Node.TotalCount, True);
|
||||
// Add the new node's height only if its parent is expanded.
|
||||
if (vsExpanded in Destination.Parent.States) and IsEffectivelyVisible(Node) then
|
||||
if (vsExpanded in Destination.Parent.States) and IsEffectivelyVisible[Node] then
|
||||
AdjustTotalHeight(Destination, Node.TotalHeight, True);
|
||||
if FullyVisible[Node] and not IsEffectivelyHidden(Node) then
|
||||
if FullyVisible[Node] and not IsEffectivelyFiltered[Node] then
|
||||
Inc(FVisibleCount, CountVisibleChildren(Node) + 1);
|
||||
end;
|
||||
else
|
||||
@ -21780,7 +21822,7 @@ begin
|
||||
if (Mode <> amNoWhere) and (Node.Parent <> FRoot) then
|
||||
begin
|
||||
// If we have added a visible node then simply remove the all-children-hidden flag.
|
||||
if IsEffectivelyVisible(Node) then
|
||||
if IsEffectivelyVisible[Node] then
|
||||
Exclude(Node.Parent.States, vsAllChildrenHidden)
|
||||
else
|
||||
// If we have added an invisible node and this is the only child node then
|
||||
@ -21841,7 +21883,7 @@ begin
|
||||
Node.States := Node.States - [vsChecking];
|
||||
Parent := Node.Parent;
|
||||
Dec(Parent.ChildCount);
|
||||
AdjustHeight := (vsExpanded in Parent.States) and IsEffectivelyVisible(Node);
|
||||
AdjustHeight := (vsExpanded in Parent.States) and IsEffectivelyVisible[Node];
|
||||
if Parent.ChildCount = 0 then
|
||||
begin
|
||||
Parent.States := Parent.States - [vsAllChildrenHidden, vsHasChildren];
|
||||
@ -22085,14 +22127,13 @@ begin
|
||||
P := ScreenToClient(P);
|
||||
GetHitTestInfoAt(P.X, P.Y, True, HitInfo);
|
||||
if (hiOnItem in HitInfo.HitPositions) and
|
||||
([hiUpperSplitter, hiLowerSplitter] * HitInfo.HitPositions <> []) and
|
||||
((hitInfo.HitColumn > NoColumn) and (coFixed in FHeader.FColumns[HitInfo.HitColumn].FOptions)) then
|
||||
([hiUpperSplitter, hiLowerSplitter] * HitInfo.HitPositions <> []) then
|
||||
begin
|
||||
if hiUpperSplitter in HitInfo.HitPositions then
|
||||
Node := GetPreviousVisible(HitInfo.HitNode, True)
|
||||
else
|
||||
Node := HitInfo.HitNode;
|
||||
if Assigned(Node) and (Node <> FRoot) then
|
||||
if CanSplitterResizeNode(P, Node, HitInfo.HitColumn) then
|
||||
NewCursor := crVertSplit;
|
||||
end;
|
||||
end;
|
||||
@ -24724,7 +24765,7 @@ begin
|
||||
Run := Node.LastChild;
|
||||
while Assigned(Run) do
|
||||
begin
|
||||
if ParentVisible and IsEffectivelyVisible(Run) then
|
||||
if ParentVisible and IsEffectivelyVisible[Run] then
|
||||
Dec(FVisibleCount);
|
||||
|
||||
Include(Run.States, vsDeleting);
|
||||
@ -25255,7 +25296,7 @@ begin
|
||||
|
||||
// Check whether the node is visible (determine indentation level btw.).
|
||||
Temp := Node;
|
||||
if not IsEffectivelyVisible(Temp) then
|
||||
if not IsEffectivelyVisible[Temp] then
|
||||
Exit;
|
||||
Indent := 0;
|
||||
while Temp <> FRoot do
|
||||
@ -25415,6 +25456,27 @@ end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.GetEffectivelyFiltered(Node: PVirtualNode): Boolean;
|
||||
|
||||
// Checks if a node is effectively filtered out. This depends on the nodes state and the paint options.
|
||||
|
||||
begin
|
||||
if Assigned(Node) then
|
||||
Result := (vsFiltered in Node.States) and not (toShowFilteredNodes in FOptions.FPaintOptions)
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.GetEffectivelyVisible(Node: PVirtualNode): Boolean;
|
||||
|
||||
begin
|
||||
Result := (vsVisible in Node.States) and not IsEffectivelyFiltered[Node];
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.GetFirst(ConsiderChildrenAbove: Boolean = False): PVirtualNode;
|
||||
|
||||
// Returns the first node in the tree while optionally considering toChildrenAbove.
|
||||
@ -25586,7 +25648,7 @@ end;
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.GetFirstVisible(Node: PVirtualNode = nil; ConsiderChildrenAbove: Boolean = True;
|
||||
IncludeHidden: Boolean = False): PVirtualNode;
|
||||
IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
|
||||
// Returns the first visible node in the tree while optionally considering toChildrenAbove.
|
||||
// If necessary nodes are initialized on demand.
|
||||
@ -25677,13 +25739,13 @@ begin
|
||||
else
|
||||
Result := nil;
|
||||
|
||||
if Assigned(Result) and not IncludeHidden and IsEffectivelyHidden(Result) then
|
||||
if Assigned(Result) and not IncludeFiltered and IsEffectivelyFiltered[Result] then
|
||||
Result := GetNextVisible(Result);
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.GetFirstVisibleChild(Node: PVirtualNode; IncludeHidden: Boolean = False): PVirtualNode;
|
||||
function TBaseVirtualTree.GetFirstVisibleChild(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
|
||||
// Returns the first visible child node of Node. If necessary nodes are initialized on demand.
|
||||
|
||||
@ -25692,13 +25754,14 @@ begin
|
||||
Node := FRoot;
|
||||
Result := GetFirstChild(Node);
|
||||
|
||||
if Assigned(Result) and (not (vsVisible in Result.States) or (not IncludeHidden and IsEffectivelyHidden(Node))) then
|
||||
Result := GetNextVisibleSibling(Result, IncludeHidden);
|
||||
if Assigned(Result) and (not (vsVisible in Result.States) or
|
||||
(not IncludeFiltered and IsEffectivelyFiltered[Node])) then
|
||||
Result := GetNextVisibleSibling(Result, IncludeFiltered);
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.GetFirstVisibleChildNoInit(Node: PVirtualNode; IncludeHidden: Boolean = False): PVirtualNode;
|
||||
function TBaseVirtualTree.GetFirstVisibleChildNoInit(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
|
||||
// Returns the first visible child node of Node.
|
||||
|
||||
@ -25706,14 +25769,15 @@ begin
|
||||
if Node = nil then
|
||||
Node := FRoot;
|
||||
Result := Node.FirstChild;
|
||||
if Assigned(Result) and (not (vsVisible in Result.States) or (not IncludeHidden and IsEffectivelyHidden(Node))) then
|
||||
Result := GetNextVisibleSiblingNoInit(Result, IncludeHidden);
|
||||
if Assigned(Result) and (not (vsVisible in Result.States) or
|
||||
(not IncludeFiltered and IsEffectivelyFiltered[Node])) then
|
||||
Result := GetNextVisibleSiblingNoInit(Result, IncludeFiltered);
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.GetFirstVisibleNoInit(Node: PVirtualNode = nil;
|
||||
ConsiderChildrenAbove: Boolean = True; IncludeHidden: Boolean = False): PVirtualNode;
|
||||
ConsiderChildrenAbove: Boolean = True; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
|
||||
// Returns the first visible node in the tree or given subtree while optionally considering toChildrenAbove.
|
||||
// No initialization is performed.
|
||||
@ -25786,7 +25850,7 @@ begin
|
||||
else
|
||||
Result := nil;
|
||||
|
||||
if Assigned(Result) and not IncludeHidden and IsEffectivelyHidden(Result) then
|
||||
if Assigned(Result) and not IncludeFiltered and IsEffectivelyFiltered[Result] then
|
||||
Result := GetNextVisibleNoInit(Result);
|
||||
end;
|
||||
|
||||
@ -26031,7 +26095,7 @@ end;
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.GetLastVisible(Node: PVirtualNode = nil; ConsiderChildrenAbove: Boolean = True;
|
||||
IncludeHidden: Boolean = False): PVirtualNode;
|
||||
IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
|
||||
// Returns the very last visible node in the tree while optionally considering toChildrenAbove.
|
||||
// The nodes are intialized all the way down including the result node.
|
||||
@ -26040,13 +26104,13 @@ var
|
||||
Next: PVirtualNode;
|
||||
|
||||
begin
|
||||
Result := GetLastVisibleChild(Node, IncludeHidden);
|
||||
Result := GetLastVisibleChild(Node, IncludeFiltered);
|
||||
if not ConsiderChildrenAbove or not (toChildrenAbove in FOptions.FPaintOptions) then
|
||||
while Assigned(Result) do
|
||||
begin
|
||||
// Test if there is a next last visible child. If not keep the node from the last run.
|
||||
// Otherwise use the next last visible child.
|
||||
Next := GetLastVisibleChild(Result, IncludeHidden);
|
||||
Next := GetLastVisibleChild(Result, IncludeFiltered);
|
||||
if Next = nil then
|
||||
Break;
|
||||
Result := Next;
|
||||
@ -26055,7 +26119,7 @@ end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.GetLastVisibleChild(Node: PVirtualNode; IncludeHidden: Boolean = False): PVirtualNode;
|
||||
function TBaseVirtualTree.GetLastVisibleChild(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
|
||||
// Determines the last visible child of the given node and initializes it if necessary.
|
||||
|
||||
@ -26068,8 +26132,9 @@ begin
|
||||
else
|
||||
Result := nil;
|
||||
|
||||
if Assigned(Result) and (not (vsVisible in Result.States) or (not IncludeHidden and IsEffectivelyHidden(Node))) then
|
||||
Result := GetPreviousVisibleSibling(Result, IncludeHidden);
|
||||
if Assigned(Result) and (not (vsVisible in Result.States) or
|
||||
(not IncludeFiltered and IsEffectivelyFiltered[Node])) then
|
||||
Result := GetPreviousVisibleSibling(Result, IncludeFiltered);
|
||||
|
||||
if Assigned(Result) and not (vsInitialized in Result.States) then
|
||||
InitNode(Result);
|
||||
@ -26077,7 +26142,7 @@ end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.GetLastVisibleChildNoInit(Node: PVirtualNode; IncludeHidden: Boolean = False): PVirtualNode;
|
||||
function TBaseVirtualTree.GetLastVisibleChildNoInit(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
|
||||
// Determines the last visible child of the given node without initialization.
|
||||
|
||||
@ -26090,14 +26155,15 @@ begin
|
||||
else
|
||||
Result := nil;
|
||||
|
||||
if Assigned(Result) and (not (vsVisible in Result.States) or (not IncludeHidden and IsEffectivelyHidden(Node))) then
|
||||
Result := GetPreviousVisibleSiblingNoInit(Result, IncludeHidden);
|
||||
if Assigned(Result) and (not (vsVisible in Result.States) or
|
||||
(not IncludeFiltered and IsEffectivelyFiltered[Node])) then
|
||||
Result := GetPreviousVisibleSiblingNoInit(Result, IncludeFiltered);
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.GetLastVisibleNoInit(Node: PVirtualNode = nil;
|
||||
ConsiderChildrenAbove: Boolean = True; IncludeHidden: Boolean = False): PVirtualNode;
|
||||
ConsiderChildrenAbove: Boolean = True; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
|
||||
// Returns the very last visible node in the tree while optionally considering toChildrenAbove.
|
||||
// No initialization is performed.
|
||||
@ -26106,13 +26172,13 @@ var
|
||||
Next: PVirtualNode;
|
||||
|
||||
begin
|
||||
Result := GetLastVisibleChildNoInit(Node, IncludeHidden);
|
||||
Result := GetLastVisibleChildNoInit(Node, IncludeFiltered);
|
||||
if not ConsiderChildrenAbove or not (toChildrenAbove in FOptions.FPaintOptions) then
|
||||
while Assigned(Result) do
|
||||
begin
|
||||
// Test if there is a next last visible child. If not keep the node from the last run.
|
||||
// Otherwise use the next last visible child.
|
||||
Next := GetLastVisibleChildNoInit(Result, IncludeHidden);
|
||||
Next := GetLastVisibleChildNoInit(Result, IncludeFiltered);
|
||||
if Next = nil then
|
||||
Break;
|
||||
Result := Next;
|
||||
@ -26418,7 +26484,8 @@ begin
|
||||
if Assigned(Result) and (GetNodeLevel(Result) <> NodeLevel) then
|
||||
Result := GetNextLevel(Result, NodeLevel);
|
||||
end
|
||||
else if StartNodeLevel = NodeLevel then
|
||||
else
|
||||
if StartNodeLevel = NodeLevel then
|
||||
begin
|
||||
Result := Node.NextSibling;
|
||||
if not Assigned(Result) then // i.e. start node was a last sibling
|
||||
@ -26665,7 +26732,7 @@ begin
|
||||
until False;
|
||||
end;
|
||||
end;
|
||||
until not Assigned(Result) or IsEffectivelyVisible(Result);
|
||||
until not Assigned(Result) or IsEffectivelyVisible[Result];
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -26764,13 +26831,13 @@ begin
|
||||
until False;
|
||||
end;
|
||||
end;
|
||||
until not Assigned(Result) or IsEffectivelyVisible(Result);
|
||||
until not Assigned(Result) or IsEffectivelyVisible[Result];
|
||||
end;
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.GetNextVisibleSibling(Node: PVirtualNode; IncludeHidden: Boolean = False): PVirtualNode;
|
||||
function TBaseVirtualTree.GetNextVisibleSibling(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
|
||||
// Returns the next visible sibling after Node. Initialization is done implicitly.
|
||||
|
||||
@ -26780,12 +26847,13 @@ begin
|
||||
Result := Node;
|
||||
repeat
|
||||
Result := GetNextSibling(Result);
|
||||
until not Assigned(Result) or ((vsVisible in Result.States) and (IncludeHidden or not IsEffectivelyHidden(Result)));
|
||||
until not Assigned(Result) or ((vsVisible in Result.States) and
|
||||
(IncludeFiltered or not IsEffectivelyFiltered[Result]));
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.GetNextVisibleSiblingNoInit(Node: PVirtualNode; IncludeHidden: Boolean = False): PVirtualNode;
|
||||
function TBaseVirtualTree.GetNextVisibleSiblingNoInit(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
|
||||
// Returns the next visible sibling after Node.
|
||||
|
||||
@ -26795,7 +26863,8 @@ begin
|
||||
Result := Node;
|
||||
repeat
|
||||
Result := Result.NextSibling;
|
||||
until not Assigned(Result) or ((vsVisible in Result.States) and (IncludeHidden or not IsEffectivelyHidden(Result)));
|
||||
until not Assigned(Result) or ((vsVisible in Result.States) and
|
||||
(IncludeFiltered or not IsEffectivelyFiltered[Result]));
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
@ -27277,7 +27346,7 @@ begin
|
||||
if Assigned(Result) and not (vsInitialized in Result.States) then
|
||||
InitNode(Result);
|
||||
end;
|
||||
until not Assigned(Result) or IsEffectivelyVisible(Result);
|
||||
until not Assigned(Result) or IsEffectivelyVisible[Result];
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -27377,13 +27446,13 @@ begin
|
||||
until False;
|
||||
end;
|
||||
end;
|
||||
until not Assigned(Result) or IsEffectivelyVisible(Result);
|
||||
until not Assigned(Result) or IsEffectivelyVisible[Result];
|
||||
end;
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.GetPreviousVisibleSibling(Node: PVirtualNode; IncludeHidden: Boolean = False): PVirtualNode;
|
||||
function TBaseVirtualTree.GetPreviousVisibleSibling(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
|
||||
// Returns the previous visible sibling before Node. Initialization is done implicitly.
|
||||
|
||||
@ -27393,7 +27462,8 @@ begin
|
||||
Result := Node;
|
||||
repeat
|
||||
Result := GetPreviousSibling(Result);
|
||||
until not Assigned(Result) or ((vsVisible in Result.States) and (IncludeHidden or not IsEffectivelyHidden(Result)));
|
||||
until not Assigned(Result) or ((vsVisible in Result.States) and
|
||||
(IncludeFiltered or not IsEffectivelyFiltered[Result]));
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
@ -27409,7 +27479,8 @@ begin
|
||||
Result := Node;
|
||||
repeat
|
||||
Result := Result.PrevSibling;
|
||||
until not Assigned(Result) or ((vsVisible in Result.States) and (IncludeHidden or not IsEffectivelyHidden(Result)));
|
||||
until not Assigned(Result) or ((vsVisible in Result.States) and
|
||||
(IncludeFiltered or not IsEffectivelyFiltered[Result]));
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
@ -27592,7 +27663,7 @@ end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.GetVisibleParent(Node: PVirtualNode; IncludeHidden: Boolean = False): PVirtualNode;
|
||||
function TBaseVirtualTree.GetVisibleParent(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||
|
||||
// Returns the first (nearest) parent node of Node which is visible.
|
||||
// This method is one of the seldom cases where the hidden root node could be returned.
|
||||
@ -27602,7 +27673,7 @@ begin
|
||||
Assert(Node <> FRoot, 'Node must not be the hidden root node.');
|
||||
|
||||
Result := Node.Parent;
|
||||
while (Result <> FRoot) and (not FullyVisible[Result] or (not IncludeHidden and IsEffectivelyHidden(Result))) do
|
||||
while (Result <> FRoot) and (not FullyVisible[Result] or (not IncludeFiltered and IsEffectivelyFiltered[Result])) do
|
||||
Result := Result.Parent;
|
||||
end;
|
||||
|
||||
@ -27789,7 +27860,7 @@ begin
|
||||
if (Node = nil) or (Node = FRoot) then
|
||||
Invalidate
|
||||
else
|
||||
if (vsInitialized in Node.States) and IsEffectivelyVisible(Node) then
|
||||
if (vsInitialized in Node.States) and IsEffectivelyVisible[Node] then
|
||||
begin
|
||||
R := GetDisplayRect(Node, -1, False);
|
||||
if R.Top < ClientHeight then
|
||||
@ -27869,27 +27940,6 @@ end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.IsEffectivelyHidden(Node: PVirtualNode): Boolean;
|
||||
|
||||
// Checks if a node will effectively be hidden as this depends on the nodes state and the paint options.
|
||||
|
||||
begin
|
||||
if Assigned(Node) then
|
||||
Result := (vsHidden in Node.States) and not (toShowHiddenNodes in FOptions.FPaintOptions)
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.IsEffectivelyVisible(Node: PVirtualNode): Boolean;
|
||||
|
||||
begin
|
||||
Result := (vsVisible in Node.States) and not IsEffectivelyHidden(Node);
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TBaseVirtualTree.IsMouseSelecting: Boolean;
|
||||
|
||||
begin
|
||||
@ -30000,7 +30050,7 @@ begin
|
||||
// Iterate through the child nodes without initializing them. We have to determine the entire height.
|
||||
Child := Node.FirstChild;
|
||||
repeat
|
||||
if IsEffectivelyVisible(Child) then
|
||||
if IsEffectivelyVisible[Child] then
|
||||
Inc(HeightDelta, Child.TotalHeight);
|
||||
Child := Child.NextSibling;
|
||||
until Child = nil;
|
||||
@ -31769,7 +31819,6 @@ var
|
||||
PaintInfo: TVTPaintInfo;
|
||||
Dummy: TColumnIndex;
|
||||
LineImage: TLineImage;
|
||||
|
||||
begin
|
||||
if Length(S) = 0 then
|
||||
S := Text[Node, Column];
|
||||
|
Reference in New Issue
Block a user