2 Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
21 #include "PlatformWheelEvent.h"
23 #include "PlatformMouseEvent.h"
24 #include "Scrollbar.h"
26 #include <qapplication.h>
27 #include <QWheelEvent>
32 PlatformWheelEvent::PlatformWheelEvent(QWheelEvent
* e
)
33 #ifdef QT_NO_WHEELEVENT
38 : m_position(e
->pos())
39 , m_globalPosition(e
->globalPos())
40 #ifdef QT_MAC_USE_COCOA
41 , m_granularity(ScrollByPixelWheelEvent
)
43 , m_granularity(ScrollByLineWheelEvent
)
46 , m_shiftKey(e
->modifiers() & Qt::ShiftModifier
)
47 , m_ctrlKey(e
->modifiers() & Qt::ControlModifier
)
48 , m_altKey(e
->modifiers() & Qt::AltModifier
)
49 , m_metaKey(e
->modifiers() & Qt::MetaModifier
)
51 if (e
->orientation() == Qt::Horizontal
) {
52 m_deltaX
= (e
->delta() / 120);
56 m_deltaY
= (e
->delta() / 120);
59 m_deltaX
*= QApplication::wheelScrollLines();
60 // use the same single scroll step as QTextEdit (in
61 // QTextEditPrivate::init [h,v]bar->setSingleStep )
62 // and divide by the default WebKit scroll step to
63 // get the Qt mouse wheel scroll behavior
64 static const float cDefaultQtScrollStep
= 20.f
;
65 m_deltaY
*= QApplication::wheelScrollLines() *
66 (cDefaultQtScrollStep
/ cMouseWheelPixelsPerLineStep
);
68 #endif // QT_NO_WHEELEVENT
70 } // namespace WebCore