summaryrefslogtreecommitdiffstats
path: root/src/core/web_event_factory.h
blob: 53ebfb5096c1fd61faa63bb583054fc02c4a80a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef WEB_EVENT_FACTORY_H
#define WEB_EVENT_FACTORY_H

#include "QtGui/qtguiglobal.h"

#include "content/public/common/input/native_web_keyboard_event.h"
#if QT_CONFIG(gestures)
#include "third_party/blink/public/common/input/web_gesture_event.h"
#endif
#include "third_party/blink/public/common/input/web_mouse_event.h"
#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"

QT_BEGIN_NAMESPACE
class QEvent;
class QHoverEvent;
class QKeyEvent;
class QMouseEvent;
#if QT_CONFIG(tabletevent)
class QTabletEvent;
#endif
class QWheelEvent;
#if QT_CONFIG(gestures)
class QNativeGestureEvent;
#endif
QT_END_NAMESPACE

namespace QtWebEngineCore {

class RenderWidgetHostViewQtDelegate;

class WebEventFactory {

public:
    static blink::WebMouseEvent toWebMouseEvent(QMouseEvent *);
    static blink::WebMouseEvent toWebMouseEvent(QHoverEvent *);
#if QT_CONFIG(tabletevent)
    static blink::WebMouseEvent toWebMouseEvent(QTabletEvent *);
#endif
    static blink::WebMouseEvent toWebMouseEvent(QEvent *);
#if QT_CONFIG(gestures)
    static blink::WebGestureEvent toWebGestureEvent(QNativeGestureEvent *);
#endif
    static blink::WebMouseWheelEvent toWebWheelEvent(QWheelEvent *);
    static bool coalesceWebWheelEvent(blink::WebMouseWheelEvent &, QWheelEvent *);
    static void sendUnhandledWheelEvent(const blink::WebGestureEvent &, RenderWidgetHostViewQtDelegate *);
    static content::NativeWebKeyboardEvent toWebKeyboardEvent(QKeyEvent*);
    static bool getEditCommand(QKeyEvent *event, std::string *editCommand);
};

} // namespace QtWebEngineCore

#endif // WEB_EVENT_FACTORY_H