custom tools, enhance entry appearence when a custom color is associated

This commit is contained in:
Basile Burg 2021-10-09 09:12:29 +02:00
parent 791fd84685
commit cbe9b39337
1 changed files with 29 additions and 7 deletions

View File

@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils, FileUtil, RTTIGrids, Forms, Controls, Graphics, Dialogs,
ExtCtrls, Menus, Buttons, StdCtrls, Types, LCLType,
ExtCtrls, Menus, Buttons, StdCtrls, Types, LCLType, GraphUtil,
u_widget, u_tools, u_sharedres, u_dsgncontrols, u_common, u_processes;
type
@ -220,23 +220,45 @@ procedure TToolsEditorWidget.lstToolsDrawItem(Control: TWinControl;
Index: Integer; ARect: TRect; State: TOwnerDrawState);
var
c0: TColor;
c1: TColor;
c2: TColor;
rc: TRect;
xo: integer = 0;
begin
c0 := CustomTools.tool[Index].backgroundColor;
rc := ARect;
if odSelected in State then
begin
if c0 = clDefault then
begin
c0 := clHighlight;
lstTools.Canvas.Brush.Color := c0;
lstTools.Canvas.FillRect(ARect);
lstTools.Canvas.Pen.Color := clHighlightText;
lstTools.Canvas.Rectangle(Arect);
c1 := c0;
c2 := c0;
end
else
begin
c1 := GetShadowColor(c0,-70);
c2 := GetShadowColor(c0,-30);
xo := 6;
end;
lstTools.Canvas.Brush.Color := c1;
lstTools.Canvas.FillRect(rc);
lstTools.Canvas.Brush.Color := c2;
lstTools.Canvas.Pen.Color := c0;
lstTools.Canvas.Pen.Width := 1;
lstTools.Canvas.Font.Style := [fsBold];
rc.Left:= rc.Left + ScaleX(xo, 96);
lstTools.Canvas.FillRect(rc);
end
else
begin
lstTools.Canvas.Font.Style := [];
lstTools.Canvas.Brush.Color := c0;
lstTools.Canvas.FillRect(ARect);
lstTools.Canvas.FillRect(rc);
end;
lstTools.Canvas.TextOut(Arect.Left+1, ARect.Top+1, CustomTools.tool[Index].toolAlias);
rc.Left:= rc.Left + ScaleX(4, 96);
lstTools.Canvas.TextOut(rc.Left, rc.Top , CustomTools.tool[Index].toolAlias);
end;
end.