mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 19:56:03 +02:00
lcl: change use of CreateParams:
- move TForm.PopupParent handling to CreateParams (it only chooses a right Parent handle) - check also ParentWindow property when setting WndParent in CreateParams win32: use TCreateParams WndParent property for CreateWindow git-svn-id: trunk@23840 -
This commit is contained in:
parent
e9113e15e8
commit
a20e1dcaac
@ -1689,6 +1689,7 @@ type
|
||||
procedure SetDockSite(const NewDockSite: Boolean);
|
||||
procedure SetHandle(NewHandle: HWND);
|
||||
procedure SetBorderWidth(Value: TBorderWidth);
|
||||
procedure SetParentWindow(const AValue: HWND);
|
||||
procedure SetTabOrder(NewTabOrder: TTabOrder);
|
||||
procedure SetTabStop(NewTabStop: Boolean);
|
||||
procedure SetUseDockManager(const AValue: Boolean);
|
||||
@ -1892,6 +1893,7 @@ type
|
||||
property OnKeyUp: TKeyEvent read FOnKeyUp write FOnKeyUp;
|
||||
property OnUnDock: TUnDockEvent read FOnUnDock write FOnUnDock;
|
||||
property OnUTF8KeyPress: TUTF8KeyPressEvent read FOnUTF8KeyPress write FOnUTF8KeyPress;
|
||||
property ParentWindow: HWND read FParentWindow write SetParentWindow;
|
||||
property Showing: Boolean read FShowing; // handle visible
|
||||
property UseDockManager: Boolean read FUseDockManager
|
||||
write SetUseDockManager default False;
|
||||
@ -1922,8 +1924,8 @@ type
|
||||
procedure WriteLayoutDebugReport(const Prefix: string); override;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent);override;
|
||||
constructor CreateParented(ParentWindow: HWND);
|
||||
class function CreateParentedControl(ParentWindow: HWND): TWinControl;
|
||||
constructor CreateParented(AParentWindow: HWND);
|
||||
class function CreateParentedControl(AParentWindow: HWND): TWinControl;
|
||||
destructor Destroy; override;
|
||||
procedure DockDrop(DragDockObject: TDragDockObject; X, Y: Integer); virtual;
|
||||
function CanFocus: Boolean; virtual;
|
||||
|
@ -3507,9 +3507,10 @@ begin
|
||||
{$ENDIF}
|
||||
CheckNewParent(NewParent);
|
||||
if FParent <> nil then FParent.RemoveControl(Self);
|
||||
if cfBoundsRectForNewParentValid in FControlFlags then begin
|
||||
Exclude(FControlFlags,cfBoundsRectForNewParentValid);
|
||||
BoundsRect:=BoundsRectForNewParent;
|
||||
if cfBoundsRectForNewParentValid in FControlFlags then
|
||||
begin
|
||||
Exclude(FControlFlags, cfBoundsRectForNewParentValid);
|
||||
BoundsRect := BoundsRectForNewParent;
|
||||
end;
|
||||
if NewParent <> nil then NewParent.InsertControl(Self);
|
||||
{$IFDEF NewAutoSize}
|
||||
|
@ -1698,11 +1698,20 @@ begin
|
||||
inherited CreateParams(Params);
|
||||
with Params do
|
||||
begin
|
||||
if (Parent = nil) then
|
||||
if (Parent = nil) and (ParentWindow = 0) then
|
||||
begin
|
||||
Style := Style and not Cardinal(WS_GROUP or WS_TABSTOP);
|
||||
if Parent = nil then
|
||||
Style := Style and not Cardinal(WS_CHILD);
|
||||
// define Parent according to PopupMode and PopupParent
|
||||
if not (csDesigning in ComponentState) and (Application.MainForm <> Self) then
|
||||
case PopupMode of
|
||||
pmNone:;
|
||||
pmAuto:
|
||||
if (Screen.ActiveForm <> nil) then
|
||||
WndParent := Screen.ActiveForm.Handle;
|
||||
pmExplicit:
|
||||
if (PopupParent <> nil) then
|
||||
WndParent := PopupParent.Handle;
|
||||
end;
|
||||
Style := Style and not Cardinal(WS_GROUP or WS_TABSTOP or WS_CHILD);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
@ -3966,6 +3966,12 @@ begin
|
||||
Perform(CM_BORDERCHANGED, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TWinControl.SetParentWindow(const AValue: HWND);
|
||||
begin
|
||||
// todo: recreate window?
|
||||
FParentWindow := AValue;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TWinControl.SetChildZPosition
|
||||
|
||||
@ -5742,7 +5748,9 @@ begin
|
||||
and Parent.HandleAllocated
|
||||
{$ENDIF}
|
||||
then
|
||||
Params.WndParent := Parent.Handle;
|
||||
Params.WndParent := Parent.Handle
|
||||
else
|
||||
Params.WndParent := ParentWindow;
|
||||
Params.X := FLeft;
|
||||
Params.Y := FTop;
|
||||
Params.Width := FWidth;
|
||||
@ -6236,19 +6244,18 @@ end;
|
||||
{------------------------------------------------------------------------------
|
||||
TWinControl CreateParented
|
||||
------------------------------------------------------------------------------}
|
||||
constructor TWinControl.CreateParented(ParentWindow: hwnd);
|
||||
constructor TWinControl.CreateParented(AParentWindow: hwnd);
|
||||
begin
|
||||
FParentWindow := ParentWindow;
|
||||
FParentWindow := AParentWindow;
|
||||
inherited Create(nil);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TWinControl CreateParentedControl
|
||||
------------------------------------------------------------------------------}
|
||||
class function TWinControl.CreateParentedControl(ParentWindow: hwnd): TWinControl;
|
||||
class function TWinControl.CreateParentedControl(AParentWindow: hwnd): TWinControl;
|
||||
begin
|
||||
// ToDo
|
||||
Result:=nil;
|
||||
Result := CreateParented(AParentWindow);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -532,7 +532,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
|
@ -70,7 +70,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
|
@ -418,7 +418,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
@ -561,7 +561,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
@ -753,7 +753,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
|
@ -122,7 +122,8 @@ type
|
||||
|
||||
// TODO: better names?
|
||||
|
||||
procedure PrepareCreateWindow(const AWinControl: TWinControl; var Params: TCreateWindowExParams);
|
||||
procedure PrepareCreateWindow(const AWinControl: TWinControl;
|
||||
const CreateParams: TCreateParams; var Params: TCreateWindowExParams);
|
||||
procedure FinishCreateWindow(const AWinControl: TWinControl; var Params: TCreateWindowExParams;
|
||||
const AlternateCreateWindow: boolean);
|
||||
procedure WindowCreateInitBuddy(const AWinControl: TWinControl;
|
||||
@ -138,7 +139,8 @@ uses
|
||||
|
||||
{ Global helper routines }
|
||||
|
||||
procedure PrepareCreateWindow(const AWinControl: TWinControl; var Params: TCreateWindowExParams);
|
||||
procedure PrepareCreateWindow(const AWinControl: TWinControl;
|
||||
const CreateParams: TCreateParams; var Params: TCreateWindowExParams);
|
||||
begin
|
||||
with Params do
|
||||
begin
|
||||
@ -149,9 +151,8 @@ begin
|
||||
Buddy := HWND(nil);
|
||||
Assert(False, 'Trace:Setting window');
|
||||
|
||||
if AWinControl.Parent <> nil then
|
||||
Parent := AWinControl.Parent.Handle
|
||||
else
|
||||
Parent := CreateParams.WndParent;
|
||||
if Parent = 0 then
|
||||
Parent := TWin32WidgetSet(WidgetSet).AppHandle;
|
||||
|
||||
SubClassWndProc := @WindowProc;
|
||||
@ -302,7 +303,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
|
@ -690,7 +690,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
|
@ -284,7 +284,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
@ -406,7 +406,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
|
@ -182,7 +182,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
|
@ -196,7 +196,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
@ -298,21 +298,10 @@ var
|
||||
Bounds: TRect;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
// define Parent according to PopupMode and PopupParent
|
||||
if not (csDesigning in lForm.ComponentState) and (Application.MainForm <> lForm) then
|
||||
case lForm.PopupMode of
|
||||
pmNone:;
|
||||
pmAuto:
|
||||
if (Screen.ActiveForm <> nil) then
|
||||
Parent := Screen.ActiveForm.Handle;
|
||||
pmExplicit:
|
||||
if (lForm.PopupParent <> nil) then
|
||||
Parent := lForm.PopupParent.Handle;
|
||||
end;
|
||||
CalcFormWindowFlags(lForm, Flags, FlagsEx);
|
||||
pClassName := @ClsName[0];
|
||||
WindowTitle := StrCaption;
|
||||
@ -537,7 +526,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
|
@ -164,7 +164,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
|
@ -378,7 +378,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
@ -466,7 +466,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
@ -569,7 +569,7 @@ function GetListBoxParams(AListBox: TCustomListBox;
|
||||
const AParams: TCreateParams; IsCheckList: Boolean): TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AListBox, Result);
|
||||
PrepareCreateWindow(AListBox, AParams, Result);
|
||||
// customization of Params
|
||||
with Result do
|
||||
begin
|
||||
@ -791,7 +791,7 @@ var
|
||||
Info: TComboboxInfo;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
@ -1086,7 +1086,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
@ -1258,7 +1258,7 @@ var
|
||||
ACustomMemo: TCustomMemo;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
ACustomMemo := TCustomMemo(AWinControl);
|
||||
with Params do
|
||||
@ -1421,7 +1421,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
@ -1534,7 +1534,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
@ -1578,7 +1578,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
@ -1660,7 +1660,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
@ -1682,7 +1682,7 @@ var
|
||||
Params: TCreateWindowExParams;
|
||||
begin
|
||||
// general initialization of Params
|
||||
PrepareCreateWindow(AWinControl, Params);
|
||||
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user