decoratedclient.h 3.32 KB
Newer Older
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
1
2
3
/*
    KWin - the KDE window manager
    This file is part of the KDE project.
4

Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
5
    SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
6

Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
7
8
    SPDX-License-Identifier: GPL-2.0-or-later
*/
9
10
#ifndef KWIN_DECORATED_CLIENT_H
#define KWIN_DECORATED_CLIENT_H
11
#include "options.h"
12
13
14

#include <KDecoration2/Private/DecoratedClientPrivate>

15
#include <QDeadlineTimer>
16
#include <QObject>
17
#include <QTimer>
18
19
20
21

namespace KWin
{

22
class AbstractClient;
23
24
25
26
27
28

namespace Decoration
{

class Renderer;

Kai Uwe Broulik's avatar
Kai Uwe Broulik committed
29
class DecoratedClientImpl : public QObject, public KDecoration2::ApplicationMenuEnabledDecoratedClientPrivate
30
31
32
{
    Q_OBJECT
public:
33
    explicit DecoratedClientImpl(AbstractClient *client, KDecoration2::DecoratedClient *decoratedClient, KDecoration2::Decoration *decoration);
34
    ~DecoratedClientImpl() override;
35
36
37
38
39
40
41
42
43
    QString caption() const override;
    WId decorationId() const override;
    int desktop() const override;
    int height() const override;
    QIcon icon() const override;
    bool isActive() const override;
    bool isCloseable() const override;
    bool isKeepAbove() const override;
    bool isKeepBelow() const override;
44
    bool isMaximizeable() const override;
45
46
47
    bool isMaximized() const override;
    bool isMaximizedHorizontally() const override;
    bool isMaximizedVertically() const override;
48
    bool isMinimizeable() const override;
49
    bool isModal() const override;
50
    bool isMoveable() const override;
51
    bool isOnAllDesktops() const override;
52
    bool isResizeable() const override;
53
54
55
    bool isShadeable() const override;
    bool isShaded() const override;
    QPalette palette() const override;
56
    QColor color(KDecoration2::ColorGroup group, KDecoration2::ColorRole role) const override;
57
    bool providesContextHelp() const override;
58
    QSize size() const override;
59
60
61
    int width() const override;
    WId windowId() const override;

62
    Qt::Edges adjacentScreenEdges() const override;
63

Kai Uwe Broulik's avatar
Kai Uwe Broulik committed
64
65
66
    bool hasApplicationMenu() const override;
    bool isApplicationMenuActive() const override;

Martin Flöser's avatar
Martin Flöser committed
67
68
    void requestShowToolTip(const QString &text) override;
    void requestHideToolTip() override;
69
70
    void requestClose() override;
    void requestContextHelp() override;
71
    void requestToggleMaximization(Qt::MouseButtons buttons) override;
72
    void requestMinimize() override;
Xaver Hugl's avatar
Xaver Hugl committed
73
    void requestShowWindowMenu(const QRect &rect) override;
Kai Uwe Broulik's avatar
Kai Uwe Broulik committed
74
    void requestShowApplicationMenu(const QRect &rect, int actionId) override;
75
76
77
78
79
    void requestToggleKeepAbove() override;
    void requestToggleKeepBelow() override;
    void requestToggleOnAllDesktops() override;
    void requestToggleShade() override;

80
    void showApplicationMenu(int actionId) override;
Kai Uwe Broulik's avatar
Kai Uwe Broulik committed
81

82
    AbstractClient *client() {
83
84
85
86
87
88
89
90
91
        return m_client;
    }
    Renderer *renderer() {
        return m_renderer;
    }
    KDecoration2::DecoratedClient *decoratedClient() {
        return KDecoration2::DecoratedClientPrivate::client();
    }

92
93
    void signalShadeChange();

94
95
96
private Q_SLOTS:
    void delayedRequestToggleMaximization(Options::WindowOperation operation);

97
98
private:
    void createRenderer();
99
    void destroyRenderer();
100
    AbstractClient *m_client;
101
    QSize m_clientSize;
102
    Renderer *m_renderer;
103
    QMetaObject::Connection m_compositorToggledConnection;
104
105
106
107

    QString m_toolTipText;
    QTimer m_toolTipWakeUp;
    QDeadlineTimer m_toolTipFallAsleep;
108
    bool m_toolTipShowing = false;
109
110
111
112
113
114
};

}
}

#endif