mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 22:20:19 +02:00
LCL: Support user defined SelectionFontColor in Treeview. Publish SeparatorColor. Issue #28666, patch from Alexey Torgashin.
git-svn-id: trunk@49894 -
This commit is contained in:
parent
337e3a4589
commit
114e2e8efc
@ -3231,6 +3231,8 @@ type
|
|||||||
FScrolledLeft: integer; // horizontal scrolled pixels (hidden pixels at left)
|
FScrolledLeft: integer; // horizontal scrolled pixels (hidden pixels at left)
|
||||||
FScrolledTop: integer; // vertical scrolled pixels (hidden pixels at top)
|
FScrolledTop: integer; // vertical scrolled pixels (hidden pixels at top)
|
||||||
FSelectedColor: TColor;
|
FSelectedColor: TColor;
|
||||||
|
FSelectedFontColor: TColor;
|
||||||
|
FSelectedFontColorUsed: boolean;
|
||||||
FSelectedNode: TTreeNode;
|
FSelectedNode: TTreeNode;
|
||||||
FSelectionChangeEventLock: integer;
|
FSelectionChangeEventLock: integer;
|
||||||
fSeparatorColor: TColor;
|
fSeparatorColor: TColor;
|
||||||
@ -3287,6 +3289,7 @@ type
|
|||||||
procedure SetScrolledLeft(AValue: integer);
|
procedure SetScrolledLeft(AValue: integer);
|
||||||
procedure SetScrolledTop(AValue: integer);
|
procedure SetScrolledTop(AValue: integer);
|
||||||
procedure SetSelectedColor(Value: TColor);
|
procedure SetSelectedColor(Value: TColor);
|
||||||
|
procedure SetSelectedFontColor(Value: TColor);
|
||||||
procedure SetSelection(Value: TTreeNode);
|
procedure SetSelection(Value: TTreeNode);
|
||||||
procedure SetSeparatorColor(const AValue: TColor);
|
procedure SetSeparatorColor(const AValue: TColor);
|
||||||
procedure SetShowButton(Value: Boolean);
|
procedure SetShowButton(Value: Boolean);
|
||||||
@ -3498,6 +3501,8 @@ type
|
|||||||
property ScrollBars: TScrollStyle read FScrollBars write SetScrollBars default ssBoth;
|
property ScrollBars: TScrollStyle read FScrollBars write SetScrollBars default ssBoth;
|
||||||
property Selected: TTreeNode read GetSelection write SetSelection;
|
property Selected: TTreeNode read GetSelection write SetSelection;
|
||||||
property SelectionColor: TColor read FSelectedColor write SetSelectedColor default clHighlight;
|
property SelectionColor: TColor read FSelectedColor write SetSelectedColor default clHighlight;
|
||||||
|
property SelectionFontColor: TColor read FSelectedFontColor write SetSelectedFontColor default clWhite;
|
||||||
|
property SelectionFontColorUsed: boolean read FSelectedFontColorUsed write FSelectedFontColorUsed default False;
|
||||||
property SelectionCount: Cardinal read GetSelectionCount;
|
property SelectionCount: Cardinal read GetSelectionCount;
|
||||||
property Selections[AIndex: Integer]: TTreeNode read GetSelections;
|
property Selections[AIndex: Integer]: TTreeNode read GetSelections;
|
||||||
property SeparatorColor: TColor read fSeparatorColor write SetSeparatorColor default clGray;
|
property SeparatorColor: TColor read fSeparatorColor write SetSeparatorColor default clGray;
|
||||||
@ -3548,6 +3553,9 @@ type
|
|||||||
property RowSelect;
|
property RowSelect;
|
||||||
property ScrollBars;
|
property ScrollBars;
|
||||||
property SelectionColor;
|
property SelectionColor;
|
||||||
|
property SelectionFontColor;
|
||||||
|
property SelectionFontColorUsed;
|
||||||
|
property SeparatorColor;
|
||||||
property ShowButtons;
|
property ShowButtons;
|
||||||
property ShowHint;
|
property ShowHint;
|
||||||
property ShowLines;
|
property ShowLines;
|
||||||
|
@ -3126,6 +3126,8 @@ begin
|
|||||||
FImageChangeLink := TChangeLink.Create;
|
FImageChangeLink := TChangeLink.Create;
|
||||||
FImageChangeLink.OnChange := @ImageListChange;
|
FImageChangeLink.OnChange := @ImageListChange;
|
||||||
FSelectedColor:=clHighlight;
|
FSelectedColor:=clHighlight;
|
||||||
|
FSelectedFontColor:=clWhite;
|
||||||
|
FSelectedFontColorUsed:=false;
|
||||||
fSeparatorColor:=clGray;
|
fSeparatorColor:=clGray;
|
||||||
FStateChangeLink := TChangeLink.Create;
|
FStateChangeLink := TChangeLink.Create;
|
||||||
FStateChangeLink.OnChange := @ImageListChange;
|
FStateChangeLink.OnChange := @ImageListChange;
|
||||||
@ -3382,6 +3384,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomTreeView.SetSelectedFontColor(Value: TColor);
|
||||||
|
begin
|
||||||
|
if FSelectedFontColor<>Value then begin
|
||||||
|
FSelectedFontColor:=Value;
|
||||||
|
Invalidate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomTreeView.Paint;
|
procedure TCustomTreeView.Paint;
|
||||||
begin
|
begin
|
||||||
DoPaint;
|
DoPaint;
|
||||||
@ -4911,15 +4921,14 @@ var
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Canvas.Brush.Color := FSelectedColor;
|
Canvas.Brush.Color := FSelectedColor;
|
||||||
Canvas.Font.Color := InvertColor(Brush.Color);
|
Canvas.Font.Color := IfThen(FSelectedFontColorUsed, FSelectedFontColor, InvertColor(FSelectedColor));
|
||||||
Canvas.FillRect(NodeRect);
|
Canvas.FillRect(NodeRect);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if not (tvoThemedDraw in Options) then
|
if not (tvoThemedDraw in Options) then
|
||||||
begin
|
begin
|
||||||
//Canvas.Font.Color := Font.Color;
|
|
||||||
Canvas.Brush.Color := FSelectedColor;
|
Canvas.Brush.Color := FSelectedColor;
|
||||||
Canvas.Font.Color := InvertColor(Brush.Color);
|
Canvas.Font.Color := IfThen(FSelectedFontColorUsed, FSelectedFontColor, InvertColor(FSelectedColor));
|
||||||
Canvas.FillRect(NodeRect);
|
Canvas.FillRect(NodeRect);
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user