lcl: rewrite PopupMode/PopupParent

- unify code for PopupMode/PopupParent in one function TCustomForm.GetRealPopupParent for all WS.
- change TWSCustomFormClass.SetPopupParent to TWSCustomFormClass.SetRealPopupParent without PopupMode parameter.
- Fix TPopupMode documentation.
Issue #29247

git-svn-id: trunk@51032 -
This commit is contained in:
ondrej 2015-12-25 15:37:10 +00:00
parent 629feb6d13
commit 81733b2e74
13 changed files with 118 additions and 196 deletions

View File

@ -1500,13 +1500,13 @@
</notes>
</element>
<element name="TPopupMode.pmNone">
<short>default behavior - popup to mainform/taskbar window</short>
<short>modal: popup to mainform/taskbar window; non-modal: no window parent</short>
</element>
<element name="TPopupMode.pmAuto">
<short>popup to active form, and same as pmNone if no active form</short>
<short>modal &amp; non-modal: popup to active form or if not available, to main form</short>
</element>
<element name="TPopupMode.pmExplicit">
<short>popup to PopupParent, and same as pmNone if not exists</short>
<short>modal &amp; non-modal: popup to PopupParent or if not available, to main form</short>
</element>
<!-- procedure type Visibility: default -->
<element name="TCloseEvent">

View File

@ -388,9 +388,9 @@ type
);
TPopupMode = (
pmNone, // default behavior - popup to mainform/taskbar window
pmAuto, // popup to active form and same as pmNone if no active form
pmExplicit // popup to PopupParent and same as pmNone if not exists
pmNone, // modal: popup to mainform/taskbar window; non-modal: no window parent
pmAuto, // modal & non-modal: popup to active form or if not available, to main form
pmExplicit // modal & non-modal: popup to PopupParent or if not available, to main form
);
TCloseEvent = procedure(Sender: TObject; var CloseAction: TCloseAction) of object;
@ -595,6 +595,7 @@ type
function FormIsUpdating: boolean; override;
function GetFormImage: TBitmap;
function GetRolesForControl(AControl: TControl): TControlRolesForForm;
function GetRealPopupParent: TCustomForm;
procedure Hide;
procedure IntfDropFiles(const FileNames: array of String);
procedure IntfHelp(AComponent: TComponent);

View File

@ -360,10 +360,11 @@ begin
if FPopupMode <> AValue then
begin
FPopupMode := AValue;
if FPopupMode = pmAuto then
PopupParent := nil;
if (FPopupMode = pmAuto) and (PopupParent <> nil) then
PopupParent := nil
else
if not (csDesigning in ComponentState) and HandleAllocated then
TWSCustomFormClass(WidgetSetClass).SetPopupParent(Self, PopupMode, PopupParent);
TWSCustomFormClass(WidgetSetClass).SetRealPopupParent(Self, GetRealPopupParent);
end;
end;
@ -380,7 +381,7 @@ begin
FPopupMode := pmExplicit;
end;
if not (csDesigning in ComponentState) and HandleAllocated then
TWSCustomFormClass(WidgetSetClass).SetPopupParent(Self, PopupMode, PopupParent);
TWSCustomFormClass(WidgetSetClass).SetRealPopupParent(Self, GetRealPopupParent);
end;
end;
@ -1475,6 +1476,31 @@ begin
end;
end;
function TCustomForm.GetRealPopupParent: TCustomForm;
begin
Result := nil;
if (fsModal in FormState) or // always set WndParent of modal windows
(PopupMode in [pmAuto, pmExplicit]) // set WndParent of non-modal windows only for pmAuto, pmExplicit
then
begin
case PopupMode of
pmAuto:
begin
Result := Screen.ActiveForm;
if (Result<>nil) and (Result.FormStyle = fsSplash) then // ignore fsSplash
Result := nil;
end;
pmExplicit: Result := PopupParent;
end;
if (Result = nil) or not Result.HandleAllocated then
Result := Application.MainForm;
end;
if (Result <> nil) and not Result.HandleAllocated then
Result := nil;
if (Result = Self) then
Result := nil;
end;
procedure TCustomForm.DoAutoSize;
begin
//DebugLn(['TCustomForm.DoAutoSize ',DbgSName(Self),' ',WindowState=wsNormal,' ',fsDisableAutoSize in FFormState,' ',dbgs(BoundsRect),' ',dbgs(ClientRect)]);
@ -2044,6 +2070,8 @@ end;
TCustomForm CreateParams
------------------------------------------------------------------------------}
procedure TCustomForm.CreateParams(var Params : TCreateParams);
var
APopupParent: TCustomForm;
begin
inherited CreateParams(Params);
with Params do
@ -2055,15 +2083,9 @@ begin
begin
if (Application.MainForm <> Self) then
begin
case PopupMode of
pmNone:;
pmAuto:
if (Screen.ActiveForm <> nil) then
WndParent := Screen.ActiveForm.Handle;
pmExplicit:
if (PopupParent <> nil) then
WndParent := PopupParent.Handle;
end;
APopupParent := GetRealPopupParent;
if APopupParent <> nil then
WndParent := APopupParent.Handle;
end;
if (WndParent = 0) and
(((Self = Application.MainForm) and Application.MainFormOnTaskBar) or (GetEffectiveShowInTaskBar = stAlways)) then

View File

@ -76,8 +76,8 @@ type
class procedure SetAlphaBlend(const ACustomForm: TCustomForm; const AlphaBlend: Boolean; const Alpha: Byte); override;
class procedure SetFormStyle(const ACustomForm: TCustomForm; const ANewFormStyle, {%H-}AOldFormStyle: TFormStyle); override;
class procedure SetPopupParent(const ACustomForm: TCustomForm;
const {%H-}APopupMode: TPopupMode; const APopupParent: TCustomForm); override;
class procedure SetRealPopupParent(const ACustomForm: TCustomForm;
const APopupParent: TCustomForm); override;
end;
{ TCarbonWSForm }
@ -338,10 +338,9 @@ begin
Self, 'SetFormStyle', 'SetWindowGroup');
end;
class procedure TCarbonWSCustomForm.SetPopupParent(const ACustomForm:TCustomForm;
const APopupMode:TPopupMode;const APopupParent:TCustomForm);
class procedure TCarbonWSCustomForm.SetRealPopupParent(
const ACustomForm: TCustomForm; const APopupParent: TCustomForm);
begin
//todo: better "popup-parent" hanlding
if Assigned(APopupParent) and (APopupParent.Handle<>0) then
begin
SetWindowGroup( TCarbonWindow(ACustomForm.Handle).Window, GetWindowGroupOfClass(kHelpWindowClass));

View File

@ -112,8 +112,8 @@ type
class procedure SetBorderIcons(const AForm: TCustomForm; const ABorderIcons: TBorderIcons); override;
class procedure SetFormBorderStyle(const AForm: TCustomForm; const AFormBorderStyle: TFormBorderStyle); override;
class procedure SetFormStyle(const AForm: TCustomform; const AFormStyle, AOldFormStyle: TFormStyle); override;
class procedure SetPopupParent(const ACustomForm: TCustomForm;
const APopupMode: TPopupMode; const APopupParent: TCustomForm); override;
class procedure SetRealPopupParent(const ACustomForm: TCustomForm;
const APopupParent: TCustomForm); override;
{need to override these }
class function GetClientBounds(const AWincontrol: TWinControl; var ARect: TRect): Boolean; override;
@ -660,30 +660,17 @@ begin
end;
end;
class procedure TCocoaWSCustomForm.SetPopupParent(
const ACustomForm: TCustomForm; const APopupMode: TPopupMode;
const APopupParent: TCustomForm);
var
PopupParent: TCustomForm;
class procedure TCocoaWSCustomForm.SetRealPopupParent(
const ACustomForm: TCustomForm; const APopupParent: TCustomForm);
begin
if not ACustomForm.HandleAllocated then Exit;
case APopupMode of
pmNone:
PopupParent := nil;
pmAuto:
PopupParent := Screen.ActiveForm;
pmExplicit:
PopupParent := APopupParent;
end;
if Assigned(PopupParent) then
NSWindow(PopupParent.Handle).addChildWindow_ordered(NSWindow(ACustomForm.Handle), NSWindowAbove)
else
if Assigned(NSWindow(ACustomForm.Handle).parentWindow) then
NSWindow(ACustomForm.Handle).parentWindow.removeChildWindow(NSWindow(ACustomForm.Handle));
if Assigned(APopupParent) then
NSWindow(APopupParent.Handle).addChildWindow_ordered(NSWindow(ACustomForm.Handle), NSWindowAbove);
end;
class function TCocoaWSCustomForm.GetClientBounds(const AWinControl: TWinControl; var ARect: TRect): Boolean;
class function TCocoaWSCustomForm.GetClientBounds(
const AWincontrol: TWinControl; var ARect: TRect): Boolean;
begin
Result := False;
if not AWinControl.HandleAllocated then Exit;
@ -691,7 +678,8 @@ begin
Result := True;
end;
class function TCocoaWSCustomForm.GetClientRect(const AWinControl: TWinControl; var ARect: TRect): Boolean;
class function TCocoaWSCustomForm.GetClientRect(const AWincontrol: TWinControl;
var ARect: TRect): Boolean;
var
x, y: Integer;
begin

View File

@ -141,8 +141,8 @@ type
class procedure SetFormBorderStyle(const AForm: TCustomForm;
const AFormBorderStyle: TFormBorderStyle); override;
// class procedure SetFormStyle(const AForm: TCustomform; const AFormStyle, AOldFormStyle: TFormStyle); override;
// class procedure SetPopupParent(const ACustomForm: TCustomForm;
// const APopupMode: TPopupMode; const APopupParent: TCustomForm); override;
// class procedure SetRealPopupParent(const ACustomForm: TCustomForm;
// const APopupParent: TCustomForm); override;
class procedure SetIcon(const AForm: TCustomForm; const Small, Big: HICON); override;
class procedure SetShowInTaskbar(const AForm: TCustomForm; const AValue: TShowInTaskbar); override;
class procedure ShowModal(const ACustomForm: TCustomForm); override;

View File

@ -79,8 +79,8 @@ type
class procedure SetBorderIcons(const AForm: TCustomForm;
const ABorderIcons: TBorderIcons); override;
class procedure SetColor(const AWinControl: TWinControl); override;
class procedure SetPopupParent(const ACustomForm: TCustomForm;
const APopupMode: TPopupMode; const APopupParent: TCustomForm); override;
class procedure SetRealPopupParent(const ACustomForm: TCustomForm;
const APopupParent: TCustomForm); override;
end;
{ TGtkWSForm }
@ -526,23 +526,13 @@ begin
TGtkWSWinControl.SetColor(AWinControl);
end;
class procedure TGtkWSCustomForm.SetPopupParent(const ACustomForm: TCustomForm;
const APopupMode: TPopupMode; const APopupParent: TCustomForm);
var
PopupParent: TCustomForm;
class procedure TGtkWSCustomForm.SetRealPopupParent(
const ACustomForm: TCustomForm; const APopupParent: TCustomForm);
begin
if not WSCheckHandleAllocated(ACustomForm, 'SetPopupParent') then Exit;
if not WSCheckHandleAllocated(ACustomForm, 'SetRealPopupParent') then Exit;
case APopupMode of
pmNone:
PopupParent := nil;
pmAuto:
PopupParent := Screen.ActiveForm;
pmExplicit:
PopupParent := APopupParent;
end;
if PopupParent <> nil then
gtk_window_set_transient_for(PGtkWindow(ACustomForm.Handle), PGtkWindow(PopupParent.Handle))
if APopupParent <> nil then
gtk_window_set_transient_for(PGtkWindow(ACustomForm.Handle), PGtkWindow(APopupParent.Handle))
else
gtk_window_set_transient_for(PGtkWindow(ACustomForm.Handle), nil);
end;

View File

@ -84,8 +84,8 @@ type
class procedure SetBorderIcons(const AForm: TCustomForm;
const ABorderIcons: TBorderIcons); override;
class procedure SetColor(const AWinControl: TWinControl); override;
class procedure SetPopupParent(const ACustomForm: TCustomForm;
const APopupMode: TPopupMode; const APopupParent: TCustomForm); override;
class procedure SetRealPopupParent(const ACustomForm: TCustomForm;
const APopupParent: TCustomForm); override;
end;
{ TGtk2WSForm }
@ -680,7 +680,7 @@ var
{$IFDEF HASX}
TempGdkWindow: PGdkWindow;
{$ENDIF}
AForm: TCustomForm;
AForm, APopupParent: TCustomForm;
GtkWindow: PGtkWindow;
Geometry: TGdkGeometry;
@ -778,17 +778,11 @@ begin
if AWinControl.HandleObjectShouldBeVisible and
not (csDesigning in AForm.ComponentState) and
not (AForm.FormStyle in fsAllStayOnTop) and
not (fsModal in AForm.FormState) and
(((AForm.PopupMode = pmAuto) and
(Screen.ActiveCustomForm <> nil)) or
((AForm.PopupMode = pmExplicit) and
(AForm.PopupParent <> nil)))
then
not (fsModal in AForm.FormState) then
begin
if (AForm.PopupMode = pmAuto) then
SetPopupParent(AForm, AForm.PopupMode, Screen.ActiveCustomForm)
else
SetPopupParent(AForm, AForm.PopupMode, AForm.PopupParent);
APopupParent := AForm.GetRealPopupParent;
if (APopupParent <> nil) then
SetRealPopupParent(AForm, APopupParent);
end;
{$ENDIF}
@ -848,27 +842,13 @@ begin
TGtk2WSWinControl.SetColor(AWinControl);
end;
class procedure TGtk2WSCustomForm.SetPopupParent(const ACustomForm: TCustomForm;
const APopupMode: TPopupMode; const APopupParent: TCustomForm);
var
PopupParent: TCustomForm;
class procedure TGtk2WSCustomForm.SetRealPopupParent(
const ACustomForm: TCustomForm; const APopupParent: TCustomForm);
begin
if not WSCheckHandleAllocated(ACustomForm, 'SetPopupParent') then Exit;
if not WSCheckHandleAllocated(ACustomForm, 'SetRealPopupParent') then Exit;
case APopupMode of
pmNone:
PopupParent := nil;
pmAuto:
PopupParent := Screen.ActiveForm;
pmExplicit:
begin
PopupParent := APopupParent;
if PopupParent = nil then
PopupParent := Application.MainForm;
end;
end;
if PopupParent <> nil then
gtk_window_set_transient_for({%H-}PGtkWindow(ACustomForm.Handle), {%H-}PGtkWindow(PopupParent.Handle))
if APopupParent <> nil then
gtk_window_set_transient_for({%H-}PGtkWindow(ACustomForm.Handle), {%H-}PGtkWindow(APopupParent.Handle))
else
gtk_window_set_transient_for({%H-}PGtkWindow(ACustomForm.Handle), nil);
end;

View File

@ -95,8 +95,8 @@ type
class procedure SetFormStyle(const AForm: TCustomform; const AFormStyle, AOldFormStyle: TFormStyle); override;
class procedure SetIcon(const AForm: TCustomForm; const Small, Big: HICON); override;
class procedure ShowModal(const ACustomForm: TCustomForm); override;
class procedure SetPopupParent(const ACustomForm: TCustomForm;
const APopupMode: TPopupMode; const APopupParent: TCustomForm); override;
class procedure SetRealPopupParent(const ACustomForm: TCustomForm;
const APopupParent: TCustomForm); override;
class procedure SetShowInTaskbar(const AForm: TCustomForm; const AValue: TShowInTaskbar); override;
class procedure SetZPosition(const AWinControl: TWinControl; const APosition: TWSZPosition); override;
class function GetDefaultColor(const AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor; override;
@ -387,20 +387,20 @@ begin
{$ENDIF}
end;
class procedure TGtk3WSCustomForm.SetPopupParent(const ACustomForm: TCustomForm;
const APopupMode: TPopupMode; const APopupParent: TCustomForm);
class procedure TGtk3WSCustomForm.SetRealPopupParent(
const ACustomForm: TCustomForm; const APopupParent: TCustomForm);
begin
if not WSCheckHandleAllocated(ACustomForm, 'ShowPopupParent') then
if not WSCheckHandleAllocated(ACustomForm, 'SetRealPopupParent') then
Exit;
{$IFDEF GTK3DEBUGCORE}
DebugLn('TGtk3WSCustomForm.SetPopupParent');
DebugLn('TGtk3WSCustomForm.SetRealPopupParent');
{$ENDIF}
end;
class procedure TGtk3WSCustomForm.SetAlphaBlend(const ACustomForm: TCustomForm;
const AlphaBlend: Boolean; const Alpha: Byte);
begin
if not WSCheckHandleAllocated(ACustomForm, 'ShowAlphaBlend') then
if not WSCheckHandleAllocated(ACustomForm, 'SetAlphaBlend') then
Exit;
{$IFDEF GTK3DEBUGCORE}
DebugLn('TGtk3WSCustomForm.SetAlphaBlend');

View File

@ -622,7 +622,6 @@ type
LayoutWidget: QBoxLayoutH;
FCWEventHook: QObject_hookH;
FShowOnTaskBar: Boolean;
FPopupMode: TPopupMode;
FPopupParent: QWidgetH;
FMDIStateHook: QMdiSubWindow_hookH;
protected
@ -669,7 +668,7 @@ type
procedure SlotActivateWindow(vActivate: Boolean); cdecl;
procedure slotWindowStateChange; cdecl;
procedure setShowInTaskBar(AValue: Boolean);
procedure setPopupParent(APopupMode: TPopupMode; NewParent: QWidgetH);
procedure setRealPopupParent(NewParent: QWidgetH);
property Blocked: Boolean read FBlocked write FBlocked;
property ShowOnTaskBar: Boolean read FShowOnTaskBar;
public
@ -6569,7 +6568,6 @@ begin
QtFormBorderStyle := Ord(bsSizeable);
QtFormStyle := Ord(fsNormal);
FHasPaint := True;
FPopupMode := pmNone;
FPopupParent := nil;
MDIAreaHandle := nil;
MDIChildArea := nil;
@ -6711,42 +6709,8 @@ begin
end;
procedure TQtMainWindow.UpdateParent;
var
NewParent: QWidgetH;
begin
NewParent := nil;
case FPopupMode of
pmNone: ;// no popup parent
pmAuto:
// active form is parent
if Screen.ActiveForm <> nil then
NewParent := TQtWidget(Screen.ActiveForm.Handle).Widget;
pmExplicit:
begin
// parent is FPopupParent
if FPopupParent <> nil then
NewParent := FPopupParent
{$IFDEF HASX11}
else
begin
if not IsMainForm then
begin
NewParent := TQtMainWindow(Application.MainForm.Handle).Widget;
setWindowFlags(windowFlags or QtSheet);
end;
end;
{$ENDIF}
end;
end;
if (NewParent = nil) and (FPopupMode <> pmNone) and
not FShowOnTaskBar and not IsMainForm then
NewParent := TQtMainWindow(Application.MainForm.Handle).Widget;
{$IFDEF MSWINDOWS}
if (NewParent = nil) and (FPopupMode = pmNone) and
not FShowOnTaskBar and not IsMainForm then
NewParent := TQtMainWindow(Application.MainForm.Handle).Widget;
{$ENDIF}
ChangeParent(NewParent);
ChangeParent(FPopupParent);
end;
{------------------------------------------------------------------------------
@ -7367,9 +7331,8 @@ begin
{$ENDIF}
end;
procedure TQtMainWindow.setPopupParent(APopupMode: TPopupMode; NewParent: QWidgetH);
procedure TQtMainWindow.setRealPopupParent(NewParent: QWidgetH);
begin
FPopupMode := APopupMode;
FPopupParent := NewParent;
UpdateParent;
end;

View File

@ -80,8 +80,8 @@ type
class procedure SetFormBorderStyle(const AForm: TCustomForm; const AFormBorderStyle: TFormBorderStyle); override;
class procedure SetFormStyle(const AForm: TCustomform; const AFormStyle, AOldFormStyle: TFormStyle); override;
class procedure SetIcon(const AForm: TCustomForm; const Small, Big: HICON); override;
class procedure SetPopupParent(const ACustomForm: TCustomForm;
const APopupMode: TPopupMode; const APopupParent: TCustomForm); override;
class procedure SetRealPopupParent(const ACustomForm: TCustomForm;
const APopupParent: TCustomForm); override;
class procedure SetShowInTaskbar(const AForm: TCustomForm; const AValue: TShowInTaskbar); override;
class procedure ShowHide(const AWinControl: TWinControl); override; //TODO: rename to SetVisible(control, visible)
class procedure ShowModal(const ACustomForm: TCustomForm); override;
@ -145,7 +145,7 @@ class function TQtWSCustomForm.CreateHandle(const AWinControl: TWinControl;
var
QtMainWindow: TQtMainWindow;
Str: WideString;
PopupParent: QWidgetH;
APopupParent: TCustomForm;
AForm: TCustomForm;
begin
{$ifdef VerboseQt}
@ -191,11 +191,9 @@ begin
not (csDesigning in AForm.ComponentState))
{$endif} then
QtMainWindow.setShowInTaskBar(False);
if Assigned(AForm.PopupParent) and AForm.PopupParent.HandleAllocated then
PopupParent := TQtWidget(AForm.PopupParent.Handle).Widget
else
PopupParent := nil;
QtMainWindow.setPopupParent(AForm.PopupMode, PopupParent);
APopupParent := AForm.GetRealPopupParent;
if APopupParent<>nil then
QtMainWindow.setRealPopupParent(TQtWidget(APopupParent.Handle).Widget);
end;
{$IFDEF HASX11}
@ -329,18 +327,18 @@ begin
TQtWidget(AForm.Handle).setWindowIcon(nil);
end;
class procedure TQtWSCustomForm.SetPopupParent(const ACustomForm: TCustomForm;
const APopupMode: TPopupMode; const APopupParent: TCustomForm);
class procedure TQtWSCustomForm.SetRealPopupParent(
const ACustomForm: TCustomForm; const APopupParent: TCustomForm);
var
PopupParent: QWidgetH;
begin
if not ACustomForm.HandleAllocated or (csDestroying in ACustomForm.ComponentState) then
exit;
if Assigned(APopupParent) and APopupParent.HandleAllocated then
if Assigned(APopupParent) then
PopupParent := TQtWidget(APopupParent.Handle).Widget
else
PopupParent := nil;
TQtMainWindow(ACustomForm.Handle).setPopupParent(APopupMode, PopupParent);
TQtMainWindow(ACustomForm.Handle).setRealPopupParent(PopupParent);
end;
{------------------------------------------------------------------------------
@ -382,8 +380,7 @@ var
Widget: TQtMainWindow;
R: TRect;
{$IFDEF HASX11}
ActiveWin: HWND;
W: QWidgetH;
APopupParent: TCustomForm;
{$ENDIF}
Flags: Cardinal;
@ -444,23 +441,9 @@ begin
(QtWidgetSet.WindowManagerName = 'xfwm4') or
(QtWidgetSet.WindowManagerName = 'metacity') then
begin
W := nil;
ActiveWin := GetActiveWindow;
if ActiveWin <> 0 then
begin
if Assigned(TQtWidget(ActiveWin).LCLObject) then
begin
if (TQtWidget(ActiveWin).LCLObject is TCustomForm) then
begin
with TCustomForm(TQtWidget(ActiveWin).LCLObject) do
begin
if Visible and (FormStyle <> fsSplash) then
W := TQtWidget(Handle).Widget;
end;
end;
end;
end;
QWidget_setParent(Widget.Widget, W);
APopupParent := TCustomForm(AWinControl).GetRealPopupParent;
if APopupParent <> nil then
QWidget_setParent(Widget.Widget, TQtWidget(APopupParent.Handle).Widget);
end else
QWidget_setParent(Widget.Widget, QApplication_desktop());
{$endif}
@ -524,7 +507,7 @@ begin
not (fsModal in TForm(AWinControl).FormState) and
(TForm(AWinControl).FormStyle <> fsMDIChild) and
(QApplication_activeModalWidget() <> nil) then
TQtMainWindow(Widget).setPopupParent(pmExplicit,
TQtMainWindow(Widget).setRealPopupParent(
QApplication_activeModalWidget());
end else
begin
@ -542,20 +525,16 @@ begin
if AWinControl.HandleObjectShouldBeVisible and
not (TCustomForm(AWinControl).FormStyle in fsAllStayOnTop) and
not (fsModal in TCustomForm(AWinControl).FormState) and
(TCustomForm(AWinControl).FormStyle <> fsMDIChild) and
(((TCustomForm(AWinControl).PopupMode = pmAuto) and
(QApplication_activeWindow <> nil)) or
((TCustomForm(AWinControl).PopupMode = pmExplicit) and
(TCustomForm(AWinControl).PopupParent <> nil))) then
(TCustomForm(AWinControl).FormStyle <> fsMDIChild) then
begin
APopupParent := TCustomForm(AWinControl).GetRealPopupParent;
if (APopupParent <> nil) then
begin
if (TCustomForm(AWinControl).PopupMode = pmAuto) then
W := QApplication_activeWindow
else
W := TQtWidget(TCustomForm(AWinControl).PopupParent.Handle).Widget;
Flags := Widget.windowFlags;
Widget.setParent(W);
Widget.setParent(TQtWidget(APopupParent.Handle).Widget);
Widget.setWindowFlags(Flags or QtTool);
end;
end;
{$ENDIF}
end;
end;

View File

@ -78,8 +78,8 @@ type
class procedure SetFormStyle(const AForm: TCustomform; const AFormStyle, AOldFormStyle: TFormStyle); override;
class procedure SetIcon(const AForm: TCustomForm; const Small, Big: HICON); override;
class procedure ShowModal(const ACustomForm: TCustomForm); override;
class procedure SetPopupParent(const ACustomForm: TCustomForm;
const APopupMode: TPopupMode; const APopupParent: TCustomForm); override;
class procedure SetRealPopupParent(const ACustomForm: TCustomForm;
const APopupParent: TCustomForm); override;
class procedure SetShowInTaskbar(const AForm: TCustomForm; const AValue: TShowInTaskbar); override;
class procedure ShowHide(const AWinControl: TWinControl); override;
end;
@ -637,8 +637,8 @@ begin
RDW_INVALIDATE or RDW_FRAME or RDW_NOCHILDREN or RDW_ERASE);
end;
class procedure TWin32WSCustomForm.SetPopupParent(const ACustomForm: TCustomForm;
const APopupMode: TPopupMode; const APopupParent: TCustomForm);
class procedure TWin32WSCustomForm.SetRealPopupParent(
const ACustomForm: TCustomForm; const APopupParent: TCustomForm);
begin
// changing parent is not possible without handle recreation
RecreateWnd(ACustomForm);

View File

@ -86,8 +86,8 @@ type
class procedure SetIcon(const AForm: TCustomForm; const Small, Big: HICON); virtual;
class procedure ShowModal(const ACustomForm: TCustomForm); virtual;
class procedure SetModalResult(const ACustomForm: TCustomForm; ANewValue: TModalResult); virtual;
class procedure SetPopupParent(const ACustomForm: TCustomForm;
const APopupMode: TPopupMode; const APopupParent: TCustomForm); virtual;
class procedure SetRealPopupParent(const ACustomForm: TCustomForm;
const APopupParent: TCustomForm); virtual;
class procedure SetShowInTaskbar(const AForm: TCustomForm; const AValue: TShowInTaskbar); virtual;
class procedure SetZPosition(const AWinControl: TWinControl; const APosition: TWSZPosition); virtual;
class function GetDefaultColor(const AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor; override;
@ -199,8 +199,8 @@ class procedure TWSCustomForm.SetModalResult(const ACustomForm: TCustomForm;
begin
end;
class procedure TWSCustomForm.SetPopupParent(const ACustomForm: TCustomForm;
const APopupMode: TPopupMode; const APopupParent: TCustomForm);
class procedure TWSCustomForm.SetRealPopupParent(
const ACustomForm: TCustomForm; const APopupParent: TCustomForm);
begin
end;