зеркало из https://github.com/mozilla/pjs.git
Added CaptureMouse method to nsIWidget. Implemented CaptureMouse in nsWindow.cpp
Added a base implementation to nsBaseWidget.cpp.
This commit is contained in:
Родитель
d4213bbc88
Коммит
9e3e78e63c
|
@ -653,6 +653,13 @@ class nsIWidget : public nsISupports {
|
|||
NS_IMETHOD EnableFileDrop(PRBool aEnable) = 0;
|
||||
|
||||
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) = 0;
|
||||
|
||||
/**
|
||||
* Enables/Disables system mouse capture.
|
||||
* @param aCapture PR_TRUE enables mouse capture, PR_FALSE disables mouse capture
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD CaptureMouse(PRBool aCapture) = 0;
|
||||
};
|
||||
|
||||
#endif // nsIWidget_h__
|
||||
|
|
|
@ -155,6 +155,17 @@ nsWindow::~nsWindow()
|
|||
}
|
||||
|
||||
|
||||
NS_METHOD nsWindow::CaptureMouse(PRBool aCapture)
|
||||
{
|
||||
if (PR_TRUE == aCapture) {
|
||||
SetCapture(mWnd);
|
||||
} else {
|
||||
ReleaseCapture();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Default for height modification is to do nothing
|
||||
|
@ -2017,7 +2028,7 @@ BOOL nsWindow::OnKeyDown( UINT aVirtualKeyCode, UINT aScanCode)
|
|||
}
|
||||
#else
|
||||
BOOL nsWindow::OnKeyDown( UINT aVirtualKeyCode, UINT aScanCode)
|
||||
{
|
||||
{
|
||||
WORD asciiKey;
|
||||
|
||||
asciiKey = 0;
|
||||
|
@ -3138,13 +3149,13 @@ PRBool ChildWindow::DispatchMouseEvent(PRUint32 aEventType, nsPoint* aPoint)
|
|||
case NS_MOUSE_LEFT_BUTTON_DOWN:
|
||||
case NS_MOUSE_MIDDLE_BUTTON_DOWN:
|
||||
case NS_MOUSE_RIGHT_BUTTON_DOWN:
|
||||
SetCapture(mWnd);
|
||||
SetCapture(mWnd);
|
||||
break;
|
||||
|
||||
case NS_MOUSE_LEFT_BUTTON_UP:
|
||||
case NS_MOUSE_MIDDLE_BUTTON_UP:
|
||||
case NS_MOUSE_RIGHT_BUTTON_UP:
|
||||
ReleaseCapture();
|
||||
ReleaseCapture();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -86,7 +86,7 @@ public:
|
|||
NS_IMETHOD IsVisible(PRBool & aState);
|
||||
HWND mBorderlessParent;
|
||||
|
||||
|
||||
NS_IMETHOD CaptureMouse(PRBool aCapture);
|
||||
NS_IMETHOD Move(PRUint32 aX, PRUint32 aY);
|
||||
NS_IMETHOD Resize(PRUint32 aWidth,
|
||||
PRUint32 aHeight,
|
||||
|
|
|
@ -217,6 +217,11 @@ void nsBaseWidget::BaseCreate(nsIWidget *aParent,
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBaseWidget::CaptureMouse(PRBool aCapture)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Accessor functions to get/set the client data
|
||||
|
|
|
@ -55,6 +55,7 @@ public:
|
|||
NS_IMETHOD PreCreateWidget(nsWidgetInitData *aWidgetInitData) { return NS_OK;}
|
||||
|
||||
// nsIWidget interface
|
||||
NS_IMETHOD CaptureMouse(PRBool aCapture);
|
||||
NS_IMETHOD GetClientData(void*& aClientData);
|
||||
NS_IMETHOD SetClientData(void* aClientData);
|
||||
NS_IMETHOD Destroy();
|
||||
|
|
Загрузка…
Ссылка в новой задаче