зеркало из https://github.com/mozilla/pjs.git
Mouse Wheel Support for Qt Mozilla (Bugzilla #86432)
This commit is contained in:
Родитель
273285be81
Коммит
d4f58669c0
|
@ -18,8 +18,9 @@
|
|||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* John C. Griggs <johng@corel.com>
|
||||
* John C. Griggs <jcgriggs@sympatico.ca>
|
||||
* Denis Issoupov <denis@macadamian.com>
|
||||
* Wes Morgan <wmorga13@calvin.edu>
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -507,6 +508,17 @@ bool nsQBaseWidget::eventFilter(QObject *aObj,QEvent *aEvent)
|
|||
handled = true;
|
||||
break;
|
||||
|
||||
case QEvent::Wheel:
|
||||
if (mEnabled) {
|
||||
#ifdef DBG_JCG_EVENT
|
||||
printf("JCG: Mouse Wheel widget: %p\n",mWidget);
|
||||
#endif
|
||||
handled = MouseWheelEvent((QWheelEvent*)aEvent);
|
||||
}
|
||||
else
|
||||
handled = true;
|
||||
break;
|
||||
|
||||
case QEvent::KeyPress:
|
||||
if (mEnabled) {
|
||||
#ifdef DBG_JCG_EVENT
|
||||
|
@ -778,6 +790,30 @@ PRBool nsQBaseWidget::MouseExitEvent(QEvent *aEvent)
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool nsQBaseWidget::MouseWheelEvent(QWheelEvent *aEvent)
|
||||
{
|
||||
if (aEvent && mWidget) {
|
||||
nsMouseScrollEvent nsEvent;
|
||||
|
||||
nsEvent.scrollFlags = nsMouseScrollEvent::kIsVertical;
|
||||
nsEvent.delta = (int)((aEvent->delta()/120) * -3);
|
||||
nsEvent.message = NS_MOUSE_SCROLL;
|
||||
nsEvent.widget = mWidget;
|
||||
nsEvent.nativeMsg = (void*)aEvent;
|
||||
nsEvent.eventStructType = NS_MOUSE_SCROLL_EVENT;
|
||||
nsEvent.time = 0;
|
||||
nsEvent.point.x = nscoord(aEvent->x());
|
||||
nsEvent.point.y = nscoord(aEvent->y());
|
||||
nsEvent.isShift = aEvent->state() & ShiftButton;
|
||||
nsEvent.isControl = aEvent->state() & ControlButton;
|
||||
nsEvent.isAlt = aEvent->state() & AltButton;
|
||||
nsEvent.isMeta = PR_FALSE;
|
||||
|
||||
mWidget->DispatchMouseScrollEvent(nsEvent);
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool nsQBaseWidget::DestroyEvent()
|
||||
{
|
||||
if (mWidget) {
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* John C. Griggs <johng@corel.com>
|
||||
* John C. Griggs <jcgriggs@sympatico.ca>
|
||||
* Denis Issoupov <denis@macadamian.com>
|
||||
* Wes Morgan <wmorga13@calvin.edu>
|
||||
*
|
||||
*/
|
||||
#ifndef nsQWidget_h__
|
||||
|
@ -147,6 +148,7 @@ public:
|
|||
virtual PRBool MouseMovedEvent(QMouseEvent *aEvent);
|
||||
virtual PRBool MouseEnterEvent(QEvent *aEvent);
|
||||
virtual PRBool MouseExitEvent(QEvent *aEvent);
|
||||
virtual PRBool MouseWheelEvent(QWheelEvent *aEvent);
|
||||
virtual PRBool DestroyEvent();
|
||||
virtual PRBool ResizeEvent(QResizeEvent *aEvent);
|
||||
virtual PRBool MoveEvent(QMoveEvent *aEvent);
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* John C. Griggs <johng@corel.com>
|
||||
* John C. Griggs <jcgriggs@sympatico.ca>
|
||||
* Wes Morgan <wmorga13@calvin.edu>
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -743,6 +744,14 @@ NS_IMETHODIMP nsWidget::DispatchEvent(nsGUIEvent *event,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsWidget::DispatchMouseScrollEvent(nsMouseScrollEvent& aEvent)
|
||||
{
|
||||
if (nsnull != mEventCallback) {
|
||||
return DispatchWindowEvent(&aEvent);
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Deal with all sorts of mouse event
|
||||
//-------------------------------------------------------------------------
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* John C. Griggs <johng@corel.com>
|
||||
* John C. Griggs <jcgriggs@sympatico.ca>
|
||||
* Wes Morgan <wmorga13@calvin.edu>
|
||||
*
|
||||
*/
|
||||
#ifndef nsWidget_h__
|
||||
|
@ -137,6 +138,7 @@ public:
|
|||
PRBool ConvertStatus(nsEventStatus aStatus);
|
||||
PRBool DispatchMouseEvent(nsMouseEvent& aEvent);
|
||||
PRBool DispatchStandardEvent(PRUint32 aMsg);
|
||||
PRBool DispatchMouseScrollEvent(nsMouseScrollEvent& aEvent);
|
||||
|
||||
virtual PRBool IsPopup() const { return PR_FALSE; };
|
||||
virtual PRBool IsDialog() const { return PR_FALSE; };
|
||||
|
|
Загрузка…
Ссылка в новой задаче