mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 21:48:19 +02:00
LCL: scale control default size when needed. Solves issue #32702
git-svn-id: trunk@58125 -
This commit is contained in:
parent
7d10edbadb
commit
3ec78f9640
@ -1474,6 +1474,7 @@ type
|
||||
procedure DoContextPopup(MousePos: TPoint; var Handled: Boolean); virtual;
|
||||
procedure SetZOrder(TopMost: Boolean); virtual;
|
||||
class function GetControlClassDefaultSize: TSize; virtual;
|
||||
function GetScaledControlClassDefaultSize: TSize;
|
||||
function ColorIsStored: boolean; virtual;
|
||||
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||
const AXProportion, AYProportion: Double); virtual;
|
||||
|
@ -1409,6 +1409,13 @@ begin
|
||||
Result := ColorToRGB(GetColorResolvingParent());
|
||||
end;
|
||||
|
||||
function TControl.GetScaledControlClassDefaultSize: TSize;
|
||||
begin
|
||||
Result := GetControlClassDefaultSize;
|
||||
Result.cx := Scale96ToFont(Result.cx);
|
||||
Result.cy := Scale96ToFont(Result.cy);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TControl.DoConstrainedResize
|
||||
------------------------------------------------------------------------------}
|
||||
@ -5570,14 +5577,14 @@ function TControl.GetDefaultWidth: integer;
|
||||
begin
|
||||
if WidthIsAnchored then
|
||||
// if width is anchored the read and base bounds were changed at designtime
|
||||
Result := GetControlClassDefaultSize.cx
|
||||
Result := GetScaledControlClassDefaultSize.cx
|
||||
else if cfBaseBoundsValid in FControlFlags then
|
||||
Result := FBaseBounds.Right - FBaseBounds.Left
|
||||
else
|
||||
if cfWidthLoaded in FControlFlags then
|
||||
Result := FReadBounds.Right - FReadBounds.Left
|
||||
else
|
||||
Result := GetControlClassDefaultSize.cx;
|
||||
Result := GetScaledControlClassDefaultSize.cx;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -5590,14 +5597,14 @@ function TControl.GetDefaultHeight: integer;
|
||||
begin
|
||||
if HeightIsAnchored then
|
||||
// if height is anchored the read and base bounds were changed at designtime
|
||||
Result := GetControlClassDefaultSize.cy
|
||||
Result := GetScaledControlClassDefaultSize.cy
|
||||
else if cfBaseBoundsValid in FControlFlags then
|
||||
Result := BaseBounds.Bottom - BaseBounds.Top
|
||||
else
|
||||
if cfHeightLoaded in FControlFlags then
|
||||
Result := FReadBounds.Bottom - FReadBounds.Top
|
||||
else
|
||||
Result := GetControlClassDefaultSize.CY;
|
||||
Result := GetScaledControlClassDefaultSize.cy;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -1431,10 +1431,10 @@ begin
|
||||
// if no preferred size is valid use the class defaults
|
||||
if not IsPrefWidthValid then
|
||||
PreferredSize[asboHorizontal]:=
|
||||
Control.Constraints.MinMaxWidth(Control.GetControlClassDefaultSize.CX);
|
||||
Control.Constraints.MinMaxWidth(Control.GetScaledControlClassDefaultSize.CX);
|
||||
if not IsPrefHeightValid then
|
||||
PreferredSize[asboVertical]:=
|
||||
Control.Constraints.MinMaxHeight(Control.GetControlClassDefaultSize.CX);
|
||||
Control.Constraints.MinMaxHeight(Control.GetScaledControlClassDefaultSize.CY);
|
||||
|
||||
//DebugLn(['TAutoSizeBox.SetControl ',DbgSName(Control),' ',PreferredSize[asboHorizontal]]);
|
||||
Control.BorderSpacing.GetSpaceAround(Border);
|
||||
|
Loading…
Reference in New Issue
Block a user