mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 12:00:44 +02:00
Merged revision(s) 59334-59337 #56476fb45a-#56476fb45a from trunk:
LCL: wince: Minimize and Maximize buttons are not shown in window titlebar. Bug #34093 ........ LCL: wince: add support for biHelp (CONTEXTHELP) border style (aligned with Win32 interface) ........ LCL: wince: use Windows unit instead of LCLTypes unit, because WS_MINIMIZEBOX and WS_MAXIMIZEBOX are defined differently for WinCE, LCLTypes and Win32 ........ LCL: wince: Forms are not correctly centered, when used Position=poScreenCenter or poDesktopCenter (patch aligns WinCE implementation to Win32 implementation). Bug #33957 ........ git-svn-id: branches/fixes_2_0@59348 -
This commit is contained in:
parent
8e4303862a
commit
8ef8549968
@ -22,11 +22,10 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
// RTL, FCL, LCL
|
// RTL, FCL, LCL
|
||||||
Windows, LCLProc, Classes,
|
Forms, Controls, LCLType, Classes, SysUtils,
|
||||||
SysUtils, Controls, LCLType, Forms, InterfaceBase,
|
|
||||||
// Widgetset
|
// Widgetset
|
||||||
winceproc, wincewscontrols, winceextra,
|
WSForms, WSProc, WSLCLClasses,
|
||||||
WSForms, WSProc, WSLCLClasses;
|
Windows, WinCEProc, WinCEWSControls;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -119,7 +118,11 @@ type
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses Winceint, wincewsmenus;
|
uses WinCEInt, WinCEWSMenus;
|
||||||
|
|
||||||
|
type
|
||||||
|
TWinControlAccess = class(TWinControl)
|
||||||
|
end;
|
||||||
|
|
||||||
{ TWinCEWSScrollBox }
|
{ TWinCEWSScrollBox }
|
||||||
|
|
||||||
@ -147,20 +150,41 @@ end;
|
|||||||
|
|
||||||
{ TWinCEWSCustomForm }
|
{ TWinCEWSCustomForm }
|
||||||
|
|
||||||
|
function GetDesigningBorderStyle(const AForm: TCustomForm): TFormBorderStyle;
|
||||||
|
begin
|
||||||
|
if csDesigning in AForm.ComponentState then
|
||||||
|
Result := bsSizeable
|
||||||
|
else
|
||||||
|
Result := AForm.BorderStyle;
|
||||||
|
end;
|
||||||
|
|
||||||
class function TWinCEWSCustomForm.CalcBorderIconsFlags(const AForm: TCustomForm): dword;
|
class function TWinCEWSCustomForm.CalcBorderIconsFlags(const AForm: TCustomForm): dword;
|
||||||
var
|
var
|
||||||
BorderIcons: TBorderIcons;
|
BorderIcons: TBorderIcons;
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
BorderIcons := AForm.BorderIcons;
|
BorderIcons := AForm.BorderIcons;
|
||||||
if biSystemMenu in BorderIcons then
|
if (biSystemMenu in BorderIcons) or (csDesigning in AForm.ComponentState) then
|
||||||
Result := Result or WS_SYSMENU;
|
Result := Result or WS_SYSMENU;
|
||||||
if AForm.BorderStyle in [bsNone, bsSingle, bsSizeable] then
|
if GetDesigningBorderStyle(AForm) in [bsNone, bsSingle, bsSizeable] then
|
||||||
begin
|
begin
|
||||||
if biMinimize in BorderIcons then
|
if biMinimize in BorderIcons then
|
||||||
Result := Result or WS_MINIMIZE;
|
Result := Result or WS_MINIMIZEBOX;
|
||||||
if biMaximize in BorderIcons then
|
if biMaximize in BorderIcons then
|
||||||
Result := Result or WS_MAXIMIZE;
|
Result := Result or WS_MAXIMIZEBOX;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function CalcBorderIconsFlagsEx(const AForm: TCustomForm): DWORD;
|
||||||
|
var
|
||||||
|
BorderIcons: TBorderIcons;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
BorderIcons := AForm.BorderIcons;
|
||||||
|
if GetDesigningBorderStyle(AForm) in [bsSingle, bsSizeable, bsDialog] then
|
||||||
|
begin
|
||||||
|
if biHelp in BorderIcons then
|
||||||
|
Result := Result or WS_EX_CONTEXTHELP;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -174,9 +198,10 @@ begin
|
|||||||
if AForm.Parent <> nil then
|
if AForm.Parent <> nil then
|
||||||
Flags := (Flags or WS_CHILD) and not WS_POPUP;
|
Flags := (Flags or WS_CHILD) and not WS_POPUP;
|
||||||
FlagsEx := BorderStyleToWinAPIFlagsEx(AForm, BorderStyle);
|
FlagsEx := BorderStyleToWinAPIFlagsEx(AForm, BorderStyle);
|
||||||
if (AForm.FormStyle in fsAllStayOnTop) then
|
if (AForm.FormStyle in fsAllStayOnTop) and not (csDesigning in AForm.ComponentState) then
|
||||||
FlagsEx := FlagsEx or WS_EX_TOPMOST;
|
FlagsEx := FlagsEx or WS_EX_TOPMOST;
|
||||||
Flags := Flags or CalcBorderIconsFlags(AForm);
|
Flags := Flags or CalcBorderIconsFlags(AForm);
|
||||||
|
FlagsEx := FlagsEx or CalcBorderIconsFlagsEx(AForm);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TWinCEWSCustomForm.CalculateDialogPosition(
|
class procedure TWinCEWSCustomForm.CalculateDialogPosition(
|
||||||
@ -343,15 +368,14 @@ end;
|
|||||||
class procedure TWinCEWSCustomForm.SetBounds(const AWinControl: TWinControl;
|
class procedure TWinCEWSCustomForm.SetBounds(const AWinControl: TWinControl;
|
||||||
const ALeft, ATop, AWidth, AHeight: Integer);
|
const ALeft, ATop, AWidth, AHeight: Integer);
|
||||||
var
|
var
|
||||||
SizeRect: Windows.RECT;
|
AForm: TCustomForm absolute AWinControl;
|
||||||
|
SizeRect, WR, CurRect: Windows.RECT;
|
||||||
BorderStyle: TFormBorderStyle;
|
BorderStyle: TFormBorderStyle;
|
||||||
WR: Windows.RECT;
|
L, T, W, H: integer;
|
||||||
begin
|
begin
|
||||||
{ User selected LCL window size }
|
// the LCL defines the size of a form without border, wince with.
|
||||||
SizeRect.Top := ATop;
|
// -> adjust size according to BorderStyle
|
||||||
SizeRect.Left := ALeft;
|
SizeRect := Bounds(ALeft, ATop, AWidth, AHeight);
|
||||||
SizeRect.Bottom := ATop + AHeight;
|
|
||||||
SizeRect.Right := ALeft + AWidth;
|
|
||||||
|
|
||||||
BorderStyle := TCustomForm(AWinControl).BorderStyle;
|
BorderStyle := TCustomForm(AWinControl).BorderStyle;
|
||||||
|
|
||||||
@ -381,9 +405,33 @@ begin
|
|||||||
Windows.AdjustWindowRectEx(@SizeRect, BorderStyleToWinAPIFlags(
|
Windows.AdjustWindowRectEx(@SizeRect, BorderStyleToWinAPIFlags(
|
||||||
BorderStyle), false, BorderStyleToWinAPIFlagsEx(TCustomForm(AWinControl), BorderStyle));
|
BorderStyle), false, BorderStyleToWinAPIFlagsEx(TCustomForm(AWinControl), BorderStyle));
|
||||||
|
|
||||||
|
L := ALeft;
|
||||||
|
T := ATop;
|
||||||
|
W := SizeRect.Right - SizeRect.Left;
|
||||||
|
H := SizeRect.Bottom - SizeRect.Top;
|
||||||
|
|
||||||
|
// we are calling setbounds in TWinControl.Initialize
|
||||||
|
// if position is default it will be changed to designed. We do not want this.
|
||||||
|
if wcfInitializing in TWinControlAccess(AWinControl).FWinControlFlags then
|
||||||
|
begin
|
||||||
|
if GetWindowRect(AForm.Handle, CurRect) then
|
||||||
|
begin
|
||||||
|
if AForm.Position in [poDefault, poDefaultPosOnly] then
|
||||||
|
begin
|
||||||
|
L := CurRect.Left;
|
||||||
|
T := CurRect.Top;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if AForm.Position in [poDefault, poDefaultSizeOnly] then
|
||||||
|
begin
|
||||||
|
W := CurRect.Right - CurRect.Left;
|
||||||
|
H := CurRect.Bottom - CurRect.Top;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
// rect adjusted, pass to inherited to do real work
|
// rect adjusted, pass to inherited to do real work
|
||||||
TWinCEWSWinControl.SetBounds(AWinControl, SizeRect.Left, SizeRect.Top,
|
TWinCEWSWinControl.SetBounds(AWinControl, L, T, W, H);
|
||||||
SizeRect.Right - SizeRect.Left, SizeRect.Bottom - SizeRect.Top);
|
|
||||||
|
|
||||||
{$IFDEF VerboseSizeMsg}
|
{$IFDEF VerboseSizeMsg}
|
||||||
DebugLn(
|
DebugLn(
|
||||||
|
Loading…
Reference in New Issue
Block a user