aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/coreplugin/windowsupport.h
blob: 015a670b8b0e5c97708346f4e983d86d8dfe0926 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright (C) 2016 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 "icontext.h"

#include <QObject>

QT_BEGIN_NAMESPACE
class QAction;
class QMenu;
class QWidget;
QT_END_NAMESPACE

namespace Core {
namespace Internal {

class WindowList
{
public:
    ~WindowList();

    void addWindow(QWidget *window);
    void removeWindow(QWidget *window);
    void setActiveWindow(QWidget *window);
    void setWindowVisible(QWidget *window, bool visible);

private:
    void activateWindow(QAction *action);
    void updateTitle(QWidget *window);

    QMenu *m_dockMenu = nullptr;
    QList<QWidget *> m_windows;
    QList<QAction *> m_windowActions;
    QList<Utils::Id> m_windowActionIds;
};

class WindowSupport : public QObject
{
    Q_OBJECT
public:
    WindowSupport(QWidget *window, const Context &context);
    ~WindowSupport() override;

    void setCloseActionEnabled(bool enabled);

protected:
    bool eventFilter(QObject *obj, QEvent *event) override;

private:
    void toggleFullScreen();
    void updateFullScreenAction();

    QWidget *m_window;
    IContext *m_contextObject;
    QAction *m_minimizeAction;
    QAction *m_zoomAction;
    QAction *m_closeAction;
    QAction *m_toggleFullScreenAction;
    Qt::WindowStates m_previousWindowState;
    bool m_shutdown = false;
};

} // Internal
} // Core