mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 20:21:04 +02:00
LCL: TTreeView: remove in 1.7 introduced incompatiblity and use real values for ExpandSignSize and Indent.
git-svn-id: trunk@55110 -
This commit is contained in:
parent
3c692e825d
commit
73e1e2caee
@ -3319,8 +3319,10 @@ type
|
|||||||
function GetBackgroundColor: TColor;
|
function GetBackgroundColor: TColor;
|
||||||
function GetBottomItem: TTreeNode;
|
function GetBottomItem: TTreeNode;
|
||||||
function GetDropTarget: TTreeNode;
|
function GetDropTarget: TTreeNode;
|
||||||
|
function GetExpandSignSize: integer;
|
||||||
function GetHideSelection: boolean;
|
function GetHideSelection: boolean;
|
||||||
function GetHotTrack: boolean;
|
function GetHotTrack: boolean;
|
||||||
|
function GetIndent: Integer;
|
||||||
function GetKeepCollapsedNodes: boolean;
|
function GetKeepCollapsedNodes: boolean;
|
||||||
function GetMultiSelect: Boolean;
|
function GetMultiSelect: Boolean;
|
||||||
function GetReadOnly: boolean;
|
function GetReadOnly: boolean;
|
||||||
@ -3409,6 +3411,7 @@ type
|
|||||||
Stage: TCustomDrawStage; var PaintImages: Boolean): Boolean; virtual;
|
Stage: TCustomDrawStage; var PaintImages: Boolean): Boolean; virtual;
|
||||||
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||||
const AXProportion, AYProportion: Double); override;
|
const AXProportion, AYProportion: Double); override;
|
||||||
|
function ExpandSignSizeIsStored: Boolean;
|
||||||
function GetDragImages: TDragImageList; override;
|
function GetDragImages: TDragImageList; override;
|
||||||
function GetMaxLvl: integer;
|
function GetMaxLvl: integer;
|
||||||
function GetMaxScrollLeft: integer;
|
function GetMaxScrollLeft: integer;
|
||||||
@ -3416,6 +3419,7 @@ type
|
|||||||
function GetNodeAtY(Y: Integer): TTreeNode;
|
function GetNodeAtY(Y: Integer): TTreeNode;
|
||||||
function GetNodeDrawAreaHeight: integer;
|
function GetNodeDrawAreaHeight: integer;
|
||||||
function GetNodeDrawAreaWidth: integer;
|
function GetNodeDrawAreaWidth: integer;
|
||||||
|
function IndentIsStored: Boolean;
|
||||||
function IsCustomDrawn(Target: TCustomDrawTarget;
|
function IsCustomDrawn(Target: TCustomDrawTarget;
|
||||||
Stage: TCustomDrawStage): Boolean; virtual;
|
Stage: TCustomDrawStage): Boolean; virtual;
|
||||||
function IsNodeVisible(ANode: TTreeNode): Boolean;
|
function IsNodeVisible(ANode: TTreeNode): Boolean;
|
||||||
@ -3439,8 +3443,6 @@ type
|
|||||||
procedure EndEditing(Cancel: boolean = false); virtual;
|
procedure EndEditing(Cancel: boolean = false); virtual;
|
||||||
procedure EnsureNodeIsVisible(ANode: TTreeNode);
|
procedure EnsureNodeIsVisible(ANode: TTreeNode);
|
||||||
procedure Expand(Node: TTreeNode); virtual;
|
procedure Expand(Node: TTreeNode); virtual;
|
||||||
function GetRealExpandSignSize: integer;
|
|
||||||
function GetRealIndent: Integer;
|
|
||||||
procedure GetImageIndex(Node: TTreeNode); virtual;
|
procedure GetImageIndex(Node: TTreeNode); virtual;
|
||||||
procedure GetSelectedIndex(Node: TTreeNode); virtual;
|
procedure GetSelectedIndex(Node: TTreeNode); virtual;
|
||||||
procedure InitializeWnd; override;
|
procedure InitializeWnd; override;
|
||||||
@ -3481,7 +3483,7 @@ type
|
|||||||
property HideSelection: Boolean
|
property HideSelection: Boolean
|
||||||
read GetHideSelection write SetHideSelection default True;
|
read GetHideSelection write SetHideSelection default True;
|
||||||
property HotTrack: Boolean read GetHotTrack write SetHotTrack default False;
|
property HotTrack: Boolean read GetHotTrack write SetHotTrack default False;
|
||||||
property Indent: Integer read FIndent write SetIndent default 0;
|
property Indent: Integer read GetIndent write SetIndent stored IndentIsStored;
|
||||||
property MultiSelect: Boolean read GetMultiSelect write SetMultiSelect default False;
|
property MultiSelect: Boolean read GetMultiSelect write SetMultiSelect default False;
|
||||||
property OnAddition: TTVExpandedEvent read FOnAddition write FOnAddition;
|
property OnAddition: TTVExpandedEvent read FOnAddition write FOnAddition;
|
||||||
property OnAdvancedCustomDraw: TTVAdvancedCustomDrawEvent
|
property OnAdvancedCustomDraw: TTVAdvancedCustomDrawEvent
|
||||||
@ -3576,7 +3578,7 @@ type
|
|||||||
property DefaultItemHeight: integer read FDefItemHeight write SetDefaultItemHeight default DefaultTreeNodeHeight;
|
property DefaultItemHeight: integer read FDefItemHeight write SetDefaultItemHeight default DefaultTreeNodeHeight;
|
||||||
property DropTarget: TTreeNode read GetDropTarget write SetDropTarget;
|
property DropTarget: TTreeNode read GetDropTarget write SetDropTarget;
|
||||||
property ExpandSignColor: TColor read FExpandSignColor write FExpandSignColor default clWindowFrame;
|
property ExpandSignColor: TColor read FExpandSignColor write FExpandSignColor default clWindowFrame;
|
||||||
property ExpandSignSize: integer read FExpandSignSize write SetExpandSignSize default 0; // use 0 for default
|
property ExpandSignSize: integer read GetExpandSignSize write SetExpandSignSize stored ExpandSignSizeIsStored;
|
||||||
property ExpandSignType: TTreeViewExpandSignType
|
property ExpandSignType: TTreeViewExpandSignType
|
||||||
read FExpandSignType write SetExpandSignType default tvestTheme;
|
read FExpandSignType write SetExpandSignType default tvestTheme;
|
||||||
property Images: TCustomImageList read FImages write SetImages;
|
property Images: TCustomImageList read FImages write SetImages;
|
||||||
|
@ -1676,7 +1676,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
TV := TreeView;
|
TV := TreeView;
|
||||||
RealIndent := TV.GetRealIndent;
|
RealIndent := TV.Indent;
|
||||||
if TV = nil then Exit;
|
if TV = nil then Exit;
|
||||||
l := Level;
|
l := Level;
|
||||||
if not (tvoShowRoot in TV.Options) then
|
if not (tvoShowRoot in TV.Options) then
|
||||||
@ -1692,7 +1692,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
Result.Left := DisplayExpandSignLeft;
|
Result.Left := DisplayExpandSignLeft;
|
||||||
Result.Top := Top;
|
Result.Top := Top;
|
||||||
Result.Right := Result.Left + TreeView.GetRealIndent;
|
Result.Right := Result.Left + TreeView.Indent;
|
||||||
Result.Bottom := Top + Height;
|
Result.Bottom := Top + Height;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1701,7 +1701,7 @@ function TTreeNode.DisplayExpandSignRight: integer;
|
|||||||
begin
|
begin
|
||||||
Result := DisplayExpandSignLeft;
|
Result := DisplayExpandSignLeft;
|
||||||
if TreeView <> nil then
|
if TreeView <> nil then
|
||||||
inc(Result, TreeView.GetRealIndent);
|
inc(Result, TreeView.Indent);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TTreeNode.DisplayIconLeft: integer;
|
function TTreeNode.DisplayIconLeft: integer;
|
||||||
@ -1743,7 +1743,7 @@ begin
|
|||||||
Result := DisplayTextLeft;
|
Result := DisplayTextLeft;
|
||||||
TV := TreeView;
|
TV := TreeView;
|
||||||
if TV <> nil then
|
if TV <> nil then
|
||||||
Inc(Result, TV.Canvas.TextWidth(Text) + TV.GetRealIndent div 2);
|
Inc(Result, TV.Canvas.TextWidth(Text) + TV.Indent div 2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TTreeNode.AlphaSort: Boolean;
|
function TTreeNode.AlphaSort: Boolean;
|
||||||
@ -3237,7 +3237,7 @@ begin
|
|||||||
// FBackgroundColor := clWindow;
|
// FBackgroundColor := clWindow;
|
||||||
FDefItemHeight := DefaultTreeNodeHeight;
|
FDefItemHeight := DefaultTreeNodeHeight;
|
||||||
FExpandSignType := tvestTheme;
|
FExpandSignType := tvestTheme;
|
||||||
FExpandSignSize := 0;
|
FExpandSignSize := -1;
|
||||||
Details := ThemeServices.GetElementDetails(ttGlyphOpened);
|
Details := ThemeServices.GetElementDetails(ttGlyphOpened);
|
||||||
FThemeExpandSignSize := ThemeServices.GetDetailSize(Details).cx;
|
FThemeExpandSignSize := ThemeServices.GetDetailSize(Details).cx;
|
||||||
FTreeNodes := CreateNodes;
|
FTreeNodes := CreateNodes;
|
||||||
@ -3248,7 +3248,7 @@ begin
|
|||||||
Items.KeepCollapsedNodes:=KeepCollapsedNodes;
|
Items.KeepCollapsedNodes:=KeepCollapsedNodes;
|
||||||
FScrollBars:=ssBoth;
|
FScrollBars:=ssBoth;
|
||||||
FDragImage := TDragImageList.CreateSize(32, 32);
|
FDragImage := TDragImageList.CreateSize(32, 32);
|
||||||
FIndent:=0;
|
FIndent:=-1;
|
||||||
FChangeTimer := TTimer.Create(Self);
|
FChangeTimer := TTimer.Create(Self);
|
||||||
FChangeTimer.Enabled := False;
|
FChangeTimer.Enabled := False;
|
||||||
FChangeTimer.Interval := 1;
|
FChangeTimer.Interval := 1;
|
||||||
@ -3331,8 +3331,10 @@ begin
|
|||||||
try
|
try
|
||||||
if not (tvoAutoItemHeight in Options) then
|
if not (tvoAutoItemHeight in Options) then
|
||||||
DefaultItemHeight := Round(DefaultItemHeight*AYProportion);
|
DefaultItemHeight := Round(DefaultItemHeight*AYProportion);
|
||||||
FIndent := Round(FIndent*AXProportion);
|
if IndentIsStored then
|
||||||
FExpandSignSize := Round(FExpandSignSize*AXProportion);
|
FIndent := Round(FIndent*AXProportion);
|
||||||
|
if ExpandSignSizeIsStored then
|
||||||
|
FExpandSignSize := Round(FExpandSignSize*AXProportion);
|
||||||
finally
|
finally
|
||||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomTreeView.DoAutoAdjustLayout'){$ENDIF};
|
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomTreeView.DoAutoAdjustLayout'){$ENDIF};
|
||||||
end;
|
end;
|
||||||
@ -3655,7 +3657,7 @@ const
|
|||||||
var
|
var
|
||||||
Node: TTreeNode;
|
Node: TTreeNode;
|
||||||
i: integer;
|
i: integer;
|
||||||
FMaxTextLen: Integer;
|
FMaxTextLen, AIndent: Integer;
|
||||||
Cnt: Integer;
|
Cnt: Integer;
|
||||||
begin
|
begin
|
||||||
if not (tvsMaxRightNeedsUpdate in FStates) then exit;
|
if not (tvsMaxRightNeedsUpdate in FStates) then exit;
|
||||||
@ -3663,6 +3665,7 @@ begin
|
|||||||
FMaxTextLen := 0;
|
FMaxTextLen := 0;
|
||||||
Node := Items.GetFirstNode;
|
Node := Items.GetFirstNode;
|
||||||
Cnt := 0;
|
Cnt := 0;
|
||||||
|
AIndent := Indent;
|
||||||
while Node <> nil do
|
while Node <> nil do
|
||||||
begin
|
begin
|
||||||
if not Node.AreParentsExpandedAndVisible then
|
if not Node.AreParentsExpandedAndVisible then
|
||||||
@ -3673,7 +3676,7 @@ begin
|
|||||||
inc(Cnt);
|
inc(Cnt);
|
||||||
if (Cnt < LargeItemCount) then
|
if (Cnt < LargeItemCount) then
|
||||||
begin
|
begin
|
||||||
i := Node.DisplayTextRight + ScrolledLeft + GetRealIndent div 2;
|
i := Node.DisplayTextRight + ScrolledLeft + AIndent div 2;
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
// computing DisplayTextRight is too expensive when the tree
|
// computing DisplayTextRight is too expensive when the tree
|
||||||
@ -4534,7 +4537,7 @@ begin
|
|||||||
Result:=(tvoReadOnly in FOptions);
|
Result:=(tvoReadOnly in FOptions);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomTreeView.GetRealExpandSignSize: integer;
|
function TCustomTreeView.GetExpandSignSize: integer;
|
||||||
begin
|
begin
|
||||||
if FExpandSignSize>0 then
|
if FExpandSignSize>0 then
|
||||||
Result := FExpandSignSize
|
Result := FExpandSignSize
|
||||||
@ -4545,7 +4548,7 @@ begin
|
|||||||
Result := Scale96ToFont(DefaultTreeNodeExpandSignSize);
|
Result := Scale96ToFont(DefaultTreeNodeExpandSignSize);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomTreeView.GetRealIndent: Integer;
|
function TCustomTreeView.GetIndent: Integer;
|
||||||
begin
|
begin
|
||||||
if FIndent=0 then
|
if FIndent=0 then
|
||||||
Result := Scale96ToFont(15)
|
Result := Scale96ToFont(15)
|
||||||
@ -5179,8 +5182,8 @@ var
|
|||||||
PaintImages: boolean;
|
PaintImages: boolean;
|
||||||
OverlayIndex: Integer;
|
OverlayIndex: Integer;
|
||||||
begin
|
begin
|
||||||
RealExpandSignSize := GetRealExpandSignSize;
|
RealExpandSignSize := ExpandSignSize;
|
||||||
RealIndent := GetRealIndent;
|
RealIndent := Indent;
|
||||||
NodeRect := Node.DisplayRect(False);
|
NodeRect := Node.DisplayRect(False);
|
||||||
if (NodeRect.Bottom < 0) or (NodeRect.Top >= ClientHeight) then
|
if (NodeRect.Bottom < 0) or (NodeRect.Top >= ClientHeight) then
|
||||||
Exit;
|
Exit;
|
||||||
@ -5342,6 +5345,11 @@ begin
|
|||||||
if Assigned(FOnExpanded) then FOnExpanded(Self, Node);
|
if Assigned(FOnExpanded) then FOnExpanded(Self, Node);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomTreeView.ExpandSignSizeIsStored: Boolean;
|
||||||
|
begin
|
||||||
|
Result := FExpandSignSize >= 0;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCustomTreeView.CanExpand(Node: TTreeNode): Boolean;
|
function TCustomTreeView.CanExpand(Node: TTreeNode): Boolean;
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
@ -5433,6 +5441,11 @@ begin
|
|||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomTreeView.IndentIsStored: Boolean;
|
||||||
|
begin
|
||||||
|
Result := FIndent >= 0;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomTreeView.MouseDown(Button: TMouseButton; Shift: TShiftState;
|
procedure TCustomTreeView.MouseDown(Button: TMouseButton; Shift: TShiftState;
|
||||||
X, Y: Integer);
|
X, Y: Integer);
|
||||||
var
|
var
|
||||||
|
Loading…
Reference in New Issue
Block a user