Line data Source code
1 : /*
2 : * SPDX-License-Identifier: GPL-3.0-only
3 : * MuseScore-Studio-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 : #ifndef MU_ENGRAVING_ACCESSIBLEROOT_H
23 : #define MU_ENGRAVING_ACCESSIBLEROOT_H
24 :
25 : #include "accessibleitem.h"
26 : #include "../dom/rootitem.h"
27 :
28 : namespace mu::engraving {
29 : using AccessibleMapToScreenFunc = std::function<RectF (const RectF&)>;
30 :
31 : class AccessibleRoot : public AccessibleItem
32 : {
33 0 : OBJECT_ALLOCATOR(engraving, AccessibleRoot)
34 : public:
35 : AccessibleRoot(RootItem* e, Role role);
36 : ~AccessibleRoot() override;
37 :
38 : void setFocusedElement(AccessibleItemPtr e, bool voiceStaffInfoChange = true);
39 : AccessibleItemWeakPtr focusedElement() const;
40 :
41 : void notifyAboutFocusedElementNameChanged();
42 :
43 : void setMapToScreenFunc(const AccessibleMapToScreenFunc& func);
44 : RectF toScreenRect(const RectF& rect, bool* ok = nullptr) const;
45 :
46 : const muse::accessibility::IAccessible* accessibleParent() const override;
47 : muse::accessibility::IAccessible::Role accessibleRole() const override;
48 : QString accessibleName() const override;
49 :
50 : bool enabled() const;
51 : void setEnabled(bool enabled);
52 :
53 : QString staffInfo() const;
54 : void updateStaffInfo(const AccessibleItemWeakPtr newAccessibleItem, const AccessibleItemWeakPtr oldAccessibleItem,
55 : bool voiceStaffInfoChange = true);
56 :
57 : bool isRangeSelection() const;
58 : QString rangeSelectionInfo();
59 :
60 : private:
61 :
62 : bool m_enabled = false;
63 :
64 : AccessibleItemWeakPtr m_focusedElement;
65 :
66 : AccessibleMapToScreenFunc m_accessibleMapToScreenFunc;
67 :
68 : QString m_staffInfo;
69 : };
70 : }
71 :
72 : #endif // MU_ENGRAVING_ACCESSIBLEROOT_H
|