QWindowKit  1.5.1.0
Cross-platform window customization framework
Loading...
Searching...
No Matches
nativeeventfilter_p.h
1// Copyright (C) 2023-present Stdware Collections (https://www.github.com/stdware)
2// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao)
3// SPDX-License-Identifier: Apache-2.0
4
5#ifndef NATIVEEVENTFILTER_P_H
6#define NATIVEEVENTFILTER_P_H
7
8//
9// W A R N I N G !!!
10// -----------------
11//
12// This file is not part of the QWindowKit API. It is used purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or may even be removed.
15//
16
17#include <QWKCore/qwkglobal.h>
18
19namespace QWK {
20
21 class NativeEventFilter;
22
23 class QWK_CORE_EXPORT NativeEventDispatcher {
24 public:
25 NativeEventDispatcher();
26 virtual ~NativeEventDispatcher();
27
28 public:
29 virtual bool nativeDispatch(const QByteArray &eventType, void *message,
30 QT_NATIVE_EVENT_RESULT_TYPE *result);
31
32 public:
33 void installNativeEventFilter(NativeEventFilter *filter);
34 void removeNativeEventFilter(NativeEventFilter *filter);
35
36 protected:
37 QList<NativeEventFilter *> m_nativeEventFilters;
38
39 int m_nativeDispatchDepth = 0;
40
41 friend class NativeEventFilter;
42
43 Q_DISABLE_COPY(NativeEventDispatcher)
44 };
45
46 class QWK_CORE_EXPORT NativeEventFilter {
47 public:
48 NativeEventFilter();
49 virtual ~NativeEventFilter();
50
51 public:
52 virtual bool nativeEventFilter(const QByteArray &eventType, void *message,
53 QT_NATIVE_EVENT_RESULT_TYPE *result) = 0;
54
55 protected:
56 NativeEventDispatcher *m_nativeDispatcher = nullptr;
57
58 friend class NativeEventDispatcher;
59
60 Q_DISABLE_COPY(NativeEventFilter)
61 };
62
63 // Automatically install to QCoreApplication at construction
64 class QWK_CORE_EXPORT AppNativeEventFilter : public NativeEventFilter {
65 public:
66 AppNativeEventFilter();
67 ~AppNativeEventFilter() override;
68 };
69
70}
71
72#endif // NATIVEEVENTFILTER_P_H
QWindowKit namespace.
Definition abstractwindowcontext.cpp:13