You've already forked lazarus-ccr
* Synchronize with main VTV repository up to svn rev 531
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3408 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -102,8 +102,8 @@ const
|
|||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
VTMajorVersion = 5;
|
VTMajorVersion = 5;
|
||||||
VTMinorVersion = 1;
|
VTMinorVersion = 2;
|
||||||
VTReleaseVersion = 4;
|
VTReleaseVersion = 0;
|
||||||
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.
|
||||||
|
|
||||||
@ -994,6 +994,8 @@ type
|
|||||||
procedure GetAbsoluteBounds(var Left, Right: Integer);
|
procedure GetAbsoluteBounds(var Left, Right: Integer);
|
||||||
function GetDisplayName: string; override;
|
function GetDisplayName: string; override;
|
||||||
function GetOwner: TVirtualTreeColumns; reintroduce;
|
function GetOwner: TVirtualTreeColumns; reintroduce;
|
||||||
|
property HasImage: Boolean read fHasImage;
|
||||||
|
property ImageRect: TRect read fImageRect;
|
||||||
public
|
public
|
||||||
constructor Create(Collection: TCollection); override;
|
constructor Create(Collection: TCollection); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -1029,7 +1031,7 @@ type
|
|||||||
property MinWidth: Integer read FMinWidth write SetMinWidth default 10;
|
property MinWidth: Integer read FMinWidth write SetMinWidth default 10;
|
||||||
property Options: TVTColumnOptions read FOptions write SetOptions default DefaultColumnOptions;
|
property Options: TVTColumnOptions read FOptions write SetOptions default DefaultColumnOptions;
|
||||||
property Position: TColumnPosition read FPosition write SetPosition;
|
property Position: TColumnPosition read FPosition write SetPosition;
|
||||||
property Spacing: Integer read FSpacing write SetSpacing default 4;
|
property Spacing: Integer read FSpacing write SetSpacing default 3;
|
||||||
property Style: TVirtualTreeColumnStyle read FStyle write SetStyle default vsText;
|
property Style: TVirtualTreeColumnStyle read FStyle write SetStyle default vsText;
|
||||||
property Tag: Integer read FTag write FTag default 0;
|
property Tag: Integer read FTag write FTag default 0;
|
||||||
property Text: String read FText write SetText;
|
property Text: String read FText write SetText;
|
||||||
@ -1089,8 +1091,11 @@ type
|
|||||||
|
|
||||||
property HeaderBitmap: TBitmap read FHeaderBitmap;
|
property HeaderBitmap: TBitmap read FHeaderBitmap;
|
||||||
property PositionToIndex: TIndexArray read FPositionToIndex;
|
property PositionToIndex: TIndexArray read FPositionToIndex;
|
||||||
|
property HoverIndex: TColumnIndex read FHoverIndex;
|
||||||
|
property DownIndex: TColumnIndex read FDownIndex;
|
||||||
|
property CheckBoxHit: Boolean read FCheckBoxHit;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TVTHeader);
|
constructor Create(AOwner: TVTHeader); virtual;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
function Add: TVirtualTreeColumn; virtual;
|
function Add: TVirtualTreeColumn; virtual;
|
||||||
@ -1318,12 +1323,11 @@ type
|
|||||||
published
|
published
|
||||||
property AutoSizeIndex: TColumnIndex read FAutoSizeIndex write SetAutoSizeIndex;
|
property AutoSizeIndex: TColumnIndex read FAutoSizeIndex write SetAutoSizeIndex;
|
||||||
property Background: TColor read FBackground write SetBackground default clBtnFace;
|
property Background: TColor read FBackground write SetBackground default clBtnFace;
|
||||||
property Columns: TVirtualTreeColumns read FColumns write SetColumns stored False; // Stored by the owner tree to
|
property Columns: TVirtualTreeColumns read FColumns write SetColumns stored False; // Stored by the owner tree to support VFI.
|
||||||
// support VFI.
|
property DefaultHeight: Integer read FDefaultHeight write SetDefaultHeight default 19;
|
||||||
property DefaultHeight: Integer read FDefaultHeight write SetDefaultHeight default 17;
|
|
||||||
property Font: TFont read FFont write SetFont stored IsFontStored;
|
property Font: TFont read FFont write SetFont stored IsFontStored;
|
||||||
property FixedAreaConstraints: TVTFixedAreaConstraints read FFixedAreaConstraints write FFixedAreaConstraints;
|
property FixedAreaConstraints: TVTFixedAreaConstraints read FFixedAreaConstraints write FFixedAreaConstraints;
|
||||||
property Height: Integer read FHeight write SetHeight default 17;
|
property Height: Integer read FHeight write SetHeight default 19;
|
||||||
property Images: TCustomImageList read FImages write SetImages;
|
property Images: TCustomImageList read FImages write SetImages;
|
||||||
property MainColumn: TColumnIndex read GetMainColumn write SetMainColumn default 0;
|
property MainColumn: TColumnIndex read GetMainColumn write SetMainColumn default 0;
|
||||||
property MaxHeight: Integer read FMaxHeight write SetMaxHeight default 10000;
|
property MaxHeight: Integer read FMaxHeight write SetMaxHeight default 10000;
|
||||||
@ -1430,7 +1434,6 @@ type
|
|||||||
tsMouseCheckPending, // A check operation is under way, initiated by a mouse click. Ignore space key.
|
tsMouseCheckPending, // A check operation is under way, initiated by a mouse click. Ignore space key.
|
||||||
tsMiddleButtonDown, // Set when the middle mouse button is down.
|
tsMiddleButtonDown, // Set when the middle mouse button is down.
|
||||||
tsMiddleDblClick, // Set when the middle mouse button was doubly clicked.
|
tsMiddleDblClick, // Set when the middle mouse button was doubly clicked.
|
||||||
tsNeedScale, // On next ChangeScale scale the default node height.
|
|
||||||
tsNeedRootCountUpdate, // Set if while loading a root node count is set.
|
tsNeedRootCountUpdate, // Set if while loading a root node count is set.
|
||||||
tsOLEDragging, // OLE dragging in progress.
|
tsOLEDragging, // OLE dragging in progress.
|
||||||
tsOLEDragPending, // User has requested to start delayed dragging.
|
tsOLEDragPending, // User has requested to start delayed dragging.
|
||||||
@ -1852,6 +1855,11 @@ type
|
|||||||
// operations
|
// operations
|
||||||
TVTOperationEvent = procedure(Sender: TBaseVirtualTree; OperationKind: TVTOperationKind) of object;
|
TVTOperationEvent = procedure(Sender: TBaseVirtualTree; OperationKind: TVTOperationKind) of object;
|
||||||
|
|
||||||
|
TVTHintKind = (vhkText, vhkOwnerDraw);
|
||||||
|
TVTHintKindEvent = procedure(sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; var Kind: TVTHintKind) of object;
|
||||||
|
TVTDrawHintEvent = procedure(Sender: TBaseVirtualTree; HintCanvas: TCanvas; Node: PVirtualNode; R: TRect; Column: TColumnIndex) of object;
|
||||||
|
TVTGetHintSizeEvent = procedure(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; var R: TRect) of object;
|
||||||
|
|
||||||
// miscellaneous
|
// miscellaneous
|
||||||
TVTBeforeDrawLineImageEvent = procedure(Sender: TBaseVirtualTree; Node: PVirtualNode; Level: Integer; var PosX: Integer) of object;
|
TVTBeforeDrawLineImageEvent = procedure(Sender: TBaseVirtualTree; Node: PVirtualNode; Level: Integer; var PosX: Integer) of object;
|
||||||
TVTGetNodeDataSizeEvent = procedure(Sender: TBaseVirtualTree; var NodeDataSize: Integer) of object;
|
TVTGetNodeDataSizeEvent = procedure(Sender: TBaseVirtualTree; var NodeDataSize: Integer) of object;
|
||||||
@ -2115,6 +2123,7 @@ type
|
|||||||
FDropTargetNode: PVirtualNode; // node currently selected as drop target
|
FDropTargetNode: PVirtualNode; // node currently selected as drop target
|
||||||
FLastDropMode: TDropMode; // set while dragging and used to track changes
|
FLastDropMode: TDropMode; // set while dragging and used to track changes
|
||||||
FDragSelection: TNodeArray; // temporary copy of FSelection used during drag'n drop
|
FDragSelection: TNodeArray; // temporary copy of FSelection used during drag'n drop
|
||||||
|
FLastDragEffect: LongWord; // The last executed drag effect
|
||||||
FDragType: TVTDragType; // used to switch between OLE and VCL drag'n drop
|
FDragType: TVTDragType; // used to switch between OLE and VCL drag'n drop
|
||||||
FDragImage: TVTDragImage; // drag image management
|
FDragImage: TVTDragImage; // drag image management
|
||||||
FDragWidth,
|
FDragWidth,
|
||||||
@ -2311,7 +2320,12 @@ type
|
|||||||
|
|
||||||
// search, sort
|
// search, sort
|
||||||
FOnCompareNodes: TVTCompareEvent; // used during sort
|
FOnCompareNodes: TVTCompareEvent; // used during sort
|
||||||
|
FOnDrawHint: TVTDrawHintEvent;
|
||||||
|
FOnGetHintSize: TVTGetHintSizeEvent;
|
||||||
|
fOnGetHintKind: TVTHintKindEvent;
|
||||||
FOnIncrementalSearch: TVTIncrementalSearchEvent; // triggered on every key press (not key down)
|
FOnIncrementalSearch: TVTIncrementalSearchEvent; // triggered on every key press (not key down)
|
||||||
|
FOnMouseEnter: TNotifyEvent;
|
||||||
|
FOnMouseLeave: TNotifyEvent;
|
||||||
|
|
||||||
// operations
|
// operations
|
||||||
FOnStartOperation: TVTOperationEvent; // Called when an operation starts
|
FOnStartOperation: TVTOperationEvent; // Called when an operation starts
|
||||||
@ -2452,6 +2466,7 @@ type
|
|||||||
//procedure CMDrag(var Message: TCMDrag); message CM_DRAG;
|
//procedure CMDrag(var Message: TCMDrag); message CM_DRAG;
|
||||||
procedure CMFontChanged(var Message: TLMessage); message CM_FONTCHANGED;
|
procedure CMFontChanged(var Message: TLMessage); message CM_FONTCHANGED;
|
||||||
procedure CMHintShow(var Message: TCMHintShow); message CM_HINTSHOW;
|
procedure CMHintShow(var Message: TCMHintShow); message CM_HINTSHOW;
|
||||||
|
procedure CMMouseEnter(var Message: TLMessage); message CM_MOUSEENTER;
|
||||||
procedure CMMouseLeave(var Message: TLMessage); message CM_MOUSELEAVE;
|
procedure CMMouseLeave(var Message: TLMessage); message CM_MOUSELEAVE;
|
||||||
procedure CMMouseWheel(var Message: TLMMouseEvent); message LM_MOUSEWHEEL;
|
procedure CMMouseWheel(var Message: TLMMouseEvent); message LM_MOUSEWHEEL;
|
||||||
{$ifdef EnableNativeTVM}
|
{$ifdef EnableNativeTVM}
|
||||||
@ -2584,10 +2599,13 @@ type
|
|||||||
var Effect: LongWord): Boolean; virtual;
|
var Effect: LongWord): Boolean; virtual;
|
||||||
procedure DoDragDrop(Source: TObject; DataObject: IDataObject; Formats: TFormatArray; Shift: TShiftState; const Pt: TPoint;
|
procedure DoDragDrop(Source: TObject; DataObject: IDataObject; Formats: TFormatArray; Shift: TShiftState; const Pt: TPoint;
|
||||||
var Effect: LongWord; Mode: TDropMode); virtual;
|
var Effect: LongWord; Mode: TDropMode); virtual;
|
||||||
|
procedure DoDrawHint(Canvas: TCanvas; Node: PVirtualNode; R: TRect; Column:
|
||||||
|
TColumnIndex);
|
||||||
procedure DoEdit; virtual;
|
procedure DoEdit; virtual;
|
||||||
procedure DoEndDrag(Target: TObject; X, Y: Integer); override;
|
procedure DoEndDrag(Target: TObject; X, Y: Integer); override;
|
||||||
function DoEndEdit: Boolean; virtual;
|
function DoEndEdit: Boolean; virtual;
|
||||||
procedure DoEndOperation(OperationKind: TVTOperationKind); virtual;
|
procedure DoEndOperation(OperationKind: TVTOperationKind); virtual;
|
||||||
|
procedure DoEnter(); override;
|
||||||
procedure DoExpanded(Node: PVirtualNode); virtual;
|
procedure DoExpanded(Node: PVirtualNode); virtual;
|
||||||
function DoExpanding(Node: PVirtualNode): Boolean; virtual;
|
function DoExpanding(Node: PVirtualNode): Boolean; virtual;
|
||||||
procedure DoFocusChange(Node: PVirtualNode; Column: TColumnIndex); virtual;
|
procedure DoFocusChange(Node: PVirtualNode; Column: TColumnIndex); virtual;
|
||||||
@ -2598,6 +2616,10 @@ type
|
|||||||
CellContentMarginType: TVTCellContentMarginType = ccmtAllSides; Canvas: TCanvas = nil): TPoint; virtual;
|
CellContentMarginType: TVTCellContentMarginType = ccmtAllSides; Canvas: TCanvas = nil): TPoint; virtual;
|
||||||
procedure DoGetCursor(var Cursor: TCursor); virtual;
|
procedure DoGetCursor(var Cursor: TCursor); virtual;
|
||||||
procedure DoGetHeaderCursor(var Cursor: HCURSOR); virtual;
|
procedure DoGetHeaderCursor(var Cursor: HCURSOR); virtual;
|
||||||
|
procedure DoGetHintSize(Node: PVirtualNode; Column: TColumnIndex; var R:
|
||||||
|
TRect); virtual;
|
||||||
|
procedure DoGetHintKind(Node: PVirtualNode; Column: TColumnIndex; var Kind:
|
||||||
|
TVTHintKind);
|
||||||
function DoGetImageIndex(Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
|
function DoGetImageIndex(Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
|
||||||
var Ghosted: Boolean; var Index: Integer): TCustomImageList; virtual;
|
var Ghosted: Boolean; var Index: Integer): TCustomImageList; virtual;
|
||||||
procedure DoGetImageText(Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
|
procedure DoGetImageText(Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
|
||||||
@ -2627,6 +2649,8 @@ type
|
|||||||
function DoKeyAction(var CharCode: Word; var Shift: TShiftState): Boolean; virtual;
|
function DoKeyAction(var CharCode: Word; var Shift: TShiftState): Boolean; virtual;
|
||||||
procedure DoLoadUserData(Node: PVirtualNode; Stream: TStream); virtual;
|
procedure DoLoadUserData(Node: PVirtualNode; Stream: TStream); virtual;
|
||||||
procedure DoMeasureItem(TargetCanvas: TCanvas; Node: PVirtualNode; var NodeHeight: Integer); virtual;
|
procedure DoMeasureItem(TargetCanvas: TCanvas; Node: PVirtualNode; var NodeHeight: Integer); virtual;
|
||||||
|
procedure DoMouseEnter(); virtual;
|
||||||
|
procedure DoMouseLeave(); virtual;
|
||||||
procedure DoNodeCopied(Node: PVirtualNode); virtual;
|
procedure DoNodeCopied(Node: PVirtualNode); virtual;
|
||||||
function DoNodeCopying(Node, NewParent: PVirtualNode): Boolean; virtual;
|
function DoNodeCopying(Node, NewParent: PVirtualNode): Boolean; virtual;
|
||||||
procedure DoNodeClick(const HitInfo: THitInfo); virtual;
|
procedure DoNodeClick(const HitInfo: THitInfo); virtual;
|
||||||
@ -2677,10 +2701,12 @@ type
|
|||||||
class function GetCheckImageListFor(Kind: TCheckImageKind): TCustomImageList; virtual;
|
class function GetCheckImageListFor(Kind: TCheckImageKind): TCustomImageList; virtual;
|
||||||
function GetClientRect: TRect; override;
|
function GetClientRect: TRect; override;
|
||||||
function GetColumnClass: TVirtualTreeColumnClass; virtual;
|
function GetColumnClass: TVirtualTreeColumnClass; virtual;
|
||||||
|
function GetDefaultHintKind: TVTHintKind; virtual;
|
||||||
function GetHeaderClass: TVTHeaderClass; virtual;
|
function GetHeaderClass: TVTHeaderClass; virtual;
|
||||||
function GetHintWindowClass: THintWindowClass; virtual;
|
function GetHintWindowClass: THintWindowClass; virtual;
|
||||||
procedure GetImageIndex(var Info: TVTPaintInfo; Kind: TVTImageKind; InfoIndex: TVTImageInfoIndex;
|
procedure GetImageIndex(var Info: TVTPaintInfo; Kind: TVTImageKind; InfoIndex: TVTImageInfoIndex;
|
||||||
DefaultImages: TCustomImageList); virtual;
|
DefaultImages: TCustomImageList); virtual;
|
||||||
|
function GetNodeImageSize(Node: PVirtualNode): TSize; virtual;
|
||||||
function GetMaxRightExtend: Cardinal; virtual;
|
function GetMaxRightExtend: Cardinal; virtual;
|
||||||
procedure GetNativeClipboardFormats(var Formats: TFormatEtcArray); virtual;
|
procedure GetNativeClipboardFormats(var Formats: TFormatEtcArray); virtual;
|
||||||
function GetOperationCanceled: Boolean;
|
function GetOperationCanceled: Boolean;
|
||||||
@ -2784,12 +2810,14 @@ type
|
|||||||
property ClipboardFormats: TClipboardFormats read FClipboardFormats write SetClipboardFormats;
|
property ClipboardFormats: TClipboardFormats read FClipboardFormats write SetClipboardFormats;
|
||||||
property Colors: TVTColors read FColors write SetColors;
|
property Colors: TVTColors read FColors write SetColors;
|
||||||
property CustomCheckImages: TBitmap read FCustomCheckImages write SetCustomCheckImages;
|
property CustomCheckImages: TBitmap read FCustomCheckImages write SetCustomCheckImages;
|
||||||
|
property DefaultHintKind: TVTHintKind read GetDefaultHintKind;
|
||||||
property DefaultNodeHeight: Cardinal read FDefaultNodeHeight write SetDefaultNodeHeight default 18;
|
property DefaultNodeHeight: Cardinal read FDefaultNodeHeight write SetDefaultNodeHeight default 18;
|
||||||
property DefaultPasteMode: TVTNodeAttachMode read FDefaultPasteMode write FDefaultPasteMode default amAddChildLast;
|
property DefaultPasteMode: TVTNodeAttachMode read FDefaultPasteMode write FDefaultPasteMode default amAddChildLast;
|
||||||
property DragHeight: Integer read FDragHeight write FDragHeight default 350;
|
property DragHeight: Integer read FDragHeight write FDragHeight default 350;
|
||||||
property DragImageKind: TVTDragImageKind read FDragImageKind write FDragImageKind default diComplete;
|
property DragImageKind: TVTDragImageKind read FDragImageKind write FDragImageKind default diComplete;
|
||||||
property DragOperations: TDragOperations read FDragOperations write FDragOperations default [doCopy, doMove];
|
property DragOperations: TDragOperations read FDragOperations write FDragOperations default [doCopy, doMove];
|
||||||
property DragSelection: TNodeArray read FDragSelection;
|
property DragSelection: TNodeArray read FDragSelection;
|
||||||
|
property LastDragEffect: LongWord read FLastDragEffect;
|
||||||
property DragType: TVTDragType read FDragType write FDragType default dtOLE;
|
property DragType: TVTDragType read FDragType write FDragType default dtOLE;
|
||||||
property DragWidth: Integer read FDragWidth write FDragWidth default 200;
|
property DragWidth: Integer read FDragWidth write FDragWidth default 200;
|
||||||
property DrawSelectionMode: TVTDrawSelectionMode read FDrawSelectionMode write FDrawSelectionMode
|
property DrawSelectionMode: TVTDrawSelectionMode read FDrawSelectionMode write FDrawSelectionMode
|
||||||
@ -2887,6 +2915,7 @@ type
|
|||||||
property OnDragAllowed: TVTDragAllowedEvent read FOnDragAllowed write FOnDragAllowed;
|
property OnDragAllowed: TVTDragAllowedEvent read FOnDragAllowed write FOnDragAllowed;
|
||||||
property OnDragOver: TVTDragOverEvent read FOnDragOver write FOnDragOver;
|
property OnDragOver: TVTDragOverEvent read FOnDragOver write FOnDragOver;
|
||||||
property OnDragDrop: TVTDragDropEvent read FOnDragDrop write FOnDragDrop;
|
property OnDragDrop: TVTDragDropEvent read FOnDragDrop write FOnDragDrop;
|
||||||
|
property OnDrawHint: TVTDrawHintEvent read FOnDrawHint write FOnDrawHint;
|
||||||
property OnEditCancelled: TVTEditCancelEvent read FOnEditCancelled write FOnEditCancelled;
|
property OnEditCancelled: TVTEditCancelEvent read FOnEditCancelled write FOnEditCancelled;
|
||||||
property OnEditing: TVTEditChangingEvent read FOnEditing write FOnEditing;
|
property OnEditing: TVTEditChangingEvent read FOnEditing write FOnEditing;
|
||||||
property OnEdited: TVTEditChangeEvent read FOnEdited write FOnEdited;
|
property OnEdited: TVTEditChangeEvent read FOnEdited write FOnEdited;
|
||||||
@ -2900,6 +2929,10 @@ type
|
|||||||
property OnGetCursor: TVTGetCursorEvent read FOnGetCursor write FOnGetCursor;
|
property OnGetCursor: TVTGetCursorEvent read FOnGetCursor write FOnGetCursor;
|
||||||
property OnGetHeaderCursor: TVTGetHeaderCursorEvent read FOnGetHeaderCursor write FOnGetHeaderCursor;
|
property OnGetHeaderCursor: TVTGetHeaderCursorEvent read FOnGetHeaderCursor write FOnGetHeaderCursor;
|
||||||
property OnGetHelpContext: TVTHelpContextEvent read FOnGetHelpContext write FOnGetHelpContext;
|
property OnGetHelpContext: TVTHelpContextEvent read FOnGetHelpContext write FOnGetHelpContext;
|
||||||
|
property OnGetHintSize: TVTGetHintSizeEvent read FOnGetHintSize write
|
||||||
|
FOnGetHintSize;
|
||||||
|
property OnGetHintKind: TVTHintKindEvent read fOnGetHintKind write
|
||||||
|
fOnGetHintKind;
|
||||||
property OnGetImageIndex: TVTGetImageEvent read FOnGetImage write FOnGetImage;
|
property OnGetImageIndex: TVTGetImageEvent read FOnGetImage write FOnGetImage;
|
||||||
property OnGetImageIndexEx: TVTGetImageExEvent read FOnGetImageEx write FOnGetImageEx;
|
property OnGetImageIndexEx: TVTGetImageExEvent read FOnGetImageEx write FOnGetImageEx;
|
||||||
property OnGetImageText: TVTGetImageTextEvent read FOnGetImageText write FOnGetImageText;
|
property OnGetImageText: TVTGetImageTextEvent read FOnGetImageText write FOnGetImageText;
|
||||||
@ -2931,6 +2964,8 @@ type
|
|||||||
property OnLoadNode: TVTSaveNodeEvent read FOnLoadNode write FOnLoadNode;
|
property OnLoadNode: TVTSaveNodeEvent read FOnLoadNode write FOnLoadNode;
|
||||||
property OnLoadTree: TVTSaveTreeEvent read FOnLoadTree write FOnLoadTree;
|
property OnLoadTree: TVTSaveTreeEvent read FOnLoadTree write FOnLoadTree;
|
||||||
property OnMeasureItem: TVTMeasureItemEvent read FOnMeasureItem write FOnMeasureItem;
|
property OnMeasureItem: TVTMeasureItemEvent read FOnMeasureItem write FOnMeasureItem;
|
||||||
|
property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
|
||||||
|
property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
|
||||||
property OnNodeClick: TVTNodeClickEvent read FOnNodeClick write FOnNodeClick;
|
property OnNodeClick: TVTNodeClickEvent read FOnNodeClick write FOnNodeClick;
|
||||||
property OnNodeCopied: TVTNodeCopiedEvent read FOnNodeCopied write FOnNodeCopied;
|
property OnNodeCopied: TVTNodeCopiedEvent read FOnNodeCopied write FOnNodeCopied;
|
||||||
property OnNodeCopying: TVTNodeCopyingEvent read FOnNodeCopying write FOnNodeCopying;
|
property OnNodeCopying: TVTNodeCopyingEvent read FOnNodeCopying write FOnNodeCopying;
|
||||||
@ -2955,10 +2990,6 @@ type
|
|||||||
property OnUpdating: TVTUpdatingEvent read FOnUpdating write FOnUpdating;
|
property OnUpdating: TVTUpdatingEvent read FOnUpdating write FOnUpdating;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
{$ifdef VCLStyleSupport}
|
|
||||||
class constructor Create;
|
|
||||||
class destructor Destroy;
|
|
||||||
{$ifend}
|
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
function AbsoluteIndex(Node: PVirtualNode): Cardinal;
|
function AbsoluteIndex(Node: PVirtualNode): Cardinal;
|
||||||
@ -3047,6 +3078,7 @@ type
|
|||||||
function GetNextVisibleNoInit(Node: PVirtualNode; ConsiderChildrenAbove: Boolean = True): PVirtualNode;
|
function GetNextVisibleNoInit(Node: PVirtualNode; ConsiderChildrenAbove: Boolean = True): PVirtualNode;
|
||||||
function GetNextVisibleSibling(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
function GetNextVisibleSibling(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||||
function GetNextVisibleSiblingNoInit(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
function GetNextVisibleSiblingNoInit(Node: PVirtualNode; IncludeFiltered: Boolean = False): PVirtualNode;
|
||||||
|
function GetNodeAt(const P: TPoint): PVirtualNode; overload; inline;
|
||||||
function GetNodeAt(X, Y: Integer): PVirtualNode; overload;
|
function GetNodeAt(X, Y: Integer): PVirtualNode; overload;
|
||||||
function GetNodeAt(X, Y: Integer; Relative: Boolean; var NodeTop: Integer): PVirtualNode; overload;
|
function GetNodeAt(X, Y: Integer; Relative: Boolean; var NodeTop: Integer): PVirtualNode; overload;
|
||||||
function GetNodeData(Node: PVirtualNode): Pointer;
|
function GetNodeData(Node: PVirtualNode): Pointer;
|
||||||
@ -3465,6 +3497,7 @@ type
|
|||||||
public
|
public
|
||||||
property Canvas;
|
property Canvas;
|
||||||
property RangeX;
|
property RangeX;
|
||||||
|
property LastDragEffect;
|
||||||
published
|
published
|
||||||
{$ifdef EnableAccessible}
|
{$ifdef EnableAccessible}
|
||||||
property AccessibleName;
|
property AccessibleName;
|
||||||
@ -3602,6 +3635,7 @@ type
|
|||||||
property OnDragAllowed;
|
property OnDragAllowed;
|
||||||
property OnDragOver;
|
property OnDragOver;
|
||||||
property OnDragDrop;
|
property OnDragDrop;
|
||||||
|
property OnDrawHint;
|
||||||
property OnDrawText;
|
property OnDrawText;
|
||||||
property OnEditCancelled;
|
property OnEditCancelled;
|
||||||
property OnEdited;
|
property OnEdited;
|
||||||
@ -3622,6 +3656,8 @@ type
|
|||||||
property OnGetText;
|
property OnGetText;
|
||||||
property OnPaintText;
|
property OnPaintText;
|
||||||
property OnGetHelpContext;
|
property OnGetHelpContext;
|
||||||
|
property OnGetHintKind;
|
||||||
|
property OnGetHintSize;
|
||||||
property OnGetImageIndex;
|
property OnGetImageIndex;
|
||||||
property OnGetImageIndexEx;
|
property OnGetImageIndexEx;
|
||||||
property OnGetImageText;
|
property OnGetImageText;
|
||||||
@ -3659,6 +3695,8 @@ type
|
|||||||
property OnMouseMove;
|
property OnMouseMove;
|
||||||
property OnMouseUp;
|
property OnMouseUp;
|
||||||
property OnMouseWheel;
|
property OnMouseWheel;
|
||||||
|
property OnMouseEnter;
|
||||||
|
property OnMouseLeave;
|
||||||
property OnNewText;
|
property OnNewText;
|
||||||
property OnNodeClick;
|
property OnNodeClick;
|
||||||
property OnNodeCopied;
|
property OnNodeCopied;
|
||||||
@ -3690,15 +3728,11 @@ type
|
|||||||
//property OnCanResize;
|
//property OnCanResize;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TVTDrawHintEvent = procedure(Sender: TBaseVirtualTree; HintCanvas: TCanvas; Node: PVirtualNode; const R: TRect;
|
|
||||||
Column: TColumnIndex) of object;
|
|
||||||
TVTDrawNodeEvent = procedure(Sender: TBaseVirtualTree; const PaintInfo: TVTPaintInfo) of object;
|
TVTDrawNodeEvent = procedure(Sender: TBaseVirtualTree; const PaintInfo: TVTPaintInfo) of object;
|
||||||
TVTGetCellContentMarginEvent = procedure(Sender: TBaseVirtualTree; HintCanvas: TCanvas; Node: PVirtualNode;
|
TVTGetCellContentMarginEvent = procedure(Sender: TBaseVirtualTree; HintCanvas: TCanvas; Node: PVirtualNode;
|
||||||
Column: TColumnIndex; CellContentMarginType: TVTCellContentMarginType; var CellContentMargin: TPoint) of object;
|
Column: TColumnIndex; CellContentMarginType: TVTCellContentMarginType; var CellContentMargin: TPoint) of object;
|
||||||
TVTGetNodeWidthEvent = procedure(Sender: TBaseVirtualTree; HintCanvas: TCanvas; Node: PVirtualNode;
|
TVTGetNodeWidthEvent = procedure(Sender: TBaseVirtualTree; HintCanvas: TCanvas; Node: PVirtualNode;
|
||||||
Column: TColumnIndex; var NodeWidth: Integer) of object;
|
Column: TColumnIndex; var NodeWidth: Integer) of object;
|
||||||
TVTGetHintSizeEvent = procedure(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex;
|
|
||||||
var R: TRect) of object;
|
|
||||||
|
|
||||||
// Tree descendant to let an application draw its stuff itself.
|
// Tree descendant to let an application draw its stuff itself.
|
||||||
TCustomVirtualDrawTree = class(TBaseVirtualTree)
|
TCustomVirtualDrawTree = class(TBaseVirtualTree)
|
||||||
@ -3706,20 +3740,15 @@ type
|
|||||||
FOnDrawNode: TVTDrawNodeEvent;
|
FOnDrawNode: TVTDrawNodeEvent;
|
||||||
FOnGetCellContentMargin: TVTGetCellContentMarginEvent;
|
FOnGetCellContentMargin: TVTGetCellContentMarginEvent;
|
||||||
FOnGetNodeWidth: TVTGetNodeWidthEvent;
|
FOnGetNodeWidth: TVTGetNodeWidthEvent;
|
||||||
FOnGetHintSize: TVTGetHintSizeEvent;
|
|
||||||
FOnDrawHint: TVTDrawHintEvent;
|
|
||||||
protected
|
protected
|
||||||
procedure DoDrawHint(Canvas: TCanvas; Node: PVirtualNode; const R: TRect; Column: TColumnIndex);
|
|
||||||
function DoGetCellContentMargin(Node: PVirtualNode; Column: TColumnIndex;
|
function DoGetCellContentMargin(Node: PVirtualNode; Column: TColumnIndex;
|
||||||
CellContentMarginType: TVTCellContentMarginType = ccmtAllSides; Canvas: TCanvas = nil): TPoint; override;
|
CellContentMarginType: TVTCellContentMarginType = ccmtAllSides; Canvas: TCanvas = nil): TPoint; override;
|
||||||
procedure DoGetHintSize(Node: PVirtualNode; Column: TColumnIndex; var R: TRect); virtual;
|
|
||||||
function DoGetNodeWidth(Node: PVirtualNode; Column: TColumnIndex; Canvas: TCanvas = nil): Integer; override;
|
function DoGetNodeWidth(Node: PVirtualNode; Column: TColumnIndex; Canvas: TCanvas = nil): Integer; override;
|
||||||
procedure DoPaintNode(var PaintInfo: TVTPaintInfo); override;
|
procedure DoPaintNode(var PaintInfo: TVTPaintInfo); override;
|
||||||
|
function GetDefaultHintKind: TVTHintKind; override;
|
||||||
|
|
||||||
property OnDrawHint: TVTDrawHintEvent read FOnDrawHint write FOnDrawHint;
|
|
||||||
property OnDrawNode: TVTDrawNodeEvent read FOnDrawNode write FOnDrawNode;
|
property OnDrawNode: TVTDrawNodeEvent read FOnDrawNode write FOnDrawNode;
|
||||||
property OnGetCellContentMargin: TVTGetCellContentMarginEvent read FOnGetCellContentMargin write FOnGetCellContentMargin;
|
property OnGetCellContentMargin: TVTGetCellContentMarginEvent read FOnGetCellContentMargin write FOnGetCellContentMargin;
|
||||||
property OnGetHintSize: TVTGetHintSizeEvent read FOnGetHintSize write FOnGetHintSize;
|
|
||||||
property OnGetNodeWidth: TVTGetNodeWidthEvent read FOnGetNodeWidth write FOnGetNodeWidth;
|
property OnGetNodeWidth: TVTGetNodeWidthEvent read FOnGetNodeWidth write FOnGetNodeWidth;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3731,6 +3760,7 @@ type
|
|||||||
function GetOptionsClass: TTreeOptionsClass; override;
|
function GetOptionsClass: TTreeOptionsClass; override;
|
||||||
public
|
public
|
||||||
property Canvas;
|
property Canvas;
|
||||||
|
property LastDragEffect;
|
||||||
published
|
published
|
||||||
property Action;
|
property Action;
|
||||||
property Align;
|
property Align;
|
||||||
@ -3880,6 +3910,7 @@ type
|
|||||||
property OnGetCursor;
|
property OnGetCursor;
|
||||||
property OnGetHeaderCursor;
|
property OnGetHeaderCursor;
|
||||||
property OnGetHelpContext;
|
property OnGetHelpContext;
|
||||||
|
property OnGetHintKind;
|
||||||
property OnGetHintSize;
|
property OnGetHintSize;
|
||||||
property OnGetImageIndex;
|
property OnGetImageIndex;
|
||||||
property OnGetImageIndexEx;
|
property OnGetImageIndexEx;
|
||||||
@ -5213,7 +5244,7 @@ begin
|
|||||||
{$ifdef EnableOLE}
|
{$ifdef EnableOLE}
|
||||||
// Initialize OLE subsystem for drag'n drop and clipboard operations.
|
// Initialize OLE subsystem for drag'n drop and clipboard operations.
|
||||||
//todo: replace by Suceeded (see in windows unit)
|
//todo: replace by Suceeded (see in windows unit)
|
||||||
NeedToUnitialize := OleInitialize(nil) in [S_FALSE,S_OK];
|
NeedToUnitialize := not IsLibrary and (OleInitialize(nil) in [S_FALSE,S_OK]);
|
||||||
{$endif}
|
{$endif}
|
||||||
// Register the tree reference clipboard format. Others will be handled in InternalClipboarFormats.
|
// Register the tree reference clipboard format. Others will be handled in InternalClipboarFormats.
|
||||||
CF_VTREFERENCE := ClipboardRegisterFormat(CFSTR_VTREFERENCE);
|
CF_VTREFERENCE := ClipboardRegisterFormat(CFSTR_VTREFERENCE);
|
||||||
@ -5242,6 +5273,7 @@ begin
|
|||||||
// Predefined clipboard formats. Just add them to the internal list.
|
// Predefined clipboard formats. Just add them to the internal list.
|
||||||
RegisterVTClipboardFormat(CF_TEXT, TCustomVirtualStringTree, 100);
|
RegisterVTClipboardFormat(CF_TEXT, TCustomVirtualStringTree, 100);
|
||||||
RegisterVTClipboardFormat(CF_UNICODETEXT, TCustomVirtualStringTree, 95);
|
RegisterVTClipboardFormat(CF_UNICODETEXT, TCustomVirtualStringTree, 95);
|
||||||
|
{$ifdef VCLStyleSupport}TCustomStyleEngine.RegisterStyleHook(TBaseVirtualTree, TVclStyleScrollBarsHook);{$ifend}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
@ -5255,6 +5287,8 @@ begin
|
|||||||
|
|
||||||
if NeedToUnitialize then
|
if NeedToUnitialize then
|
||||||
OleUninitialize;
|
OleUninitialize;
|
||||||
|
|
||||||
|
{$ifdef VCLStyleSupport}TCustomStyleEngine.UnRegisterStyleHook(TBaseVirtualTree, TVclStyleScrollBarsHook);{$ifend}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//----------------- TWorkerThread --------------------------------------------------------------------------------------
|
//----------------- TWorkerThread --------------------------------------------------------------------------------------
|
||||||
@ -6598,7 +6632,7 @@ begin
|
|||||||
FMaxWidth := 10000;
|
FMaxWidth := 10000;
|
||||||
FImageIndex := -1;
|
FImageIndex := -1;
|
||||||
FMargin := 4;
|
FMargin := 4;
|
||||||
FSpacing := 4;
|
FSpacing := 3;
|
||||||
FText := '';
|
FText := '';
|
||||||
FOptions := DefaultColumnOptions;
|
FOptions := DefaultColumnOptions;
|
||||||
FAlignment := taLeftJustify;
|
FAlignment := taLeftJustify;
|
||||||
@ -7182,7 +7216,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
R := Client;
|
R := Client;
|
||||||
if FCaptionText = '' then
|
if FCaptionText = '' then
|
||||||
FCaptionText := FText;
|
FCaptionText := WrapString(DC, FText, R, DT_RTLREADING and DrawFormat <> 0, DrawFormat);
|
||||||
|
|
||||||
GetStringDrawRect(DC, FCaptionText, R, DrawFormat);
|
GetStringDrawRect(DC, FCaptionText, R, DrawFormat);
|
||||||
TextSize.cx := Client.Right - Client.Left;
|
TextSize.cx := Client.Right - Client.Left;
|
||||||
@ -9428,8 +9462,8 @@ begin
|
|||||||
inherited Create;
|
inherited Create;
|
||||||
FOwner := AOwner;
|
FOwner := AOwner;
|
||||||
FColumns := GetColumnsClass.Create(Self);
|
FColumns := GetColumnsClass.Create(Self);
|
||||||
FHeight := 17;
|
FHeight := 19;
|
||||||
FDefaultHeight := 17;
|
FDefaultHeight := 19;
|
||||||
FMinHeight := 10;
|
FMinHeight := 10;
|
||||||
FMaxHeight := 10000;
|
FMaxHeight := 10000;
|
||||||
FFont := TFont.Create;
|
FFont := TFont.Create;
|
||||||
@ -9475,8 +9509,28 @@ end;
|
|||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure TVTHeader.FontChanged(Sender: TObject);
|
procedure TVTHeader.FontChanged(Sender: TObject);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
lMaxHeight: Integer;
|
||||||
begin
|
begin
|
||||||
|
if toAutoChangeScale in Treeview.TreeOptions.AutoOptions then begin
|
||||||
|
// Find the largest Columns[].Spacing
|
||||||
|
lMaxHeight := 0;
|
||||||
|
for i:= 0 to Self.Columns.Count - 1 do
|
||||||
|
lMaxHeight := Max(lMaxHeight, Columns[i].Spacing);
|
||||||
|
// Calculate the required size based on the font, this is important as the use migth just vave increased the size of the icon font
|
||||||
|
With TBitmap.Create do
|
||||||
|
try
|
||||||
|
Canvas.Font.Assign(FFont);
|
||||||
|
lMaxHeight := lMaxHeight {top spacing} + (lMaxHeight div 2) {minimum bottom spacing} + Canvas.TextHeight('Q');
|
||||||
|
finally
|
||||||
|
Free;
|
||||||
|
end;
|
||||||
|
// Get the maximum of the scaled original value an
|
||||||
|
lMaxHeight := Max(lMaxHeight, fHeight);
|
||||||
|
// Set the calculated size
|
||||||
|
Self.SetHeight(lMaxHeight);
|
||||||
|
end;
|
||||||
Invalidate(nil);
|
Invalidate(nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -9785,7 +9839,11 @@ end;
|
|||||||
procedure TVTHeader.ChangeScale(M, D: Integer);
|
procedure TVTHeader.ChangeScale(M, D: Integer);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
// This method is only executed if toAutoChangeScale is set
|
||||||
|
if not ParentFont then
|
||||||
FFont.Size := MulDiv(FFont.Size, M, D);
|
FFont.Size := MulDiv(FFont.Size, M, D);
|
||||||
|
Self.Height := MulDiv(fHeight, M, D);
|
||||||
|
//TODO: We should consider also scaling column width here
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
@ -10356,6 +10414,8 @@ begin
|
|||||||
// WM_NCLBUTTONDBLCLK
|
// WM_NCLBUTTONDBLCLK
|
||||||
Button := mbLeft;
|
Button := mbLeft;
|
||||||
end;
|
end;
|
||||||
|
if Button = mbLeft then
|
||||||
|
Columns.AdjustDownColumn(P);
|
||||||
FColumns.HandleClick(P, Button, True, True);
|
FColumns.HandleClick(P, Button, True, True);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -11806,6 +11866,7 @@ begin
|
|||||||
FDefaultPasteMode := amAddChildLast;
|
FDefaultPasteMode := amAddChildLast;
|
||||||
FMargin := 4;
|
FMargin := 4;
|
||||||
FTextMargin := 4;
|
FTextMargin := 4;
|
||||||
|
FLastDragEffect := DROPEFFECT_NONE;
|
||||||
FDragType := dtOLE;
|
FDragType := dtOLE;
|
||||||
FDragHeight := 350;
|
FDragHeight := 350;
|
||||||
FDragWidth := 200;
|
FDragWidth := 200;
|
||||||
@ -12025,7 +12086,7 @@ begin
|
|||||||
if ShowImages or ShowStateImages then
|
if ShowImages or ShowStateImages then
|
||||||
begin
|
begin
|
||||||
if ShowImages then
|
if ShowImages then
|
||||||
VAlign := FImages.Height
|
VAlign := GetNodeImageSize(Node).cy
|
||||||
else
|
else
|
||||||
VAlign := FStateImages.Height;
|
VAlign := FStateImages.Height;
|
||||||
VAlign := MulDiv((Integer(NodeHeight[Node]) - VAlign), Node.Align, 100) + VAlign div 2;
|
VAlign := MulDiv((Integer(NodeHeight[Node]) - VAlign), Node.Align, 100) + VAlign div 2;
|
||||||
@ -12216,7 +12277,6 @@ var
|
|||||||
NodeWidth,
|
NodeWidth,
|
||||||
Dummy: Integer;
|
Dummy: Integer;
|
||||||
MinY, MaxY: Integer;
|
MinY, MaxY: Integer;
|
||||||
ImageOffset,
|
|
||||||
StateImageOffset: Integer;
|
StateImageOffset: Integer;
|
||||||
IsInOldRect,
|
IsInOldRect,
|
||||||
IsInNewRect: Boolean;
|
IsInNewRect: Boolean;
|
||||||
@ -12242,10 +12302,6 @@ begin
|
|||||||
WithCheck := (toCheckSupport in FOptions.FMiscOptions) and Assigned(FCheckImages);
|
WithCheck := (toCheckSupport in FOptions.FMiscOptions) and Assigned(FCheckImages);
|
||||||
// Don't check the events here as descendant trees might have overriden the DoGetImageIndex method.
|
// Don't check the events here as descendant trees might have overriden the DoGetImageIndex method.
|
||||||
WithImages := Assigned(FImages);
|
WithImages := Assigned(FImages);
|
||||||
if WithImages then
|
|
||||||
ImageOffset := FImages.Width + 2
|
|
||||||
else
|
|
||||||
ImageOffset := 0;
|
|
||||||
WithStateImages := Assigned(FStateImages);
|
WithStateImages := Assigned(FStateImages);
|
||||||
if WithStateImages then
|
if WithStateImages then
|
||||||
StateImageOffset := FStateImages.Width + 2
|
StateImageOffset := FStateImages.Width + 2
|
||||||
@ -12278,10 +12334,9 @@ begin
|
|||||||
if WithCheck and (Run.CheckType <> ctNone) then
|
if WithCheck and (Run.CheckType <> ctNone) then
|
||||||
Inc(TextLeft, CheckOffset);
|
Inc(TextLeft, CheckOffset);
|
||||||
if WithImages and HasImage(Run, ikNormal, MainColumn) then
|
if WithImages and HasImage(Run, ikNormal, MainColumn) then
|
||||||
Inc(TextLeft, ImageOffset);
|
Inc(TextLeft, GetNodeImageSize(run).cx + 2);
|
||||||
if WithStateImages and HasImage(Run, ikState, MainColumn) then
|
if WithStateImages and HasImage(Run, ikState, MainColumn) then
|
||||||
Inc(TextLeft, StateImageOffset);
|
Inc(TextLeft, StateImageOffset);
|
||||||
|
|
||||||
// Ensure the node's height is determined.
|
// Ensure the node's height is determined.
|
||||||
MeasureItemHeight(Canvas, Run);
|
MeasureItemHeight(Canvas, Run);
|
||||||
|
|
||||||
@ -12403,7 +12458,6 @@ var
|
|||||||
NodeWidth,
|
NodeWidth,
|
||||||
Dummy: Integer;
|
Dummy: Integer;
|
||||||
MinY, MaxY: Integer;
|
MinY, MaxY: Integer;
|
||||||
ImageOffset,
|
|
||||||
StateImageOffset: Integer;
|
StateImageOffset: Integer;
|
||||||
IsInOldRect,
|
IsInOldRect,
|
||||||
IsInNewRect: Boolean;
|
IsInNewRect: Boolean;
|
||||||
@ -12431,10 +12485,6 @@ begin
|
|||||||
WithCheck := (toCheckSupport in FOptions.FMiscOptions) and Assigned(FCheckImages);
|
WithCheck := (toCheckSupport in FOptions.FMiscOptions) and Assigned(FCheckImages);
|
||||||
// Don't check the events here as descendant trees might have overriden the DoGetImageIndex method.
|
// Don't check the events here as descendant trees might have overriden the DoGetImageIndex method.
|
||||||
WithImages := Assigned(FImages);
|
WithImages := Assigned(FImages);
|
||||||
if WithImages then
|
|
||||||
ImageOffset := FImages.Width + 2
|
|
||||||
else
|
|
||||||
ImageOffset := 0;
|
|
||||||
WithStateImages := Assigned(FStateImages);
|
WithStateImages := Assigned(FStateImages);
|
||||||
if WithStateImages then
|
if WithStateImages then
|
||||||
StateImageOffset := FStateImages.Width + 2
|
StateImageOffset := FStateImages.Width + 2
|
||||||
@ -12467,7 +12517,7 @@ begin
|
|||||||
if WithCheck and (Run.CheckType <> ctNone) then
|
if WithCheck and (Run.CheckType <> ctNone) then
|
||||||
Dec(TextRight, CheckOffset);
|
Dec(TextRight, CheckOffset);
|
||||||
if WithImages and HasImage(Run, ikNormal, MainColumn) then
|
if WithImages and HasImage(Run, ikNormal, MainColumn) then
|
||||||
Dec(TextRight, ImageOffset);
|
Dec(TextRight, GetNodeImageSize(run).cx + 2);
|
||||||
if WithStateImages and HasImage(Run, ikState, MainColumn) then
|
if WithStateImages and HasImage(Run, ikState, MainColumn) then
|
||||||
Dec(TextRight, StateImageOffset);
|
Dec(TextRight, StateImageOffset);
|
||||||
|
|
||||||
@ -14194,7 +14244,6 @@ begin
|
|||||||
Value := 18;
|
Value := 18;
|
||||||
if FDefaultNodeHeight <> Value then
|
if FDefaultNodeHeight <> Value then
|
||||||
begin
|
begin
|
||||||
DoStateChange([tsNeedScale]);
|
|
||||||
Inc(Integer(FRoot.TotalHeight), Integer(Value) - Integer(FDefaultNodeHeight));
|
Inc(Integer(FRoot.TotalHeight), Integer(Value) - Integer(FDefaultNodeHeight));
|
||||||
Inc(SmallInt(FRoot.NodeHeight), Integer(Value) - Integer(FDefaultNodeHeight));
|
Inc(SmallInt(FRoot.NodeHeight), Integer(Value) - Integer(FDefaultNodeHeight));
|
||||||
FDefaultNodeHeight := Value;
|
FDefaultNodeHeight := Value;
|
||||||
@ -15328,7 +15377,7 @@ var
|
|||||||
ParentForm: TCustomForm;
|
ParentForm: TCustomForm;
|
||||||
BottomRightCellContentMargin: TPoint;
|
BottomRightCellContentMargin: TPoint;
|
||||||
DummyLineBreakStyle: TVTTooltipLineBreakStyle;
|
DummyLineBreakStyle: TVTTooltipLineBreakStyle;
|
||||||
|
HintKind: TVTHintKind;
|
||||||
begin
|
begin
|
||||||
with Message do
|
with Message do
|
||||||
begin
|
begin
|
||||||
@ -15394,19 +15443,19 @@ begin
|
|||||||
begin
|
begin
|
||||||
if Assigned(HitInfo.HitNode) and (HitInfo.HitColumn > InvalidColumn) then
|
if Assigned(HitInfo.HitNode) and (HitInfo.HitColumn > InvalidColumn) then
|
||||||
begin
|
begin
|
||||||
// A draw tree should only display a hint when at least its OnGetHintSize
|
// An owner-draw tree should only display a hint when at least
|
||||||
// event handler is assigned.
|
// its OnGetHintSize event handler is assigned.
|
||||||
if Self is TCustomVirtualDrawTree then
|
DoGetHintKind(HitInfo.HitNode, HitInfo.HitColumn, HintKind);
|
||||||
begin
|
|
||||||
FHintData.HintRect := Rect(0, 0, 0, 0);
|
FHintData.HintRect := Rect(0, 0, 0, 0);
|
||||||
with Self as TCustomVirtualDrawTree do
|
if (HintKind = vhkOwnerDraw) then
|
||||||
|
begin
|
||||||
DoGetHintSize(HitInfo.HitNode, HitInfo.HitColumn, FHintData.HintRect);
|
DoGetHintSize(HitInfo.HitNode, HitInfo.HitColumn, FHintData.HintRect);
|
||||||
ShowOwnHint := not IsRectEmpty(FHintData.HintRect);
|
ShowOwnHint := not IsRectEmpty(FHintData.HintRect);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
// For string trees a decision about showing the hint or not is based
|
// For trees displaying text hints, a decision about showing the hint or not is based
|
||||||
// on the hint string (if it is empty then no hint is shown).
|
// on the hint string (if it is empty then no hint is shown).
|
||||||
ShowOwnHint := True;
|
ShowOwnHint := true;
|
||||||
|
|
||||||
if ShowOwnHint then
|
if ShowOwnHint then
|
||||||
begin
|
begin
|
||||||
@ -15549,6 +15598,13 @@ end;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
procedure TBaseVirtualTree.CMMouseEnter(var Message: TLMessage);
|
||||||
|
begin
|
||||||
|
DoMouseEnter();
|
||||||
|
end;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure TBaseVirtualTree.CMMouseLeave(var Message: TLMessage);
|
procedure TBaseVirtualTree.CMMouseLeave(var Message: TLMessage);
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -15582,7 +15638,7 @@ begin
|
|||||||
Header.FColumns.FHoverIndex := NoColumn;
|
Header.FColumns.FHoverIndex := NoColumn;
|
||||||
Header.FColumns.FCheckBoxHit := False;
|
Header.FColumns.FCheckBoxHit := False;
|
||||||
end;
|
end;
|
||||||
|
DoMouseLeave();
|
||||||
inherited CMMouseLeave(Message);
|
inherited CMMouseLeave(Message);
|
||||||
{$ifdef DEBUG_VTV}Logger.ExitMethod([lcMessages],'CMMouseLeave');{$endif}
|
{$ifdef DEBUG_VTV}Logger.ExitMethod([lcMessages],'CMMouseLeave');{$endif}
|
||||||
end;
|
end;
|
||||||
@ -16125,7 +16181,7 @@ begin
|
|||||||
FCheckNode := nil;
|
FCheckNode := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if CharCode in [VK_HOME, VK_END, VK_PRIOR, VK_NEXT, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT, VK_BACK, VK_TAB] then
|
if (CharCode in [VK_HOME, VK_END, VK_PRIOR, VK_NEXT, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT, VK_BACK, VK_TAB]) and (RootNode.FirstChild<>nil) then
|
||||||
begin
|
begin
|
||||||
HandleMultiSelect := (ssShift in Shift) and (toMultiSelect in FOptions.FSelectionOptions) and not IsEditing;
|
HandleMultiSelect := (ssShift in Shift) and (toMultiSelect in FOptions.FSelectionOptions) and not IsEditing;
|
||||||
|
|
||||||
@ -17820,24 +17876,14 @@ end;
|
|||||||
|
|
||||||
procedure TBaseVirtualTree.ChangeScale(M, D: Integer);
|
procedure TBaseVirtualTree.ChangeScale(M, D: Integer);
|
||||||
|
|
||||||
var
|
|
||||||
DoScale: Boolean;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
if (M <> D) and (toAutoChangeScale in FOptions.FAutoOptions) then
|
if (M <> D) and (toAutoChangeScale in FOptions.FAutoOptions) then
|
||||||
begin
|
|
||||||
if (csLoading in ComponentState) then
|
|
||||||
DoScale := tsNeedScale in FStates
|
|
||||||
else
|
|
||||||
DoScale := True;
|
|
||||||
if DoScale then
|
|
||||||
begin
|
begin
|
||||||
SetDefaultNodeHeight(MulDiv(FDefaultNodeHeight, M, D));
|
SetDefaultNodeHeight(MulDiv(FDefaultNodeHeight, M, D));
|
||||||
FHeader.ChangeScale(M, D);
|
FHeader.ChangeScale(M, D);
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
@ -18017,18 +18063,6 @@ end;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
{$ifdef VCLStyleSupport}
|
|
||||||
class constructor TBaseVirtualTree.Create;
|
|
||||||
begin
|
|
||||||
TCustomStyleEngine.RegisterStyleHook(TBaseVirtualTree, TVclStyleScrollBarsHook);
|
|
||||||
end;
|
|
||||||
|
|
||||||
class destructor TBaseVirtualTree.Destroy;
|
|
||||||
begin
|
|
||||||
TCustomStyleEngine.UnRegisterStyleHook(TBaseVirtualTree, TVclStyleScrollBarsHook);
|
|
||||||
end;
|
|
||||||
{$ifend}
|
|
||||||
|
|
||||||
procedure TBaseVirtualTree.CreateParams(var Params: TCreateParams);
|
procedure TBaseVirtualTree.CreateParams(var Params: TCreateParams);
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -18314,7 +18348,7 @@ begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
if Assigned(FImages) and HasImage(HitInfo.HitNode, ikNormal, HitInfo.HitColumn) then
|
if Assigned(FImages) and HasImage(HitInfo.HitNode, ikNormal, HitInfo.HitColumn) then
|
||||||
Inc(ImageOffset, FImages.Width + 2);
|
Inc(ImageOffset, GetNodeImageSize(HitInfo.HitNode).cx + 2);
|
||||||
if Offset < ImageOffset then
|
if Offset < ImageOffset then
|
||||||
Include(HitInfo.HitPositions, hiOnNormalIcon)
|
Include(HitInfo.HitPositions, hiOnNormalIcon)
|
||||||
else
|
else
|
||||||
@ -18451,7 +18485,7 @@ begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
if Assigned(FImages) and HasImage(HitInfo.HitNode, ikNormal, HitInfo.HitColumn) then
|
if Assigned(FImages) and HasImage(HitInfo.HitNode, ikNormal, HitInfo.HitColumn) then
|
||||||
Dec(ImageOffset, FImages.Width + 2);
|
Dec(ImageOffset, GetNodeImageSize(HitInfo.HitNode).cx + 2);
|
||||||
if Offset > ImageOffset then
|
if Offset > ImageOffset then
|
||||||
Include(HitInfo.HitPositions, hiOnNormalIcon)
|
Include(HitInfo.HitPositions, hiOnNormalIcon)
|
||||||
else
|
else
|
||||||
@ -19123,7 +19157,7 @@ procedure TBaseVirtualTree.DoDragging(P: TPoint);
|
|||||||
//--------------- end local function ----------------------------------------
|
//--------------- end local function ----------------------------------------
|
||||||
|
|
||||||
var
|
var
|
||||||
DragEffect, AllowedEffects: LongWord;
|
AllowedEffects: LongWord;
|
||||||
DragObject: TDragObject;
|
DragObject: TDragObject;
|
||||||
|
|
||||||
DataObject: IDataObject;
|
DataObject: IDataObject;
|
||||||
@ -19166,10 +19200,10 @@ begin
|
|||||||
|
|
||||||
FLastDropMode := dmOnNode;
|
FLastDropMode := dmOnNode;
|
||||||
// Don't forget to initialize the result. It might never be touched.
|
// Don't forget to initialize the result. It might never be touched.
|
||||||
DragEffect := DROPEFFECT_NONE;
|
FLastDragEffect := DROPEFFECT_NONE;
|
||||||
AllowedEffects := GetDragOperations;
|
AllowedEffects := GetDragOperations;
|
||||||
try
|
try
|
||||||
DragAndDrop(AllowedEffects, DataObject, DragEffect);
|
DragAndDrop(AllowedEffects, DataObject, FLastDragEffect);
|
||||||
VTVDragManager.ForceDragLeave;
|
VTVDragManager.ForceDragLeave;
|
||||||
finally
|
finally
|
||||||
GetCursorPos(P);
|
GetCursorPos(P);
|
||||||
@ -19179,7 +19213,7 @@ begin
|
|||||||
FDragImage.EndDrag;
|
FDragImage.EndDrag;
|
||||||
|
|
||||||
// Finish the operation.
|
// Finish the operation.
|
||||||
if (DragEffect = DROPEFFECT_MOVE) and (toAutoDeleteMovedNodes in TreeOptions.AutoOptions) then
|
if (FLastDragEffect = DROPEFFECT_MOVE) and (toAutoDeleteMovedNodes in TreeOptions.AutoOptions) then
|
||||||
begin
|
begin
|
||||||
// The operation was a move so delete the previously selected nodes.
|
// The operation was a move so delete the previously selected nodes.
|
||||||
DeleteSelectedNodes;
|
DeleteSelectedNodes;
|
||||||
@ -19324,6 +19358,17 @@ end;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
procedure TBaseVirtualTree.DoEnter();
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
// Always select a node if the control gets the focus, #237
|
||||||
|
if FocusedNode = nil then begin
|
||||||
|
FocusedNode := Self.GetFirstVisible();
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure TBaseVirtualTree.DoExpanded(Node: PVirtualNode);
|
procedure TBaseVirtualTree.DoExpanded(Node: PVirtualNode);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -19774,6 +19819,19 @@ end;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
procedure TBaseVirtualTree.DoMouseEnter();
|
||||||
|
begin
|
||||||
|
if Assigned(FOnMouseEnter) then
|
||||||
|
FOnMouseEnter(Self);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TBaseVirtualTree.DoMouseLeave;
|
||||||
|
begin
|
||||||
|
if Assigned(FOnMouseLeave) then
|
||||||
|
FOnMouseLeave(Self);
|
||||||
|
end;
|
||||||
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure TBaseVirtualTree.DoNodeCopied(Node: PVirtualNode);
|
procedure TBaseVirtualTree.DoNodeCopied(Node: PVirtualNode);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -21211,6 +21269,23 @@ end;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function TBaseVirtualTree.GetNodeImageSize(Node: PVirtualNode): TSize;
|
||||||
|
|
||||||
|
// Returns the size of an image
|
||||||
|
// Override if you need different sized images for certain nodes.
|
||||||
|
begin
|
||||||
|
if Assigned(fImages) then begin
|
||||||
|
Result.cx := fImages.Width;
|
||||||
|
Result.cy := FImages.Height;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
Result.cx := 0;
|
||||||
|
Result.cy := 0;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function TBaseVirtualTree.GetMaxRightExtend: Cardinal;
|
function TBaseVirtualTree.GetMaxRightExtend: Cardinal;
|
||||||
|
|
||||||
// Determines the maximum with of the currently visible part of the tree, depending on the length
|
// Determines the maximum with of the currently visible part of the tree, depending on the length
|
||||||
@ -21733,7 +21808,7 @@ var
|
|||||||
|
|
||||||
// helper variables to shorten boolean equations/expressions
|
// helper variables to shorten boolean equations/expressions
|
||||||
AutoDrag, // automatic (or allowed) drag start
|
AutoDrag, // automatic (or allowed) drag start
|
||||||
IsHit, // the node's caption or images are hit
|
IsLabelHit, // the node's caption or images are hit
|
||||||
IsCellHit, // for grid extension or full row select (but not check box, button)
|
IsCellHit, // for grid extension or full row select (but not check box, button)
|
||||||
IsAnyHit, // either IsHit or IsCellHit
|
IsAnyHit, // either IsHit or IsCellHit
|
||||||
IsHeightTracking, // height tracking
|
IsHeightTracking, // height tracking
|
||||||
@ -21816,13 +21891,13 @@ begin
|
|||||||
// Various combinations determine what states the tree enters now.
|
// Various combinations determine what states the tree enters now.
|
||||||
// We initialize shorthand variables to avoid the following expressions getting too large
|
// We initialize shorthand variables to avoid the following expressions getting too large
|
||||||
// and to avoid repeative expensive checks.
|
// and to avoid repeative expensive checks.
|
||||||
IsHit := not AltPressed and not (toSimpleDrawSelection in FOptions.FSelectionOptions) and
|
IsLabelHit := not AltPressed and not (toSimpleDrawSelection in FOptions.FSelectionOptions) and
|
||||||
((hiOnItemLabel in HitInfo.HitPositions) or (hiOnNormalIcon in HitInfo.HitPositions));
|
((hiOnItemLabel in HitInfo.HitPositions) or (hiOnNormalIcon in HitInfo.HitPositions));
|
||||||
IsCellHit := not AltPressed and not IsHit and Assigned(HitInfo.HitNode) and
|
IsCellHit := not AltPressed and not IsLabelHit and Assigned(HitInfo.HitNode) and
|
||||||
([hiOnItemButton, hiOnItemCheckBox] * HitInfo.HitPositions = []) and
|
([hiOnItemButton, hiOnItemCheckBox] * HitInfo.HitPositions = []) and
|
||||||
((toFullRowSelect in FOptions.FSelectionOptions) or
|
((toFullRowSelect in FOptions.FSelectionOptions) or
|
||||||
((toGridExtensions in FOptions.FMiscOptions) and (HitInfo.HitColumn > NoColumn)));
|
((toGridExtensions in FOptions.FMiscOptions) and (HitInfo.HitColumn > NoColumn)));
|
||||||
IsAnyHit := IsHit or IsCellHit;
|
IsAnyHit := IsLabelHit or IsCellHit;
|
||||||
MultiSelect := toMultiSelect in FOptions.FSelectionOptions;
|
MultiSelect := toMultiSelect in FOptions.FSelectionOptions;
|
||||||
ShiftEmpty := ShiftState = [];
|
ShiftEmpty := ShiftState = [];
|
||||||
NodeSelected := IsAnyHit and (vsSelected in HitInfo.HitNode.States);
|
NodeSelected := IsAnyHit and (vsSelected in HitInfo.HitNode.States);
|
||||||
@ -21839,7 +21914,7 @@ begin
|
|||||||
|
|
||||||
// Query the application to learn if dragging may start now (if set to dmManual).
|
// Query the application to learn if dragging may start now (if set to dmManual).
|
||||||
if Assigned(HitInfo.HitNode) and not AutoDrag and (DragMode = dmManual) then
|
if Assigned(HitInfo.HitNode) and not AutoDrag and (DragMode = dmManual) then
|
||||||
AutoDrag := DoBeforeDrag(HitInfo.HitNode, Column) and (IsAnyHit or FullRowDrag);
|
AutoDrag := DoBeforeDrag(HitInfo.HitNode, Column) and (FullRowDrag or IsLabelHit);
|
||||||
|
|
||||||
// handle node height tracking
|
// handle node height tracking
|
||||||
if IsHeightTracking then
|
if IsHeightTracking then
|
||||||
@ -21905,7 +21980,7 @@ begin
|
|||||||
(not (tsRightButtonDown in FStates) or not HasPopupMenu(HitNode, HitColumn, Point(XPos, YPos)));
|
(not (tsRightButtonDown in FStates) or not HasPopupMenu(HitNode, HitColumn, Point(XPos, YPos)));
|
||||||
|
|
||||||
// User starts a selection with a selection rectangle.
|
// User starts a selection with a selection rectangle.
|
||||||
if not (toDisableDrawSelection in FOptions.FSelectionOptions) and not (IsHit or FullRowDrag) and MultiSelect then
|
if not (toDisableDrawSelection in FOptions.FSelectionOptions) and not (IsLabelHit or FullRowDrag) and MultiSelect then
|
||||||
begin
|
begin
|
||||||
SetCapture(Handle);
|
SetCapture(Handle);
|
||||||
DoStateChange([tsDrawSelPending]);
|
DoStateChange([tsDrawSelPending]);
|
||||||
@ -21952,7 +22027,7 @@ begin
|
|||||||
(hiOnItem in HitInfo.HitPositions))) and NodeSelected and not NewColumn and ShiftEmpty then
|
(hiOnItem in HitInfo.HitPositions))) and NodeSelected and not NewColumn and ShiftEmpty then
|
||||||
DoStateChange([tsEditPending]);
|
DoStateChange([tsEditPending]);
|
||||||
|
|
||||||
if not (toDisableDrawSelection in FOptions.FSelectionOptions) and not (IsHit or FullRowDrag) and MultiSelect then
|
if not (toDisableDrawSelection in FOptions.FSelectionOptions) and not (IsLabelHit or FullRowDrag) and MultiSelect then
|
||||||
begin
|
begin
|
||||||
// The original code here was moved up to fix issue #187.
|
// The original code here was moved up to fix issue #187.
|
||||||
// In order not to break the semantics of this procedure, we are leaving these if statements here
|
// In order not to break the semantics of this procedure, we are leaving these if statements here
|
||||||
@ -21964,7 +22039,8 @@ begin
|
|||||||
FLastClickPos := Point(Message.XPos, Message.YPos);
|
FLastClickPos := Point(Message.XPos, Message.YPos);
|
||||||
|
|
||||||
// Handle selection and node focus change.
|
// Handle selection and node focus change.
|
||||||
if IsAnyHit and FocusCanChange then
|
if (IsLabelHit or IsCellHit) and
|
||||||
|
DoFocusChanging(FFocusedNode, HitInfo.HitNode, FFocusedColumn, Column) then
|
||||||
begin
|
begin
|
||||||
if NewColumn then
|
if NewColumn then
|
||||||
begin
|
begin
|
||||||
@ -22082,7 +22158,7 @@ begin
|
|||||||
(toEditOnClick in FOptions.FMiscOptions) and CanEdit(FFocusedNode, HitInfo.HitColumn) then
|
(toEditOnClick in FOptions.FMiscOptions) and CanEdit(FFocusedNode, HitInfo.HitColumn) then
|
||||||
begin
|
begin
|
||||||
FEditColumn := FFocusedColumn;
|
FEditColumn := FFocusedColumn;
|
||||||
SetTimer(Handle, EditTimer, FEditDelay, nil);
|
DoEdit;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
DoStateChange([], [tsEditPending]);
|
DoStateChange([], [tsEditPending]);
|
||||||
@ -26223,7 +26299,7 @@ begin
|
|||||||
if Assigned(FStateImages) and HasImage(Node, ikState, Column) then
|
if Assigned(FStateImages) and HasImage(Node, ikState, Column) then
|
||||||
Inc(Offset, FStateImages.Width + 2);
|
Inc(Offset, FStateImages.Width + 2);
|
||||||
if Assigned(FImages) and HasImage(Node, ikNormal, Column) then
|
if Assigned(FImages) and HasImage(Node, ikNormal, Column) then
|
||||||
Inc(Offset, FImages.Width + 2);
|
Inc(Offset, GetNodeImageSize(Node).cx + 2);
|
||||||
|
|
||||||
// Offset contains now the distance from the left or right border of the rectangle (depending on bidi mode).
|
// Offset contains now the distance from the left or right border of the rectangle (depending on bidi mode).
|
||||||
// Now consider the alignment too and calculate the final result.
|
// Now consider the alignment too and calculate the final result.
|
||||||
@ -27053,11 +27129,10 @@ var
|
|||||||
NodeLeft,
|
NodeLeft,
|
||||||
TextLeft,
|
TextLeft,
|
||||||
CurrentWidth: Integer;
|
CurrentWidth: Integer;
|
||||||
|
AssumeImage: Boolean;
|
||||||
WithCheck,
|
WithCheck,
|
||||||
WithImages,
|
|
||||||
WithStateImages: Boolean;
|
WithStateImages: Boolean;
|
||||||
CheckOffset,
|
CheckOffset,
|
||||||
ImageOffset,
|
|
||||||
StateImageOffset: Integer;
|
StateImageOffset: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -27075,12 +27150,6 @@ begin
|
|||||||
if Assigned(FOnBeforeGetMaxColumnWidth) then
|
if Assigned(FOnBeforeGetMaxColumnWidth) then
|
||||||
FOnBeforeGetMaxColumnWidth(FHeader, Column, UseSmartColumnWidth);
|
FOnBeforeGetMaxColumnWidth(FHeader, Column, UseSmartColumnWidth);
|
||||||
|
|
||||||
// Don't check the event here as descendant trees might have overriden the DoGetImageIndex method.
|
|
||||||
WithImages := Assigned(FImages);
|
|
||||||
if WithImages then
|
|
||||||
ImageOffset := FImages.Width + 2
|
|
||||||
else
|
|
||||||
ImageOffset := 0;
|
|
||||||
WithStateImages := Assigned(FStateImages);
|
WithStateImages := Assigned(FStateImages);
|
||||||
if WithStateImages then
|
if WithStateImages then
|
||||||
StateImageOffset := FStateImages.Width + 2
|
StateImageOffset := FStateImages.Width + 2
|
||||||
@ -27125,13 +27194,16 @@ begin
|
|||||||
else
|
else
|
||||||
LastNode := nil;
|
LastNode := nil;
|
||||||
|
|
||||||
|
AssumeImage := False;
|
||||||
while Assigned(Run) and not OperationCanceled do
|
while Assigned(Run) and not OperationCanceled do
|
||||||
begin
|
begin
|
||||||
TextLeft := NodeLeft;
|
TextLeft := NodeLeft;
|
||||||
if WithCheck and (Run.CheckType <> ctNone) then
|
if WithCheck and (Run.CheckType <> ctNone) then
|
||||||
Inc(TextLeft, CheckOffset);
|
Inc(TextLeft, CheckOffset);
|
||||||
if WithImages and HasImage(Run, ikNormal, Column) then
|
if Assigned(fImages) and (AssumeImage or HasImage(Run, ikNormal, Column)) then begin
|
||||||
Inc(TextLeft, ImageOffset);
|
TextLeft := TextLeft + GetNodeImageSize(Run).cx + 2;
|
||||||
|
AssumeImage := True;// From now on, assume that the nodes do ave an image
|
||||||
|
end;
|
||||||
if WithStateImages and HasImage(Run, ikState, Column) then
|
if WithStateImages and HasImage(Run, ikState, Column) then
|
||||||
Inc(TextLeft, StateImageOffset);
|
Inc(TextLeft, StateImageOffset);
|
||||||
|
|
||||||
@ -27759,6 +27831,11 @@ begin
|
|||||||
Result := GetNodeAt(X, Y, True, Dummy);
|
Result := GetNodeAt(X, Y, True, Dummy);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TBaseVirtualTree.GetNodeAt(const P: TPoint): PVirtualNode;
|
||||||
|
begin
|
||||||
|
Result := GetNodeAt(P.X, P.Y);
|
||||||
|
end;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function TBaseVirtualTree.GetNodeAt(X, Y: Integer; Relative: Boolean; var NodeTop: Integer): PVirtualNode;
|
function TBaseVirtualTree.GetNodeAt(X, Y: Integer; Relative: Boolean; var NodeTop: Integer): PVirtualNode;
|
||||||
@ -29738,7 +29815,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
GetImageIndex(PaintInfo, ImageKind[vsSelected in Node.States], iiNormal, FImages);
|
GetImageIndex(PaintInfo, ImageKind[vsSelected in Node.States], iiNormal, FImages);
|
||||||
if ImageInfo[iiNormal].Index > -1 then
|
if ImageInfo[iiNormal].Index > -1 then
|
||||||
AdjustImageBorder(FImages.Width, FImages.Height, BidiMode, VAlign, ContentRect, ImageInfo[iiNormal]);
|
AdjustImageBorder(ImageInfo[iiNormal].Images, BidiMode, VAlign, ContentRect, ImageInfo[iiNormal]);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
ImageInfo[iiNormal].Index := -1;
|
ImageInfo[iiNormal].Index := -1;
|
||||||
@ -30442,6 +30519,43 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
//----------------- TBaseVirtualTree -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
procedure TBaseVirtualTree.DoDrawHint(Canvas: TCanvas; Node: PVirtualNode; R:
|
||||||
|
TRect; Column: TColumnIndex);
|
||||||
|
|
||||||
|
begin
|
||||||
|
if Assigned(FOnDrawHint) then
|
||||||
|
FOnDrawHint(Self, Canvas, Node, R, Column);
|
||||||
|
end;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
procedure TBaseVirtualTree.DoGetHintSize(Node: PVirtualNode; Column:
|
||||||
|
TColumnIndex; var R: TRect);
|
||||||
|
|
||||||
|
begin
|
||||||
|
if Assigned(FOnGetHintSize) then
|
||||||
|
FOnGetHintSize(Self, Node, Column, R);
|
||||||
|
end;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
procedure TBaseVirtualTree.DoGetHintKind(Node: PVirtualNode; Column:
|
||||||
|
TColumnIndex; var Kind: TVTHintKind);
|
||||||
|
|
||||||
|
begin
|
||||||
|
if Assigned(fOnGetHintKind) then
|
||||||
|
fOnGetHintKind(Self, Node, Column, Kind)
|
||||||
|
else
|
||||||
|
Kind := DefaultHintKind;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBaseVirtualTree.GetDefaultHintKind: TVTHintKind;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result := vhkText;
|
||||||
|
end;
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure TBaseVirtualTree.ReinitChildren(Node: PVirtualNode; Recursive: Boolean);
|
procedure TBaseVirtualTree.ReinitChildren(Node: PVirtualNode; Recursive: Boolean);
|
||||||
@ -34335,15 +34449,6 @@ begin
|
|||||||
Result := TStringTreeOptions;
|
Result := TStringTreeOptions;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//----------------- TCustomVirtualDrawTree -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
procedure TCustomVirtualDrawTree.DoDrawHint(Canvas: TCanvas; Node: PVirtualNode; const R: TRect; Column: TColumnIndex);
|
|
||||||
|
|
||||||
begin
|
|
||||||
if Assigned(FOnDrawHint) then
|
|
||||||
FOnDrawHint(Self, Canvas, Node, R, Column);
|
|
||||||
end;
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function TCustomVirtualDrawTree.DoGetCellContentMargin(Node: PVirtualNode; Column: TColumnIndex;
|
function TCustomVirtualDrawTree.DoGetCellContentMargin(Node: PVirtualNode; Column: TColumnIndex;
|
||||||
@ -34360,15 +34465,6 @@ end;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure TCustomVirtualDrawTree.DoGetHintSize(Node: PVirtualNode; Column: TColumnIndex; var R: TRect);
|
|
||||||
|
|
||||||
begin
|
|
||||||
if Assigned(FOnGetHintSize) then
|
|
||||||
FOnGetHintSize(Self, Node, Column, R);
|
|
||||||
end;
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function TCustomVirtualDrawTree.DoGetNodeWidth(Node: PVirtualNode; Column: TColumnIndex; Canvas: TCanvas = nil): Integer;
|
function TCustomVirtualDrawTree.DoGetNodeWidth(Node: PVirtualNode; Column: TColumnIndex; Canvas: TCanvas = nil): Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -34389,6 +34485,12 @@ begin
|
|||||||
FOnDrawNode(Self, PaintInfo);
|
FOnDrawNode(Self, PaintInfo);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomVirtualDrawTree.GetDefaultHintKind: TVTHintKind;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result := vhkOwnerDraw;
|
||||||
|
end;
|
||||||
|
|
||||||
//----------------- TVirtualDrawTree -----------------------------------------------------------------------------------
|
//----------------- TVirtualDrawTree -----------------------------------------------------------------------------------
|
||||||
|
|
||||||
function TVirtualDrawTree.GetOptions: TVirtualTreeOptions;
|
function TVirtualDrawTree.GetOptions: TVirtualTreeOptions;
|
||||||
|
@ -13,3 +13,4 @@
|
|||||||
* Review KeyUnicode -> unnecessary?
|
* Review KeyUnicode -> unnecessary?
|
||||||
* review FDottedBrush life cycle
|
* review FDottedBrush life cycle
|
||||||
* Reverted changes is FillBitmap. See if will work as is
|
* Reverted changes is FillBitmap. See if will work as is
|
||||||
|
* See if will keep TVTHintKind
|
Reference in New Issue
Block a user