File indexing completed on 2024-06-16 05:05:22

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 height() const override;
0035     QIcon icon() const override;
0036     bool isActive() const override;
0037     bool isCloseable() const override;
0038     bool isKeepAbove() const override;
0039     bool isKeepBelow() const override;
0040     bool isMaximizeable() const override;
0041     bool isMaximized() const override;
0042     bool isMaximizedHorizontally() const override;
0043     bool isMaximizedVertically() const override;
0044     bool isMinimizeable() const override;
0045     bool isModal() const override;
0046     bool isMoveable() const override;
0047     bool isOnAllDesktops() const override;
0048     bool isResizeable() const override;
0049     bool isShadeable() const override;
0050     bool isShaded() const override;
0051     QPalette palette() const override;
0052     QColor color(KDecoration2::ColorGroup group, KDecoration2::ColorRole role) const override;
0053     bool providesContextHelp() const override;
0054     QSize size() const override;
0055     int width() const override;
0056     QString windowClass() const override;
0057     WId windowId() const override;
0058 
0059     Qt::Edges adjacentScreenEdges() const override;
0060 
0061     bool hasApplicationMenu() const override;
0062     bool isApplicationMenuActive() const override;
0063 
0064     void requestShowToolTip(const QString &text) override;
0065     void requestHideToolTip() override;
0066     void requestClose() override;
0067     void requestContextHelp() override;
0068     void requestToggleMaximization(Qt::MouseButtons buttons) override;
0069     void requestMinimize() override;
0070     void requestShowWindowMenu(const QRect &rect) override;
0071     void requestShowApplicationMenu(const QRect &rect, int actionId) override;
0072     void requestToggleKeepAbove() override;
0073     void requestToggleKeepBelow() override;
0074     void requestToggleOnAllDesktops() override;
0075     void requestToggleShade() override;
0076 
0077     void showApplicationMenu(int actionId) override;
0078 
0079     Window *window()
0080     {
0081         return m_window;
0082     }
0083     KDecoration2::DecoratedClient *decoratedClient()
0084     {
0085         return KDecoration2::DecoratedClientPrivate::client();
0086     }
0087 
0088     void signalShadeChange();
0089 
0090 private Q_SLOTS:
0091     void delayedRequestToggleMaximization(Options::WindowOperation operation);
0092 
0093 private:
0094     Window *m_window;
0095     QSize m_clientSize;
0096 
0097     QString m_toolTipText;
0098     QTimer m_toolTipWakeUp;
0099     QDeadlineTimer m_toolTipFallAsleep;
0100     bool m_toolTipShowing = false;
0101 };
0102 
0103 }
0104 }