aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/touchbar/touchbar_mac_p.h
blob: 5ea5f33c5ee956119522fac4b41d1d21d37c3d10 (plain)
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
// Copyright (C) 2018 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include <QAction>
#include <QByteArray>

#include <functional>
#include <vector>

namespace Utils {
namespace Internal {
class TouchBarPrivate;
} // Internal
} // Utils

#import <AppKit/NSTouchBar.h>

@interface TouchBarDelegate : NSObject <NSTouchBarDelegate>
@property (atomic) Utils::Internal::TouchBarPrivate *parent;
@property (retain, atomic) NSString *closeButtonIdentifier;

- (id)initWithParent:(Utils::Internal::TouchBarPrivate *)parent;
- (NSTouchBar *)makeTouchBar;
@end

namespace Utils {
namespace Internal {

struct TouchBarItem
{
    QByteArray id;
    QMetaObject::Connection updateConnection;
    QAction *action = nullptr;
    TouchBarPrivate *touchBar = nullptr;
};

class TouchBarPrivate
{
public:
    QByteArray m_id;
    QAction m_action;
    std::vector<TouchBarItem> m_items;
    std::function<void()> m_invalidate;
    TouchBarDelegate *m_delegate;
    bool m_isSubBar = false;
};

} // Internal
} // Utils