Line data Source code
1 : /*
2 : * SPDX-License-Identifier: GPL-3.0-only
3 : * MuseScore-CLA-applies
4 : *
5 : * MuseScore Studio
6 : * Music Composition & Notation
7 : *
8 : * Copyright (C) 2026 MuseScore Limited and others
9 : *
10 : * This program is free software: you can redistribute it and/or modify
11 : * it under the terms of the GNU General Public License version 3 as
12 : * published by the Free Software Foundation.
13 : *
14 : * This program is distributed in the hope that it will be useful,
15 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : * GNU General Public License for more details.
18 : *
19 : * You should have received a copy of the GNU General Public License
20 : * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 : */
22 : #pragma once
23 :
24 : #include <memory>
25 : #include <vector>
26 :
27 : #include "modularity/imoduleinterface.h"
28 : #include "async/channel.h"
29 :
30 : #ifndef NO_QT_SUPPORT
31 : #include <QEvent>
32 :
33 : class QObject;
34 : #endif
35 :
36 : namespace muse {
37 : class IApplicationEventController : MODULE_GLOBAL_INTERFACE
38 : {
39 46 : INTERFACE_ID(IApplicationEventController)
40 : public:
41 :
42 52 : virtual ~IApplicationEventController() = default;
43 :
44 : #ifndef NO_QT_SUPPORT
45 :
46 : struct EventData {
47 : QObject* watched = nullptr;
48 : QEvent* event = nullptr;
49 : };
50 :
51 : virtual async::Channel<EventData> eventReceived() const = 0;
52 : virtual void setPendingEventTypes(const std::vector<QEvent::Type>& types) = 0;
53 :
54 : //! NOTE The watched object is deliberately not returned.
55 : //! By the time the events are taken it may already be destroyed.
56 : virtual std::vector<std::unique_ptr<QEvent> > takePendingEvents() = 0;
57 : #endif
58 : };
59 : }
|