mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 15:57:56 +02:00
lcl: forms: add TPosition.poWorkAreaCenter
git-svn-id: trunk@51112 -
This commit is contained in:
parent
5da5366275
commit
f42e7fcc66
@ -162,15 +162,7 @@
|
||||
<!-- enumeration type Visibility: default -->
|
||||
<element name="TPosition">
|
||||
<short>Represents the Position and Size of a Form on Screen.</short>
|
||||
<descr>
|
||||
<p>poDesigned - The Form appears exactly as it is positioned and sized in the Form Designer</p>
|
||||
<p>poDefault - The window manager decides how the form is to appear, in a default position and size</p>
|
||||
<p>poDefaultPosOnly - keeps the Designed size, but position determined by windowmanager</p>
|
||||
<p>poDefaultSizeOnly - keeps the Designed position, but size determined by windowmanager</p>
|
||||
<p>poScreenCenter - Centers the form on screen</p>
|
||||
<p>poDeskTopCenter - Centers the form on desktop</p>
|
||||
<p>poMainFormCenter - Centers the Form on the Main Form</p>
|
||||
<p>poOwnerFormCenter - Centers the Form on Owner form</p>
|
||||
<descr><p>poDesigned - The Form appears exactly as it is positioned and sized in the Form Designer</p><p>poDefault - The window manager decides how the form is to appear, in a default position and size</p><p>poDefaultPosOnly - keeps the Designed size, but position determined by windowmanager</p><p>poDefaultSizeOnly - keeps the Designed position, but size determined by windowmanager</p><p>poScreenCenter - Centers the form on screen</p><p>poDeskTopCenter - Centers the form on desktop</p><p>poMainFormCenter - Centers the Form on the Main Form</p><p>poOwnerFormCenter - Centers the Form on Owner form</p><p>poWorkAreaCenter - Centers the Form on working area</p>
|
||||
</descr>
|
||||
<seealso/>
|
||||
</element>
|
||||
|
@ -57,7 +57,8 @@ type
|
||||
poScreenCenter, // center form on screen (depends on DefaultMonitor)
|
||||
poDesktopCenter, // center form on desktop (total of all screens)
|
||||
poMainFormCenter, // center form on main form (depends on DefaultMonitor)
|
||||
poOwnerFormCenter // center form on owner form (depends on DefaultMonitor)
|
||||
poOwnerFormCenter, // center form on owner form (depends on DefaultMonitor)
|
||||
poWorkAreaCenter // center form on working area (depends on DefaultMonitor)
|
||||
);
|
||||
|
||||
TWindowState = (wsNormal, wsMinimized, wsMaximized, wsFullScreen);
|
||||
|
@ -1272,9 +1272,12 @@ var
|
||||
if Y < ABounds.Top then
|
||||
Y := ABounds.Top;
|
||||
end
|
||||
else
|
||||
else // poWorkAreaCenter, poScreenCenter
|
||||
begin
|
||||
ABounds := Target.BoundsRect;
|
||||
if Position = poWorkAreaCenter then
|
||||
ABounds := Target.WorkareaRect
|
||||
else
|
||||
ABounds := Target.BoundsRect;
|
||||
X := (ABounds.Left + ABounds.Right - RealWidth) div 2;
|
||||
Y := (ABounds.Top + ABounds.Bottom - RealHeight) div 2;
|
||||
end;
|
||||
@ -1317,6 +1320,11 @@ begin
|
||||
X := (Screen.Width - RealWidth) div 2;
|
||||
Y := (Screen.Height - RealHeight) div 2;
|
||||
end;
|
||||
poWorkAreaCenter:
|
||||
begin
|
||||
X := Screen.WorkAreaLeft + (Screen.WorkAreaWidth - RealWidth) div 2;
|
||||
Y := Screen.WorkAreaTop + (Screen.WorkAreaHeight - RealHeight) div 2;
|
||||
end;
|
||||
poMainFormCenter,
|
||||
poOwnerFormCenter:
|
||||
begin
|
||||
@ -1341,7 +1349,7 @@ begin
|
||||
// get current widgetset position
|
||||
if (p in [poDefault, poDefaultPosOnly]) and HandleAllocated then
|
||||
GetWindowRelativePosition(Handle,X,Y);
|
||||
if (Position in [poScreenCenter, poMainFormCenter, poOwnerFormCenter]) then
|
||||
if (Position in [poScreenCenter, poMainFormCenter, poOwnerFormCenter, poWorkAreaCenter]) then
|
||||
MoveToDefaultMonitor(X, Y);
|
||||
SetBounds(X, Y, Width, Height);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user