LCL: Implement TreeView DisabledFontColor. Issue #35628, patch from Alexey Tor.

git-svn-id: trunk@61294 -
This commit is contained in:
juha 2019-05-27 09:39:54 +00:00
parent c38c503588
commit 383cc68489
3 changed files with 14 additions and 1 deletions

View File

@ -3332,6 +3332,7 @@ type
fMouseDownPos: TPoint;
FMultiSelectStyle: TMultiSelectStyle;
FHotTrackColor: TColor;
FDisabledFontColor: TColor;
FOnAddition: TTVExpandedEvent;
FOnAdvancedCustomDraw: TTVAdvancedCustomDrawEvent;
FOnAdvancedCustomDrawItem: TTVAdvancedCustomDrawItemEvent;
@ -3562,6 +3563,7 @@ type
read GetHideSelection write SetHideSelection default True;
property HotTrack: Boolean read GetHotTrack write SetHotTrack default False;
property HotTrackColor: TColor read FHotTrackColor write FHotTrackColor default clNone;
property DisabledFontColor: TColor read FDisabledFontColor write FDisabledFontColor default clGrayText;
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;
@ -3701,6 +3703,7 @@ type
property Color;
property Constraints;
property DefaultItemHeight;
property DisabledFontColor;
property DragKind;
property DragCursor;
property DragMode;

View File

@ -3271,6 +3271,7 @@ begin
FTreeLinePenPattern[1] := 1;
FExpandSignColor := clWindowFrame;
FHotTrackColor := clNone;
FDisabledFontColor := clGrayText;
// Accessibility
AccessibleDescription := rsTTreeViewAccessibilityDescription;
AccessibleRole := larTreeView;
@ -5239,9 +5240,17 @@ var
NodeRect.Offset(ScaleX(2, 96), 0);
if (tvoThemedDraw in Options) then
ThemeServices.DrawText(Canvas, Details, AText, NodeRect, DT_LEFT or DT_VCENTER or DT_SINGLELINE or DT_NOPREFIX, 0)
begin
if not Enabled then
Details.State := 4; // TmSchema.TREIS_DISABLED = 4
ThemeServices.DrawText(Canvas, Details, AText, NodeRect, DT_LEFT or DT_VCENTER or DT_SINGLELINE or DT_NOPREFIX, 0);
end
else
begin
if not Enabled and (FDisabledFontColor<>clNone) then
Canvas.Font.Color := FDisabledFontColor;
DrawText(Canvas.Handle, PChar(AText), -1, NodeRect, DT_LEFT or DT_VCENTER or DT_SINGLELINE or DT_NOPREFIX);
end;
if NeedUnderline then
begin

View File

@ -2449,6 +2449,7 @@ begin
case Details.State of
TREIS_SELECTED,
TREIS_HOTSELECTED: Canvas.Font.Color := clHighlightText;
TREIS_DISABLED: Canvas.Font.Color := clGrayText;
TREIS_SELECTEDNOTFOCUS: Canvas.Font.Color := clBtnText;
else
Canvas.Font.Color := clWindowText;