Jacob Muchow
2024-05-16 293bc9cf2915b9ba0897b258ba7bfc5da93f2640
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware)
// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao)
// SPDX-License-Identifier: Apache-2.0
 
#ifndef NATIVEEVENTFILTER_P_H
#define NATIVEEVENTFILTER_P_H
 
//
//  W A R N I N G !!!
//  -----------------
//
// This file is not part of the QWindowKit API. It is used purely as an
// implementation detail. This header file may change from version to
// version without notice, or may even be removed.
//
 
#include <QWKCore/qwkglobal.h>
 
namespace QWK {
 
    class NativeEventFilter;
 
    class QWK_CORE_EXPORT NativeEventDispatcher {
    public:
        NativeEventDispatcher();
        virtual ~NativeEventDispatcher();
 
    public:
        virtual bool nativeDispatch(const QByteArray &eventType, void *message,
                                    QT_NATIVE_EVENT_RESULT_TYPE *result);
 
    public:
        void installNativeEventFilter(NativeEventFilter *filter);
        void removeNativeEventFilter(NativeEventFilter *filter);
 
    protected:
        QVector<NativeEventFilter *> m_nativeEventFilters;
 
        friend class NativeEventFilter;
 
        Q_DISABLE_COPY(NativeEventDispatcher)
    };
 
    class QWK_CORE_EXPORT NativeEventFilter {
    public:
        NativeEventFilter();
        virtual ~NativeEventFilter();
 
    public:
        virtual bool nativeEventFilter(const QByteArray &eventType, void *message,
                                       QT_NATIVE_EVENT_RESULT_TYPE *result) = 0;
 
    protected:
        NativeEventDispatcher *m_nativeDispatcher;
 
        friend class NativeEventDispatcher;
 
        Q_DISABLE_COPY(NativeEventFilter)
    };
 
    // Automatically install to QCoreApplication at construction
    class QWK_CORE_EXPORT AppNativeEventFilter : public NativeEventFilter {
    public:
        AppNativeEventFilter();
        ~AppNativeEventFilter() override;
    };
 
}
 
#endif // NATIVEEVENTFILTER_P_H