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