зеркало из https://github.com/mozilla/pjs.git
Changed EnableDropFile to EnableDragDrop. D&D is now NOT automatically registered for all windows during
creation and initialization. The method EnableDragDrop is not used to "turn it on". The method nsIView::CreateView has parameter that indicates whether it should be turned on or not This make it configurable from the outside, it is needed for the editor
This commit is contained in:
Родитель
814c030786
Коммит
af70448f86
|
@ -650,7 +650,7 @@ class nsIWidget : public nsISupports {
|
||||||
* Enables the dropping of files to a widget (XXX this is temporary)
|
* Enables the dropping of files to a widget (XXX this is temporary)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD EnableFileDrop(PRBool aEnable) = 0;
|
NS_IMETHOD EnableDragDrop(PRBool aEnable) = 0;
|
||||||
|
|
||||||
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) = 0;
|
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) = 0;
|
||||||
|
|
||||||
|
|
|
@ -619,14 +619,14 @@ nsresult nsWindow::StandardWindowCreate(nsIWidget *aParent,
|
||||||
gOLEInited = TRUE;
|
gOLEInited = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
mNativeDragTarget = new nsNativeDragTarget(this);
|
/*mNativeDragTarget = new nsNativeDragTarget(this);
|
||||||
if (NULL != mNativeDragTarget) {
|
if (NULL != mNativeDragTarget) {
|
||||||
mNativeDragTarget->AddRef();
|
mNativeDragTarget->AddRef();
|
||||||
if (S_OK == ::CoLockObjectExternal((LPUNKNOWN)mNativeDragTarget,TRUE,FALSE)) {
|
if (S_OK == ::CoLockObjectExternal((LPUNKNOWN)mNativeDragTarget,TRUE,FALSE)) {
|
||||||
if (S_OK == ::RegisterDragDrop(mWnd, (LPDROPTARGET)mNativeDragTarget)) {
|
if (S_OK == ::RegisterDragDrop(mWnd, (LPDROPTARGET)mNativeDragTarget)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
// call the event callback to notify about creation
|
// call the event callback to notify about creation
|
||||||
|
@ -696,11 +696,7 @@ NS_METHOD nsWindow::Destroy()
|
||||||
nsBaseWidget::Destroy();
|
nsBaseWidget::Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL != mNativeDragTarget) {
|
EnableDragDrop(PR_FALSE);
|
||||||
if (S_OK == ::CoLockObjectExternal((LPUNKNOWN)mNativeDragTarget, FALSE, TRUE)) {
|
|
||||||
}
|
|
||||||
NS_RELEASE(mNativeDragTarget);
|
|
||||||
}
|
|
||||||
|
|
||||||
// destroy the HWND
|
// destroy the HWND
|
||||||
if (mWnd) {
|
if (mWnd) {
|
||||||
|
@ -1811,19 +1807,33 @@ nsresult nsWindow::MenuHasBeenSelected(
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
NS_METHOD nsWindow::EnableFileDrop(PRBool aEnable)
|
NS_METHOD nsWindow::EnableDragDrop(PRBool aEnable)
|
||||||
{
|
{
|
||||||
//::DragAcceptFiles(mWnd, (aEnable?TRUE:FALSE));
|
nsresult rv = NS_ERROR_FAILURE;
|
||||||
mNativeDragTarget = new nsNativeDragTarget(this);
|
|
||||||
if (NULL != mNativeDragTarget) {
|
|
||||||
mNativeDragTarget->AddRef();
|
|
||||||
if (S_OK == ::CoLockObjectExternal((LPUNKNOWN)mNativeDragTarget,TRUE,FALSE)) {
|
|
||||||
if (S_OK == ::RegisterDragDrop(mWnd, (LPDROPTARGET)mNativeDragTarget)) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
if (aEnable) {
|
||||||
|
if (nsnull == mNativeDragTarget) {
|
||||||
|
mNativeDragTarget = new nsNativeDragTarget(this);
|
||||||
|
if (NULL != mNativeDragTarget) {
|
||||||
|
mNativeDragTarget->AddRef();
|
||||||
|
if (S_OK == ::CoLockObjectExternal((LPUNKNOWN)mNativeDragTarget,TRUE,FALSE)) {
|
||||||
|
if (S_OK == ::RegisterDragDrop(mWnd, (LPDROPTARGET)mNativeDragTarget)) {
|
||||||
|
rv = NS_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (nsnull != mWnd && NULL != mNativeDragTarget) {
|
||||||
|
::RevokeDragDrop(mWnd);
|
||||||
|
if (S_OK == ::CoLockObjectExternal((LPUNKNOWN)mNativeDragTarget, FALSE, TRUE)) {
|
||||||
|
rv = NS_OK;
|
||||||
|
}
|
||||||
|
NS_RELEASE(mNativeDragTarget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ public:
|
||||||
NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight);
|
NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight);
|
||||||
NS_IMETHOD SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight);
|
NS_IMETHOD SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight);
|
||||||
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
|
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
|
||||||
NS_IMETHOD EnableFileDrop(PRBool aEnable);
|
NS_IMETHOD EnableDragDrop(PRBool aEnable);
|
||||||
|
|
||||||
virtual void SetUpForPaint(HDC aHDC);
|
virtual void SetUpForPaint(HDC aHDC);
|
||||||
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) {}
|
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) {}
|
||||||
|
|
|
@ -425,7 +425,7 @@ void nsBaseWidget::OnDestroy()
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
nsBaseWidget::Enumerator::Enumerator(nsBaseWidget & inParent)
|
nsBaseWidget::Enumerator::Enumerator(nsBaseWidget & inParent)
|
||||||
: mParent(inParent), mCurrentPosition(0)
|
: mCurrentPosition(0), mParent(inParent)
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
}
|
}
|
||||||
|
@ -761,7 +761,7 @@ NS_METHOD nsBaseWidget::SetVerticalScrollbar(nsIWidget * aWidget)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_METHOD nsBaseWidget::EnableFileDrop(PRBool aEnable)
|
NS_METHOD nsBaseWidget::EnableDragDrop(PRBool aEnable)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ public:
|
||||||
NS_IMETHOD GetBorderSize(PRInt32 &aWidth, PRInt32 &aHeight);
|
NS_IMETHOD GetBorderSize(PRInt32 &aWidth, PRInt32 &aHeight);
|
||||||
NS_IMETHOD Paint(nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect);
|
NS_IMETHOD Paint(nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect);
|
||||||
NS_IMETHOD SetVerticalScrollbar(nsIWidget * aScrollbar);
|
NS_IMETHOD SetVerticalScrollbar(nsIWidget * aScrollbar);
|
||||||
NS_IMETHOD EnableFileDrop(PRBool aEnable);
|
NS_IMETHOD EnableDragDrop(PRBool aEnable);
|
||||||
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) {}
|
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) {}
|
||||||
virtual void FreeNativeData(void * data, PRUint32 aDataType) {}//~~~
|
virtual void FreeNativeData(void * data, PRUint32 aDataType) {}//~~~
|
||||||
protected:
|
protected:
|
||||||
|
|
Загрузка…
Ссылка в новой задаче