mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-05 00:39:26 +01:00
LCL: delay autosizing when form is minimized
git-svn-id: trunk@33145 -
This commit is contained in:
parent
6f369dbff1
commit
2cd66811f0
@ -1302,7 +1302,7 @@ type
|
|||||||
procedure AdjustSize; virtual;// smart calling DoAutoSize
|
procedure AdjustSize; virtual;// smart calling DoAutoSize
|
||||||
function AutoSizePhases: TControlAutoSizePhases; virtual;
|
function AutoSizePhases: TControlAutoSizePhases; virtual;
|
||||||
function AutoSizeDelayed: boolean; virtual;
|
function AutoSizeDelayed: boolean; virtual;
|
||||||
function AutoSizeCheckParent: Boolean; virtual;
|
function AutoSizeDelayedHandle: Boolean; virtual;
|
||||||
procedure AnchorToNeighbour(Side: TAnchorKind; Space: integer;
|
procedure AnchorToNeighbour(Side: TAnchorKind; Space: integer;
|
||||||
Sibling: TControl);
|
Sibling: TControl);
|
||||||
procedure AnchorParallel(Side: TAnchorKind; Space: integer;
|
procedure AnchorParallel(Side: TAnchorKind; Space: integer;
|
||||||
@ -1954,7 +1954,7 @@ type
|
|||||||
// size, position, bounds
|
// size, position, bounds
|
||||||
function AutoSizePhases: TControlAutoSizePhases; override;
|
function AutoSizePhases: TControlAutoSizePhases; override;
|
||||||
function AutoSizeDelayed: boolean; override;
|
function AutoSizeDelayed: boolean; override;
|
||||||
function AutoSizeCheckParent: Boolean; override;
|
function AutoSizeDelayedHandle: Boolean; override;
|
||||||
procedure BeginUpdateBounds; // disable SetBounds
|
procedure BeginUpdateBounds; // disable SetBounds
|
||||||
procedure EndUpdateBounds; // enable SetBounds
|
procedure EndUpdateBounds; // enable SetBounds
|
||||||
procedure LockRealizeBounds; // disable sending bounds to widgetset
|
procedure LockRealizeBounds; // disable sending bounds to widgetset
|
||||||
|
|||||||
@ -594,7 +594,7 @@ type
|
|||||||
procedure IntfHelp(AComponent: TComponent);
|
procedure IntfHelp(AComponent: TComponent);
|
||||||
function IsShortcut(var Message: TLMKey): boolean; virtual;
|
function IsShortcut(var Message: TLMKey): boolean; virtual;
|
||||||
procedure MakeFullyVisible(AMonitor: TMonitor = nil; UseWorkarea: Boolean = False);
|
procedure MakeFullyVisible(AMonitor: TMonitor = nil; UseWorkarea: Boolean = False);
|
||||||
function AutoSizeCheckParent: Boolean; override;
|
function AutoSizeDelayedHandle: Boolean; override;
|
||||||
procedure GetPreferredSize(var PreferredWidth, PreferredHeight: integer;
|
procedure GetPreferredSize(var PreferredWidth, PreferredHeight: integer;
|
||||||
Raw: boolean = false;
|
Raw: boolean = false;
|
||||||
WithThemeSpace: boolean = true); override;
|
WithThemeSpace: boolean = true); override;
|
||||||
|
|||||||
@ -2585,8 +2585,8 @@ begin
|
|||||||
// no autosize for invisible controls
|
// no autosize for invisible controls
|
||||||
or (not IsControlVisible)
|
or (not IsControlVisible)
|
||||||
// if there is no parent, then this control is not visible
|
// if there is no parent, then this control is not visible
|
||||||
// (TCustomForm will override this)
|
// (TWinControl and TCustomForm override this)
|
||||||
or not AutoSizeCheckParent
|
or AutoSizeDelayedHandle
|
||||||
// if there is a parent, ask it
|
// if there is a parent, ask it
|
||||||
or ((Parent<>nil) and Parent.AutoSizeDelayed);
|
or ((Parent<>nil) and Parent.AutoSizeDelayed);
|
||||||
{$IFDEF VerboseCanAutoSize}
|
{$IFDEF VerboseCanAutoSize}
|
||||||
@ -2597,20 +2597,26 @@ begin
|
|||||||
else if csDestroying in ComponentState then debugln('csDestroying')
|
else if csDestroying in ComponentState then debugln('csDestroying')
|
||||||
else if cfLoading in FControlFlags then debugln('cfLoading')
|
else if cfLoading in FControlFlags then debugln('cfLoading')
|
||||||
else if not IsControlVisible then debugln('not IsControlVisible')
|
else if not IsControlVisible then debugln('not IsControlVisible')
|
||||||
else if not AutoSizeCheckParent then debugln('not AutoSizeCheckParent')
|
else if AutoSizeDelayedHandle then debugln('AutoSizeDelayedHandle')
|
||||||
else if ((Parent<>nil) and Parent.AutoSizeDelayed) then debugln('Parent.AutoSizeDelayed')
|
else if ((Parent<>nil) and Parent.AutoSizeDelayed) then debugln('Parent.AutoSizeDelayed')
|
||||||
else debugln('?');
|
else debugln('?');
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TControl.AutoSizeCheckParent: Boolean;
|
{------------------------------------------------------------------------------
|
||||||
|
TControl AutoSizeDelayedHandle
|
||||||
|
|
||||||
|
Returns true if AutoSize should be skipped / delayed because of its handle.
|
||||||
|
A TControl does not have a handle, so it needs a parent.
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
function TControl.AutoSizeDelayedHandle: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := Parent <> nil;
|
Result := Parent = nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
TControl SetBoundsRect
|
TControl SetBoundsRect
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TControl.SetBoundsRect(const ARect: TRect);
|
procedure TControl.SetBoundsRect(const ARect: TRect);
|
||||||
begin
|
begin
|
||||||
|
|||||||
@ -2128,9 +2128,21 @@ begin
|
|||||||
//DebugLn(['TCustomForm.ShowOnTop ',Name,':',ClassName,' ',Visible,' ',HandleAllocated,' ',csDesigning in ComponentState]);
|
//DebugLn(['TCustomForm.ShowOnTop ',Name,':',ClassName,' ',Visible,' ',HandleAllocated,' ',csDesigning in ComponentState]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomForm.AutoSizeCheckParent: Boolean;
|
{------------------------------------------------------------------------------
|
||||||
|
TCustomForm AutoSizeDelayedHandle
|
||||||
|
|
||||||
|
Returns true if AutoSize should be skipped / delayed because of its handle.
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
function TCustomForm.AutoSizeDelayedHandle: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := True;
|
if WindowState=wsMinimized then
|
||||||
|
exit(true);
|
||||||
|
if (Parent<>nil) or (ParentWindow<>0) then
|
||||||
|
// this form is inlined / embedded it works like a normal TWinControl
|
||||||
|
Result:=inherited AutoSizeDelayedHandle
|
||||||
|
else
|
||||||
|
// this form is on a screen => no delay
|
||||||
|
Result:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
|
|||||||
@ -2387,9 +2387,15 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TWinControl.AutoSizeCheckParent: Boolean;
|
{------------------------------------------------------------------------------
|
||||||
|
TWinControl AutoSizeDelayedHandle
|
||||||
|
|
||||||
|
Returns true if AutoSize should be skipped / delayed because of its handle.
|
||||||
|
A TWinControl needs a parent handle.
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
function TWinControl.AutoSizeDelayedHandle: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := (Parent <> nil) or (ParentWindow <> 0);
|
Result := (Parent = nil) and (ParentWindow = 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user