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) 2021 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 : #include "accessibleobject.h"
23 :
24 : #include "accessibilitycontroller.h"
25 : #include "accessibleiteminterface.h"
26 :
27 : #include "log.h"
28 :
29 : using namespace muse::accessibility;
30 :
31 10 : AccessibleObject::AccessibleObject(IAccessible* item)
32 10 : : QObject()
33 : {
34 20 : setObjectName("AccessibleObject");
35 10 : m_item = item;
36 10 : }
37 :
38 10 : QAccessibleInterface* AccessibleObject::accessibleInterface(QObject* object)
39 : {
40 10 : AccessibleObject* accessibleObject = qobject_cast<AccessibleObject*>(object);
41 10 : IF_ASSERT_FAILED(accessibleObject) {
42 0 : return nullptr;
43 : }
44 :
45 10 : return static_cast<QAccessibleInterface*>(new AccessibleItemInterface(accessibleObject));
46 : }
47 :
48 10 : void AccessibleObject::setController(std::weak_ptr<AccessibilityController> controller)
49 : {
50 10 : m_controller = controller;
51 10 : }
52 :
53 0 : const std::weak_ptr<AccessibilityController>& AccessibleObject::controller() const
54 : {
55 0 : return m_controller;
56 : }
57 :
58 10 : IAccessible* AccessibleObject::item() const
59 : {
60 10 : return m_item;
61 : }
|