mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-08 09:58:27 +02:00
LCL: A new angle bracket option for TreeViewExpandSignType. Issue #39361, patch by Alexey T.
This commit is contained in:
parent
7ca9ba2fb6
commit
02eed0c903
@ -3318,10 +3318,11 @@ const
|
|||||||
|
|
||||||
type
|
type
|
||||||
TTreeViewExpandSignType = (
|
TTreeViewExpandSignType = (
|
||||||
tvestTheme, // use themed sign
|
tvestTheme, // use themed sign
|
||||||
tvestPlusMinus, // use +/- sign
|
tvestPlusMinus, // use +/- sign
|
||||||
tvestArrow, // use blank arrow
|
tvestArrow, // use blank arrow
|
||||||
tvestArrowFill // use filled arrow
|
tvestArrowFill, // use filled arrow
|
||||||
|
tvestAngleBracket // use > symbol
|
||||||
);
|
);
|
||||||
|
|
||||||
TTreeViewInsertMarkType = (
|
TTreeViewInsertMarkType = (
|
||||||
@ -3340,6 +3341,7 @@ type
|
|||||||
FEditingItem: TTreeNode;
|
FEditingItem: TTreeNode;
|
||||||
FExpandSignType: TTreeViewExpandSignType;
|
FExpandSignType: TTreeViewExpandSignType;
|
||||||
FExpandSignSize: integer;
|
FExpandSignSize: integer;
|
||||||
|
FExpandSignWidth: integer;
|
||||||
FThemeExpandSignSize: integer;
|
FThemeExpandSignSize: integer;
|
||||||
FDefItemHeight: integer;
|
FDefItemHeight: integer;
|
||||||
FDefItemSpace: Integer;
|
FDefItemSpace: Integer;
|
||||||
@ -3494,6 +3496,7 @@ type
|
|||||||
function AllowMultiSelectWithCtrl(AState: TShiftState): Boolean;
|
function AllowMultiSelectWithCtrl(AState: TShiftState): Boolean;
|
||||||
function AllowMultiSelectWithShift(AState: TShiftState): Boolean;
|
function AllowMultiSelectWithShift(AState: TShiftState): Boolean;
|
||||||
procedure SetExpandSignSize(const AExpandSignSize: integer);
|
procedure SetExpandSignSize(const AExpandSignSize: integer);
|
||||||
|
procedure SetExpandSignWidth(const AValue: integer);
|
||||||
protected
|
protected
|
||||||
FChangeTimer: TTimer;
|
FChangeTimer: TTimer;
|
||||||
FEditor: TEdit;
|
FEditor: TEdit;
|
||||||
@ -3701,6 +3704,7 @@ type
|
|||||||
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 GetExpandSignSize write SetExpandSignSize stored ExpandSignSizeIsStored;
|
property ExpandSignSize: integer read GetExpandSignSize write SetExpandSignSize stored ExpandSignSizeIsStored;
|
||||||
|
property ExpandSignWidth: integer read FExpandSignWidth write SetExpandSignWidth default 2;
|
||||||
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;
|
||||||
|
@ -3277,6 +3277,7 @@ begin
|
|||||||
FDefItemSpace := ScaleY(2, 96);
|
FDefItemSpace := ScaleY(2, 96);
|
||||||
FExpandSignType := tvestTheme;
|
FExpandSignType := tvestTheme;
|
||||||
FExpandSignSize := -1;
|
FExpandSignSize := -1;
|
||||||
|
FExpandSignWidth := 2;
|
||||||
Details := ThemeServices.GetElementDetails(ttGlyphOpened);
|
Details := ThemeServices.GetElementDetails(ttGlyphOpened);
|
||||||
FThemeExpandSignSize := ThemeServices.GetDetailSize(Details).cx;
|
FThemeExpandSignSize := ThemeServices.GetDetailSize(Details).cx;
|
||||||
FTreeNodes := CreateNodes;
|
FTreeNodes := CreateNodes;
|
||||||
@ -4697,6 +4698,13 @@ begin
|
|||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomTreeView.SetExpandSignWidth(const AValue: integer);
|
||||||
|
begin
|
||||||
|
if FExpandSignWidth = AValue then Exit;
|
||||||
|
FExpandSignWidth := AValue;
|
||||||
|
Invalidate;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCustomTreeView.IsEditing: Boolean;
|
function TCustomTreeView.IsEditing: Boolean;
|
||||||
begin
|
begin
|
||||||
Result:=tvsIsEditing in FStates;
|
Result:=tvsIsEditing in FStates;
|
||||||
@ -5175,6 +5183,43 @@ var
|
|||||||
Brush.Color := PrevColor;
|
Brush.Color := PrevColor;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
tvestAngleBracket:
|
||||||
|
begin
|
||||||
|
// draw an arrow. down for collapse and right for expand
|
||||||
|
R := Rect(ALeft, ATop, ARight+1, ABottom+1); //+1 for simmetry of arrow
|
||||||
|
if CollapseSign then
|
||||||
|
begin
|
||||||
|
// draw an arrow down
|
||||||
|
Points[0] := Point(R.Left, MidY - cShiftHorzArrow);
|
||||||
|
Points[1] := Point(R.Right - 1, MidY - cShiftHorzArrow);
|
||||||
|
Points[2] := Point(MidX, R.Bottom - 1 - cShiftHorzArrow);
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
// draw an arrow right
|
||||||
|
Points[0] := Point(MidX - 2, ATop);
|
||||||
|
Points[1] := Point(MidX - 2, R.Bottom - 1);
|
||||||
|
Points[2] := Point(R.Right - 3, MidY);
|
||||||
|
end;
|
||||||
|
|
||||||
|
for SmallIndent := 1 to FExpandSignWidth do
|
||||||
|
begin
|
||||||
|
Line(Points[2], Points[0]);
|
||||||
|
Line(Points[2], Points[1]);
|
||||||
|
|
||||||
|
if CollapseSign then
|
||||||
|
begin
|
||||||
|
Dec(Points[0].Y);
|
||||||
|
Dec(Points[1].Y);
|
||||||
|
Dec(Points[2].Y);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
Dec(Points[0].X);
|
||||||
|
Dec(Points[1].X);
|
||||||
|
Dec(Points[2].X);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user