mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 168117 - "Need to implement nsIWidget::SetParent on the Mac" [r=pink sr=bryner]
This commit is contained in:
parent
b01ff42ba2
commit
43eb45f980
@ -292,6 +292,7 @@ public:
|
||||
NS_IMETHOD Show(PRBool aState);
|
||||
NS_IMETHOD IsVisible(PRBool& outState);
|
||||
|
||||
NS_IMETHOD SetParent(nsIWidget* aNewParent);
|
||||
virtual nsIWidget* GetParent(void);
|
||||
|
||||
NS_IMETHOD ModalEventFilter(PRBool aRealEvent, void *aEvent,
|
||||
|
@ -972,8 +972,38 @@ NS_IMETHODIMP nsChildView::Show(PRBool aState)
|
||||
}
|
||||
|
||||
|
||||
nsIWidget*
|
||||
nsChildView::GetParent(void)
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Reset the parent of this widget
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsChildView::SetParent(nsIWidget* aNewParent)
|
||||
{
|
||||
NS_ENSURE_ARG(aNewParent);
|
||||
|
||||
// make sure we stay alive
|
||||
nsCOMPtr<nsIWidget> kungFuDeathGrip(this);
|
||||
|
||||
// remove us from our existing parent
|
||||
if (mParentWidget)
|
||||
mParentWidget->RemoveChild(this);
|
||||
[mView removeFromSuperview]; // we hold a ref to mView, so this is OK
|
||||
|
||||
// add us to the new parent
|
||||
aNewParent->AddChild(this);
|
||||
mParentWidget = aNewParent;
|
||||
mParentView = (NSView*)aNewParent->GetNativeData(NS_NATIVE_WIDGET);
|
||||
[mParentView addSubview:mView];
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Get this widget's parent
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsIWidget* nsChildView::GetParent(void)
|
||||
{
|
||||
return mParentWidget;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user