spktoolbar: Add Appearance property Tab.CornerRadius (https://forum.lazarus.freepascal.org/index.php/topic,47375.msg339191)

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7183 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2019-11-12 15:25:04 +00:00
parent 56da43d5e4
commit 8e8e01d047
4 changed files with 132 additions and 123 deletions

View File

@ -45,9 +45,11 @@ type
FGradientToColor: TColor;
FGradientType: TBackgroundKind;
FInactiveHeaderFontColor: TColor;
FCornerRadius: Integer;
// Getter & setter methods
procedure SetHeaderFont(const Value: TFont);
procedure SetBorderColor(const Value: TColor);
procedure SetCornerRadius(const Value: Integer);
procedure SetGradientFromColor(const Value: TColor);
procedure SetGradientToColor(const Value: TColor);
procedure SetGradientType(const Value: TBackgroundKind);
@ -71,6 +73,7 @@ type
published
property TabHeaderFont: TFont read FTabHeaderFont write SetHeaderFont;
property BorderColor: TColor read FBorderColor write SetBorderColor;
property CornerRadius: Integer read FCornerRadius write SetCornerRadius;
property GradientFromColor: TColor read FGradientFromColor write SetGradientFromColor;
property GradientToColor: TColor read FGradientToColor write SetGradientToColor;
property GradientType: TBackgroundKind read FGradientType write SetGradientType;
@ -275,7 +278,7 @@ procedure SetDefaultFont(AFont: TFont);
implementation
uses
LCLIntf, LCLType, typinfo, spkGraphTools;
LCLIntf, LCLType, typinfo, spkt_Const, spkGraphTools;
procedure SaveFontToPascal(AList: TStrings; AFont: TFont; AName: String);
var
@ -301,6 +304,7 @@ constructor TSpkTabAppearance.Create(ADispatch: TSpkBaseAppearanceDispatch);
begin
inherited Create;
FDispatch := ADispatch;
FCornerRadius := 0;
FTabHeaderFont := TFont.Create;
FTabHeaderFont.OnChange := TabHeaderFontChange;
Reset;
@ -321,6 +325,7 @@ begin
SrcAppearance := TSpkTabAppearance(Source);
FTabHeaderFont.Assign(SrcAppearance.TabHeaderFont);
FBorderColor := SrcAppearance.BorderColor;
FCornerRadius := SrcAppearance.CornerRadius;
FGradientFromColor := SrcAppearance.GradientFromColor;
FGradientToColor := SrcAppearance.GradientToColor;
FGradientType := SrcAppearance.GradientType;
@ -347,6 +352,10 @@ begin
if Assigned(Subnode) then
FBorderColor := Subnode.TextAsColor;
SubNode := Node['CornerRadius', false];
if Assigned(SubNode) then
FCornerRadius := SubNode.TextAsInteger;
Subnode := Node['GradientFromColor',false];
if Assigned(Subnode) then
FGradientFromColor := Subnode.TextAsColor;
@ -373,6 +382,7 @@ begin
begin
FTabHeaderFont.Color := rgb(21, 66, 139);
FBorderColor := rgb(141, 178, 227);
FCornerRadius := spkt_Const.TabCornerRadius;
FGradientFromColor := rgb(222, 232, 245);
FGradientToColor := rgb(199, 216, 237);
FGradientType := bkConcave;
@ -385,6 +395,7 @@ begin
FTabHeaderFont.Style := [];
FTabHeaderFont.Color := $007A534C;
FBorderColor := $00BEBEBE;
FCornerRadius := spkt_Const.TabCornerRadius;
FGradientFromColor := $00F4F2F2;
FGradientToColor := $00EFE6E1;
FGradientType := bkConcave;
@ -396,6 +407,7 @@ begin
FTabHeaderFont.Style := [];
FTabHeaderFont.Color := $0095572A;
FBorderColor := $00D2D0CF;
FCornerRadius := 0;
FGradientFromColor := $00F1F1F1;
FGradientToColor := $00F1F1F1;
FGradientType := bkSolid;
@ -407,6 +419,7 @@ begin
FTabHeaderFont.Style := [];
FTabHeaderFont.Color := $00FFFFFF;
FBorderColor := $00000000;
FCornerRadius := 0;
FGradientFromColor := $00464646;
FGradientToColor := $00464646;
FGradientType := bkSolid;
@ -421,6 +434,7 @@ begin
Add(' with Tab do begin');
SaveFontToPascal(AList, FTabHeaderFont, ' TabHeaderFont');
Add(' BorderColor := $' + IntToHex(FBorderColor, 8) + ';');
Add(' CornerRadius := ' + IntToStr(FCornerRadius) + ';');
Add(' GradientFromColor := $' + IntToHex(FGradientFromColor, 8) + ';');
Add(' GradientToColor := $' + IntToHex(FGradientToColor, 8) + ';');
Add(' GradientType := ' + GetEnumName(TypeInfo(TBackgroundKind), ord(FGradientType)) + ';');
@ -442,6 +456,9 @@ begin
Subnode := Node['BorderColor',true];
Subnode.TextAsColor := FBorderColor;
SubNode := Node['CornerRadius',true];
SubNode.TextAsInteger := FCornerRadius;
Subnode := Node['GradientFromColor',true];
Subnode.TextAsColor := FGradientFromColor;
@ -462,6 +479,13 @@ begin
FDispatch.NotifyAppearanceChanged;
end;
procedure TSpkTabAppearance.SetCornerRadius(const Value: Integer);
begin
FCornerRadius := Value;
if FDispatch <> nil then
FDispatch.NotifyAppearanceChanged;
end;
procedure TSpkTabAppearance.SetGradientFromColor(const Value: TColor);
begin
FGradientFromColor := Value;