jvcllaz: Implement lcl scaling for TJvRollOut. Adapt demo project.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7287 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-01-14 21:50:21 +00:00
parent d44027354c
commit 001c4a6db2
3 changed files with 59 additions and 9 deletions

View File

@ -226,6 +226,17 @@ type
property OnCollapse: TNotifyEvent read FOnCollapse write FOnCollapse;
property OnExpand: TNotifyEvent read FOnExpand write FOnExpand;
{ LCL scaling }
protected
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double); override;
public
{$IF LCL_FullVersion >= 2010000}
procedure FixDesignFontsPPI(const ADesignTimePPI: Integer); override;
{$IFEND}
procedure ScaleFontsPPI({$IF LCL_FullVersion >= 1080100}const AToPPI: Integer;{$IFEND}
const AProportion: Double); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@ -1610,6 +1621,40 @@ begin
end;
end;
{ LCL scaling }
procedure TJvCustomRollOut.DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double);
begin
inherited;
if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
begin
FButtonHeight := round(FButtonHeight * AYProportion);
FChildOffset := round(FChildOffset * AXProportion);
FCWidth := round(FCWidth * AXProportion);
FCHeight := round(FCHeight * AYProportion);
FAWidth := round(FAWidth * AXProportion);
FAHeight := round(FAHeight * AYProportion);
end;
end;
{$IF LCL_FullVersion >= 2010000}
procedure TJvCustomRollOut.FixDesignFontsPPI(const ADesignTimePPI: Integer);
begin
inherited;
DoFixDesignFontPPI(FButtonFont, ADesignTimePPI);
end;
{$IFEND}
procedure TJvCustomRollOut.ScaleFontsPPI(
{$IF LCL_FullVersion >= 1080100}const AToPPI: Integer;{$IFEND}
const AProportion: Double);
begin
inherited;
DoScaleFontPPI(FButtonFont, AToPPI, AProportion);
end;
//=== { TJvRollOutAction } ===================================================
destructor TJvRollOutAction.Destroy;