mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 20:37:43 +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 -->
|
<!-- enumeration type Visibility: default -->
|
||||||
<element name="TPosition">
|
<element name="TPosition">
|
||||||
<short>Represents the Position and Size of a Form on Screen.</short>
|
<short>Represents the Position and Size of a Form on Screen.</short>
|
||||||
<descr>
|
<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>
|
||||||
<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>
|
</descr>
|
||||||
<seealso/>
|
<seealso/>
|
||||||
</element>
|
</element>
|
||||||
|
@ -57,7 +57,8 @@ type
|
|||||||
poScreenCenter, // center form on screen (depends on DefaultMonitor)
|
poScreenCenter, // center form on screen (depends on DefaultMonitor)
|
||||||
poDesktopCenter, // center form on desktop (total of all screens)
|
poDesktopCenter, // center form on desktop (total of all screens)
|
||||||
poMainFormCenter, // center form on main form (depends on DefaultMonitor)
|
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);
|
TWindowState = (wsNormal, wsMinimized, wsMaximized, wsFullScreen);
|
||||||
|
@ -1272,9 +1272,12 @@ var
|
|||||||
if Y < ABounds.Top then
|
if Y < ABounds.Top then
|
||||||
Y := ABounds.Top;
|
Y := ABounds.Top;
|
||||||
end
|
end
|
||||||
else
|
else // poWorkAreaCenter, poScreenCenter
|
||||||
begin
|
begin
|
||||||
ABounds := Target.BoundsRect;
|
if Position = poWorkAreaCenter then
|
||||||
|
ABounds := Target.WorkareaRect
|
||||||
|
else
|
||||||
|
ABounds := Target.BoundsRect;
|
||||||
X := (ABounds.Left + ABounds.Right - RealWidth) div 2;
|
X := (ABounds.Left + ABounds.Right - RealWidth) div 2;
|
||||||
Y := (ABounds.Top + ABounds.Bottom - RealHeight) div 2;
|
Y := (ABounds.Top + ABounds.Bottom - RealHeight) div 2;
|
||||||
end;
|
end;
|
||||||
@ -1317,6 +1320,11 @@ begin
|
|||||||
X := (Screen.Width - RealWidth) div 2;
|
X := (Screen.Width - RealWidth) div 2;
|
||||||
Y := (Screen.Height - RealHeight) div 2;
|
Y := (Screen.Height - RealHeight) div 2;
|
||||||
end;
|
end;
|
||||||
|
poWorkAreaCenter:
|
||||||
|
begin
|
||||||
|
X := Screen.WorkAreaLeft + (Screen.WorkAreaWidth - RealWidth) div 2;
|
||||||
|
Y := Screen.WorkAreaTop + (Screen.WorkAreaHeight - RealHeight) div 2;
|
||||||
|
end;
|
||||||
poMainFormCenter,
|
poMainFormCenter,
|
||||||
poOwnerFormCenter:
|
poOwnerFormCenter:
|
||||||
begin
|
begin
|
||||||
@ -1341,7 +1349,7 @@ begin
|
|||||||
// get current widgetset position
|
// get current widgetset position
|
||||||
if (p in [poDefault, poDefaultPosOnly]) and HandleAllocated then
|
if (p in [poDefault, poDefaultPosOnly]) and HandleAllocated then
|
||||||
GetWindowRelativePosition(Handle,X,Y);
|
GetWindowRelativePosition(Handle,X,Y);
|
||||||
if (Position in [poScreenCenter, poMainFormCenter, poOwnerFormCenter]) then
|
if (Position in [poScreenCenter, poMainFormCenter, poOwnerFormCenter, poWorkAreaCenter]) then
|
||||||
MoveToDefaultMonitor(X, Y);
|
MoveToDefaultMonitor(X, Y);
|
||||||
SetBounds(X, Y, Width, Height);
|
SetBounds(X, Y, Width, Height);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user