spktoolbar: LCLScaling support for property Appearance.Tab.CaptionHeight

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7196 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2019-11-22 21:44:38 +00:00
parent 10994ea2c9
commit 79a817cefd
5 changed files with 121 additions and 58 deletions

View File

@ -15,7 +15,7 @@ unit spkt_Appearance;
interface
uses
Graphics, Classes, Forms, SysUtils,
Graphics, Classes, Forms, SysUtils, LCLVersion,
SpkGUITools, SpkXMLParser, SpkXMLTools,
spkt_Dispatch, spkt_Exceptions;
@ -47,7 +47,9 @@ type
FInactiveHeaderFontColor: TColor;
FCornerRadius: Integer;
FCaptionHeight: Integer;
// Getter & setter methods
function IsCaptionHeightStored: Boolean;
procedure SetHeaderFont(const Value: TFont);
procedure SetBorderColor(const Value: TColor);
procedure SetCaptionHeight(const Value: Integer);
@ -73,10 +75,14 @@ type
procedure SaveToXML(Node: TSpkXMLNode);
procedure Reset(AStyle: TSpkStyle = spkOffice2007Blue);
{$IF lcl_fullversion >= 1080000}
procedure AutoAdjustLayout(const AXProportion, AYProportion: Double);
{$IFEND}
published
property TabHeaderFont: TFont read FTabHeaderFont write SetHeaderFont;
property BorderColor: TColor read FBorderColor write SetBorderColor;
property CaptionHeight: Integer read FCaptionHeight write SetCaptionHeight default -1;
property CaptionHeight: Integer read FCaptionHeight write SetCaptionHeight stored IsCaptionHeightStored;
property CornerRadius: Integer read FCornerRadius write SetCornerRadius;
property GradientFromColor: TColor read FGradientFromColor write SetGradientFromColor;
property GradientToColor: TColor read FGradientToColor write SetGradientToColor;
@ -308,7 +314,7 @@ constructor TSpkTabAppearance.Create(ADispatch: TSpkBaseAppearanceDispatch);
begin
inherited Create;
FDispatch := ADispatch;
FCaptionHeight := -1;
FCaptionHeight := TOOLBAR_TAB_CAPTIONS_HEIGHT;
FCornerRadius := 0;
FTabHeaderFont := TFont.Create;
FTabHeaderFont.OnChange := TabHeaderFontChange;
@ -359,6 +365,20 @@ begin
Result := FCaptionHeight;
end;
{$IF lcl_fullversion >= 1080000}
procedure TSpkTabAppearance.AutoAdjustLayout(
const AXProportion, AYProportion: Double);
begin
if IsCaptionHeightStored then
FCaptionHeight := round(FCaptionHeight * AYProportion);
end;
{$IFEND}
function TSpkTabAppearance.IsCaptionHeightStored: Boolean;
begin
Result := FCaptionHeight <> TOOLBAR_TAB_CAPTIONS_HEIGHT;
end;
procedure TSpkTabAppearance.LoadFromXML(Node: TSpkXMLNode);
var
Subnode: TSpkXMLNode;