File indexing completed on 2024-05-19 13:17:43

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #pragma once
0010 #include "options.h"
0011 
0012 #include <KDecoration2/Private/DecoratedClientPrivate>
0013 
0014 #include <QDeadlineTimer>
0015 #include <QObject>
0016 #include <QTimer>
0017 
0018 namespace KWin
0019 {
0020 
0021 class Window;
0022 
0023 namespace Decoration
0024 {
0025 
0026 class DecoratedClientImpl : public QObject, public KDecoration2::ApplicationMenuEnabledDecoratedClientPrivate
0027 {
0028     Q_OBJECT
0029 public:
0030     explicit DecoratedClientImpl(Window *window, KDecoration2::DecoratedClient *decoratedClient, KDecoration2::Decoration *decoration);
0031     ~DecoratedClientImpl() override;
0032     QString caption() const override;
0033     WId decorationId() const override;
0034     int desktop() const override;
0035     int height() const override;
0036     QIcon icon() const override;
0037     bool isActive() const override;
0038     bool isCloseable() const override;
0039     bool isKeepAbove() const override;
0040     bool isKeepBelow() const override;
0041     bool isMaximizeable() const override;
0042     bool isMaximized() const override;
0043     bool isMaximizedHorizontally() const override;
0044     bool isMaximizedVertically() const override;
0045     bool isMinimizeable() const override;
0046     bool isModal() const override;
0047     bool isMoveable() const override;
0048     bool isOnAllDesktops() const override;
0049     bool isResizeable() const override;
0050     bool isShadeable() const override;
0051     bool isShaded() const override;
0052     QPalette palette() const override;
0053     QColor color(KDecoration2::ColorGroup group, KDecoration2::ColorRole role) const override;
0054     bool providesContextHelp() const override;
0055     QSize size() const override;
0056     int width() const override;
0057     QString windowClass() const override;
0058     WId windowId() const override;
0059 
0060     Qt::Edges adjacentScreenEdges() const override;
0061 
0062     bool hasApplicationMenu() const override;
0063     bool isApplicationMenuActive() const override;
0064 
0065     void requestShowToolTip(const QString &text) override;
0066     void requestHideToolTip() override;
0067     void requestClose() override;
0068     void requestContextHelp() override;
0069     void requestToggleMaximization(Qt::MouseButtons buttons) override;
0070     void requestMinimize() override;
0071     void requestShowWindowMenu(const QRect &rect) override;
0072     void requestShowApplicationMenu(const QRect &rect, int actionId) override;
0073     void requestToggleKeepAbove() override;
0074     void requestToggleKeepBelow() override;
0075     void requestToggleOnAllDesktops() override;
0076     void requestToggleShade() override;
0077 
0078     void showApplicationMenu(int actionId) override;
0079 
0080     Window *window()
0081     {
0082         return m_window;
0083     }
0084     KDecoration2::DecoratedClient *decoratedClient()
0085     {
0086         return KDecoration2::DecoratedClientPrivate::client();
0087     }
0088 
0089     void signalShadeChange();
0090 
0091 private Q_SLOTS:
0092     void delayedRequestToggleMaximization(Options::WindowOperation operation);
0093 
0094 private:
0095     Window *m_window;
0096     QSize m_clientSize;
0097 
0098     QString m_toolTipText;
0099     QTimer m_toolTipWakeUp;
0100     QDeadlineTimer m_toolTipFallAsleep;
0101     bool m_toolTipShowing = false;
0102 };
0103 
0104 }
0105 }