win32: also put Icon flags into AdjustWindowRectEx calls, cleanup

git-svn-id: trunk@29757 -
This commit is contained in:
paul 2011-03-09 04:06:03 +00:00
parent 786385251f
commit 412dc4ecc9

View File

@ -291,27 +291,21 @@ begin
// -> adjust size according to BorderStyle // -> adjust size according to BorderStyle
SizeRect := AForm.BoundsRect; SizeRect := AForm.BoundsRect;
BorderStyle := GetDesigningBorderStyle(AForm); BorderStyle := GetDesigningBorderStyle(AForm);
Windows.AdjustWindowRectEx(@SizeRect, BorderStyleToWin32Flags( Windows.AdjustWindowRectEx(@SizeRect, BorderStyleToWin32Flags(BorderStyle) or CalcBorderIconsFlags(AForm),
BorderStyle), false, BorderStyleToWin32FlagsEx(BorderStyle)); False, BorderStyleToWin32FlagsEx(BorderStyle) or CalcBorderIconsFlagsEx(AForm));
end; end;
function CustomFormWndProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam; LParam: Windows.LParam): LResult; stdcall; function CustomFormWndProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam; LParam: Windows.LParam): LResult; stdcall;
procedure LCLFormSizeToWin32Size(Form: TCustomForm; var AWidth, AHeight: Integer); procedure LCLFormSizeToWin32Size(AForm: TCustomForm; var AWidth, AHeight: Integer);
var var
SizeRect: Windows.RECT; SizeRect: Windows.RECT;
BorderStyle: TFormBorderStyle; BorderStyle: TFormBorderStyle;
begin begin
with SizeRect do SizeRect := Classes.Rect(0, 0, AWidth, AHeight);
begin BorderStyle := GetDesigningBorderStyle(AForm);
Left := 0; Windows.AdjustWindowRectEx(@SizeRect, BorderStyleToWin32Flags(BorderStyle) or CalcBorderIconsFlags(AForm),
Top := 0; False, BorderStyleToWin32FlagsEx(BorderStyle) or CalcBorderIconsFlagsEx(AForm));
Right := AWidth;
Bottom := AHeight;
end;
BorderStyle := GetDesigningBorderStyle(Form);
Windows.AdjustWindowRectEx(@SizeRect, BorderStyleToWin32Flags(
BorderStyle), false, BorderStyleToWin32FlagsEx(BorderStyle));
AWidth := SizeRect.Right - SizeRect.Left; AWidth := SizeRect.Right - SizeRect.Left;
AHeight := SizeRect.Bottom - SizeRect.Top; AHeight := SizeRect.Bottom - SizeRect.Top;
end; end;
@ -322,15 +316,15 @@ function CustomFormWndProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam; LPar
IntfWidth, IntfHeight: integer; IntfWidth, IntfHeight: integer;
begin begin
// 0 means no constraint // 0 means no constraint
if (AWidth=0) and (AHeight=0) then exit; if (AWidth = 0) and (AHeight = 0) then exit;
IntfWidth := AWidth; IntfWidth := AWidth;
IntfHeight := AHeight; IntfHeight := AHeight;
LCLFormSizeToWin32Size(TCustomForm(WinControl), IntfWidth, IntfHeight); LCLFormSizeToWin32Size(TCustomForm(WinControl), IntfWidth, IntfHeight);
if AWidth>0 then if AWidth > 0 then
pt.X:= IntfWidth; pt.X := IntfWidth;
if AHeight>0 then if AHeight > 0 then
pt.Y := IntfHeight; pt.Y := IntfHeight;
end; end;
begin begin
@ -551,16 +545,12 @@ var
begin begin
// the LCL defines the size of a form without border, win32 with. // the LCL defines the size of a form without border, win32 with.
// -> adjust size according to BorderStyle // -> adjust size according to BorderStyle
with SizeRect do SizeRect := Bounds(ALeft, ATop, AWidth, AHeight);
begin
Left := ALeft;
Top := ATop;
Right := ALeft + AWidth;
Bottom := ATop + AHeight;
end;
BorderStyle := GetDesigningBorderStyle(TCustomForm(AWinControl)); BorderStyle := GetDesigningBorderStyle(TCustomForm(AWinControl));
Windows.AdjustWindowRectEx(@SizeRect, BorderStyleToWin32Flags( Windows.AdjustWindowRectEx(@SizeRect, BorderStyleToWin32Flags(BorderStyle) or CalcBorderIconsFlags(AForm),
BorderStyle), false, BorderStyleToWin32FlagsEx(BorderStyle)); False, BorderStyleToWin32FlagsEx(BorderStyle) or CalcBorderIconsFlagsEx(AForm));
L := ALeft; L := ALeft;
T := ATop; T := ATop;