File indexing completed on 2024-11-10 04:56:47
0001 /* 0002 SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 #pragma once 0007 0008 #include "../../../decorations/decorationpalette.h" 0009 0010 #include <KDecoration2/Private/DecoratedClientPrivate> 0011 #include <QObject> 0012 #include <QPalette> 0013 0014 class QAbstractItemModel; 0015 0016 namespace KDecoration2 0017 { 0018 namespace Preview 0019 { 0020 class PreviewClient : public QObject, public ApplicationMenuEnabledDecoratedClientPrivate 0021 { 0022 Q_OBJECT 0023 Q_PROPERTY(KDecoration2::Decoration *decoration READ decoration CONSTANT) 0024 Q_PROPERTY(QString caption READ caption WRITE setCaption NOTIFY captionChanged) 0025 Q_PROPERTY(QIcon icon READ icon WRITE setIcon NOTIFY iconChanged) 0026 Q_PROPERTY(QString iconName READ iconName WRITE setIconName NOTIFY iconNameChanged) 0027 Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged) 0028 Q_PROPERTY(bool closeable READ isCloseable WRITE setCloseable NOTIFY closeableChanged) 0029 Q_PROPERTY(bool keepAbove READ isKeepAbove WRITE setKeepAbove NOTIFY keepAboveChanged) 0030 Q_PROPERTY(bool keepBelow READ isKeepBelow WRITE setKeepBelow NOTIFY keepBelowChanged) 0031 Q_PROPERTY(bool maximizable READ isMaximizeable WRITE setMaximizable NOTIFY maximizableChanged) 0032 Q_PROPERTY(bool maximized READ isMaximized NOTIFY maximizedChanged) 0033 Q_PROPERTY(bool maximizedVertically READ isMaximizedVertically WRITE setMaximizedVertically NOTIFY maximizedVerticallyChanged) 0034 Q_PROPERTY(bool maximizedHorizontally READ isMaximizedHorizontally WRITE setMaximizedHorizontally NOTIFY maximizedHorizontallyChanged) 0035 Q_PROPERTY(bool minimizable READ isMinimizeable WRITE setMinimizable NOTIFY minimizableChanged) 0036 Q_PROPERTY(bool modal READ isModal WRITE setModal NOTIFY modalChanged) 0037 Q_PROPERTY(bool movable READ isMoveable WRITE setMovable NOTIFY movableChanged) 0038 Q_PROPERTY(bool onAllDesktops READ isOnAllDesktops NOTIFY onAllDesktopsChanged) 0039 Q_PROPERTY(bool resizable READ isResizeable WRITE setResizable NOTIFY resizableChanged) 0040 Q_PROPERTY(bool shadeable READ isShadeable WRITE setShadeable NOTIFY shadeableChanged) 0041 Q_PROPERTY(bool shaded READ isShaded WRITE setShaded NOTIFY shadedChanged) 0042 Q_PROPERTY(bool providesContextHelp READ providesContextHelp WRITE setProvidesContextHelp NOTIFY providesContextHelpChanged) 0043 Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged) 0044 Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged) 0045 Q_PROPERTY(bool bordersTopEdge READ bordersTopEdge WRITE setBordersTopEdge NOTIFY bordersTopEdgeChanged) 0046 Q_PROPERTY(bool bordersLeftEdge READ bordersLeftEdge WRITE setBordersLeftEdge NOTIFY bordersLeftEdgeChanged) 0047 Q_PROPERTY(bool bordersRightEdge READ bordersRightEdge WRITE setBordersRightEdge NOTIFY bordersRightEdgeChanged) 0048 Q_PROPERTY(bool bordersBottomEdge READ bordersBottomEdge WRITE setBordersBottomEdge NOTIFY bordersBottomEdgeChanged) 0049 public: 0050 explicit PreviewClient(DecoratedClient *client, Decoration *decoration); 0051 ~PreviewClient() override; 0052 0053 QString caption() const override; 0054 WId decorationId() const override; 0055 WId windowId() const override; 0056 QIcon icon() const override; 0057 bool isActive() const override; 0058 bool isCloseable() const override; 0059 bool isKeepAbove() const override; 0060 bool isKeepBelow() const override; 0061 bool isMaximizeable() const override; 0062 bool isMaximized() const override; 0063 bool isMaximizedVertically() const override; 0064 bool isMaximizedHorizontally() const override; 0065 bool isMinimizeable() const override; 0066 bool isModal() const override; 0067 bool isMoveable() const override; 0068 bool isOnAllDesktops() const override; 0069 bool isResizeable() const override; 0070 bool isShadeable() const override; 0071 bool isShaded() const override; 0072 bool providesContextHelp() const override; 0073 0074 int width() const override; 0075 int height() const override; 0076 QSize size() const override; 0077 QPalette palette() const override; 0078 QColor color(ColorGroup group, ColorRole role) const override; 0079 Qt::Edges adjacentScreenEdges() const override; 0080 QString windowClass() const override; 0081 0082 bool hasApplicationMenu() const override; 0083 bool isApplicationMenuActive() const override; 0084 0085 void requestShowToolTip(const QString &text) override; 0086 void requestHideToolTip() override; 0087 void requestClose() override; 0088 void requestContextHelp() override; 0089 void requestToggleMaximization(Qt::MouseButtons buttons) override; 0090 void requestMinimize() override; 0091 void requestToggleKeepAbove() override; 0092 void requestToggleKeepBelow() override; 0093 void requestToggleShade() override; 0094 void requestShowWindowMenu(const QRect &rect) override; 0095 void requestShowApplicationMenu(const QRect &rect, int actionId) override; 0096 void requestToggleOnAllDesktops() override; 0097 0098 void showApplicationMenu(int actionId) override; 0099 0100 void setCaption(const QString &caption); 0101 void setActive(bool active); 0102 void setCloseable(bool closeable); 0103 void setMaximizable(bool maximizable); 0104 void setKeepBelow(bool keepBelow); 0105 void setKeepAbove(bool keepAbove); 0106 void setMaximizedHorizontally(bool maximized); 0107 void setMaximizedVertically(bool maximized); 0108 void setMinimizable(bool minimizable); 0109 void setModal(bool modal); 0110 void setMovable(bool movable); 0111 void setResizable(bool resizable); 0112 void setShadeable(bool shadeable); 0113 void setShaded(bool shaded); 0114 void setProvidesContextHelp(bool contextHelp); 0115 0116 void setWidth(int width); 0117 void setHeight(int height); 0118 0119 QString iconName() const; 0120 void setIconName(const QString &icon); 0121 void setIcon(const QIcon &icon); 0122 0123 bool bordersTopEdge() const; 0124 bool bordersLeftEdge() const; 0125 bool bordersRightEdge() const; 0126 bool bordersBottomEdge() const; 0127 0128 void setBordersTopEdge(bool enabled); 0129 void setBordersLeftEdge(bool enabled); 0130 void setBordersRightEdge(bool enabled); 0131 void setBordersBottomEdge(bool enabled); 0132 0133 Q_SIGNALS: 0134 void captionChanged(const QString &); 0135 void iconChanged(const QIcon &); 0136 void iconNameChanged(const QString &); 0137 void activeChanged(bool); 0138 void closeableChanged(bool); 0139 void keepAboveChanged(bool); 0140 void keepBelowChanged(bool); 0141 void maximizableChanged(bool); 0142 void maximizedChanged(bool); 0143 void maximizedVerticallyChanged(bool); 0144 void maximizedHorizontallyChanged(bool); 0145 void minimizableChanged(bool); 0146 void modalChanged(bool); 0147 void movableChanged(bool); 0148 void onAllDesktopsChanged(bool); 0149 void resizableChanged(bool); 0150 void shadeableChanged(bool); 0151 void shadedChanged(bool); 0152 void providesContextHelpChanged(bool); 0153 void widthChanged(int); 0154 void heightChanged(int); 0155 void paletteChanged(const QPalette &); 0156 void bordersTopEdgeChanged(bool); 0157 void bordersLeftEdgeChanged(bool); 0158 void bordersRightEdgeChanged(bool); 0159 void bordersBottomEdgeChanged(bool); 0160 0161 void showWindowMenuRequested(); 0162 void showApplicationMenuRequested(); 0163 void minimizeRequested(); 0164 void closeRequested(); 0165 0166 private: 0167 QString m_caption; 0168 QIcon m_icon; 0169 QString m_iconName; 0170 KWin::Decoration::DecorationPalette m_palette; 0171 bool m_active; 0172 bool m_closeable; 0173 bool m_keepBelow; 0174 bool m_keepAbove; 0175 bool m_maximizable; 0176 bool m_maximizedHorizontally; 0177 bool m_maximizedVertically; 0178 bool m_minimizable; 0179 bool m_modal; 0180 bool m_movable; 0181 bool m_resizable; 0182 bool m_shadeable; 0183 bool m_shaded; 0184 bool m_providesContextHelp; 0185 bool m_onAllDesktops; 0186 int m_width; 0187 int m_height; 0188 bool m_bordersTopEdge; 0189 bool m_bordersLeftEdge; 0190 bool m_bordersRightEdge; 0191 bool m_bordersBottomEdge; 0192 }; 0193 0194 } // namespace Preview 0195 } // namespace KDecoration2