diff --git a/autotests/mockclient.cpp b/autotests/mockclient.cpp index 4300a24..03565cd 100644 --- a/autotests/mockclient.cpp +++ b/autotests/mockclient.cpp @@ -1,300 +1,305 @@ /* * Copyright 2014 Martin Gräßlin * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) version 3, or any * later version accepted by the membership of KDE e.V. (or its * successor approved by the membership of KDE e.V.), which shall * act as a proxy defined in Section 6 of version 3 of the license. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #include "mockclient.h" #include #include MockClient::MockClient(KDecoration2::DecoratedClient *client, KDecoration2::Decoration *decoration) : QObject() , ApplicationMenuEnabledDecoratedClientPrivate(client, decoration) { } Qt::Edges MockClient::adjacentScreenEdges() const { return Qt::Edges(); } QString MockClient::caption() const { return QString(); } WId MockClient::decorationId() const { return 0; } int MockClient::desktop() const { return 1; } int MockClient::height() const { return m_height; } QIcon MockClient::icon() const { return QIcon(); } bool MockClient::isActive() const { return false; } bool MockClient::isCloseable() const { return m_closeable; } bool MockClient::isKeepAbove() const { return m_keepAbove; } bool MockClient::isKeepBelow() const { return m_keepBelow; } bool MockClient::isMaximizeable() const { return m_maximizable; } bool MockClient::isMaximized() const { return isMaximizedHorizontally() && isMaximizedVertically(); } bool MockClient::isMaximizedHorizontally() const { return m_maximizedHorizontally; } bool MockClient::isMaximizedVertically() const { return m_maximizedVertically; } bool MockClient::isMinimizeable() const { return m_minimizable; } bool MockClient::isModal() const { return false; } bool MockClient::isMoveable() const { return false; } bool MockClient::isOnAllDesktops() const { return m_onAllDesktops; } bool MockClient::isResizeable() const { return false; } bool MockClient::isShadeable() const { return m_shadeable; } bool MockClient::isShaded() const { return m_shaded; } QPalette MockClient::palette() const { return QPalette(); } bool MockClient::hasApplicationMenu() const { return true; } bool MockClient::isApplicationMenuActive() const { return false; } bool MockClient::providesContextHelp() const { return m_contextHelp; } void MockClient::requestClose() { emit closeRequested(); } void MockClient::requestContextHelp() { emit quickHelpRequested(); } void MockClient::requestToggleMaximization(Qt::MouseButtons buttons) { bool maximizedHorizontally = m_maximizedHorizontally; bool maximizedVertically = m_maximizedVertically; if (buttons.testFlag(Qt::LeftButton)) { maximizedHorizontally = !m_maximizedHorizontally; maximizedVertically = !m_maximizedVertically; } if (buttons.testFlag(Qt::MiddleButton)) { maximizedHorizontally = !m_maximizedHorizontally; } if (buttons.testFlag(Qt::RightButton)) { maximizedVertically = !m_maximizedVertically; } const bool wasMaximized = isMaximized(); if (m_maximizedHorizontally != maximizedHorizontally) { m_maximizedHorizontally = maximizedHorizontally; emit client()->maximizedHorizontallyChanged(m_maximizedHorizontally); } if (m_maximizedVertically != maximizedVertically) { m_maximizedVertically = maximizedVertically; emit client()->maximizedVerticallyChanged(m_maximizedVertically); } if (wasMaximized != isMaximized()) { emit client()->maximizedChanged(isMaximized()); } } void MockClient::requestMinimize() { emit minimizeRequested(); } void MockClient::requestShowWindowMenu() { emit menuRequested(); } void MockClient::requestShowApplicationMenu(const QRect &rect, int actionId) { Q_UNUSED(rect); Q_UNUSED(actionId); emit applicationMenuRequested(); // FIXME TODO pass geometry } void MockClient::requestToggleKeepAbove() { m_keepAbove = !m_keepAbove; emit client()->keepAboveChanged(m_keepAbove); } void MockClient::requestToggleKeepBelow() { m_keepBelow = !m_keepBelow; emit client()->keepBelowChanged(m_keepBelow); } void MockClient::requestToggleOnAllDesktops() { m_onAllDesktops = !m_onAllDesktops; emit client()->onAllDesktopsChanged(m_onAllDesktops); } void MockClient::requestToggleShade() { m_shaded = !m_shaded; emit client()->shadedChanged(m_shaded); } void MockClient::requestShowToolTip(const QString &text) { Q_UNUSED(text); } void MockClient::requestHideToolTip() { } +QSize MockClient::size() const +{ + return QSize(m_width, m_height); +} + int MockClient::width() const { return m_width; } WId MockClient::windowId() const { return 0; } void MockClient::setCloseable(bool set) { m_closeable = set; emit client()->closeableChanged(set); } void MockClient::setMinimizable(bool set) { m_minimizable = set; emit client()->minimizeableChanged(set); } void MockClient::setProvidesContextHelp(bool set) { m_contextHelp = set; emit client()->providesContextHelpChanged(set); } void MockClient::setShadeable(bool set) { m_shadeable = set; emit client()->shadeableChanged(set); } void MockClient::setMaximizable(bool set) { m_maximizable = set; emit client()->maximizeableChanged(set); } void MockClient::setWidth(int w) { m_width = w; emit client()->widthChanged(w); } void MockClient::setHeight(int h) { m_height = h; emit client()->heightChanged(h); } void MockClient::showApplicationMenu(int actionId) { Q_UNUSED(actionId) } diff --git a/autotests/mockclient.h b/autotests/mockclient.h index c9fc5b0..2182b87 100644 --- a/autotests/mockclient.h +++ b/autotests/mockclient.h @@ -1,107 +1,108 @@ /* * Copyright 2014 Martin Gräßlin * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) version 3, or any * later version accepted by the membership of KDE e.V. (or its * successor approved by the membership of KDE e.V.), which shall * act as a proxy defined in Section 6 of version 3 of the license. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef MOCK_CLIENT_H #define MOCK_CLIENT_H #include "../src/private/decoratedclientprivate.h" #include class MockClient : public QObject, public KDecoration2::ApplicationMenuEnabledDecoratedClientPrivate { Q_OBJECT public: explicit MockClient(KDecoration2::DecoratedClient *client, KDecoration2::Decoration *decoration); Qt::Edges adjacentScreenEdges() const override; 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; bool isMaximizeable() const override; bool isMaximized() const override; bool isMaximizedHorizontally() const override; bool isMaximizedVertically() const override; bool isMinimizeable() const override; bool isModal() const override; bool isMoveable() const override; bool isOnAllDesktops() const override; bool isResizeable() const override; bool isShadeable() const override; bool isShaded() const override; QPalette palette() const override; bool hasApplicationMenu() const override; bool isApplicationMenuActive() const override; bool providesContextHelp() const override; void requestClose() override; void requestContextHelp() override; void requestToggleMaximization(Qt::MouseButtons buttons) override; void requestMinimize() override; void requestShowWindowMenu() override; void requestShowApplicationMenu(const QRect &rect, int actionId) override; void requestToggleKeepAbove() override; void requestToggleKeepBelow() override; void requestToggleOnAllDesktops() override; void requestToggleShade() override; void requestShowToolTip(const QString &text) override; void requestHideToolTip() override; + QSize size() const override; int width() const override; WId windowId() const override; void showApplicationMenu(int actionId) override; void setCloseable(bool set); void setMinimizable(bool set); void setProvidesContextHelp(bool set); void setShadeable(bool set); void setMaximizable(bool set); void setWidth(int w); void setHeight(int h); Q_SIGNALS: void closeRequested(); void minimizeRequested(); void quickHelpRequested(); void menuRequested(); void applicationMenuRequested(); private: bool m_closeable = false; bool m_minimizable = false; bool m_contextHelp = false; bool m_keepAbove = false; bool m_keepBelow = false; bool m_shadeable = false; bool m_shaded = false; bool m_maximizable = false; bool m_maximizedVertically = false; bool m_maximizedHorizontally = false; bool m_onAllDesktops = false; int m_width = 0; int m_height = 0; }; #endif diff --git a/src/decoratedclient.cpp b/src/decoratedclient.cpp index 6e11ee7..b4da31e 100644 --- a/src/decoratedclient.cpp +++ b/src/decoratedclient.cpp @@ -1,110 +1,111 @@ /* * Copyright 2014 Martin Gräßlin * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) version 3, or any * later version accepted by the membership of KDE e.V. (or its * successor approved by the membership of KDE e.V.), which shall * act as a proxy defined in Section 6 of version 3 of the license. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #include "decoratedclient.h" #include "private/decoratedclientprivate.h" #include "private/decorationbridge.h" #include "decoration.h" #include namespace KDecoration2 { DecoratedClient::DecoratedClient(Decoration *parent, DecorationBridge *bridge) : QObject() , d(std::move(bridge->createClient(this, parent))) { } DecoratedClient::~DecoratedClient() = default; #define DELEGATE(type, method) \ type DecoratedClient::method() const \ { \ return d->method(); \ } DELEGATE(bool, isActive) DELEGATE(QString, caption) DELEGATE(int, desktop) DELEGATE(bool, isOnAllDesktops) DELEGATE(bool, isShaded) DELEGATE(QIcon, icon) DELEGATE(bool, isMaximized) DELEGATE(bool, isMaximizedHorizontally) DELEGATE(bool, isMaximizedVertically) DELEGATE(bool, isKeepAbove) DELEGATE(bool, isKeepBelow) DELEGATE(bool, isCloseable) DELEGATE(bool, isMaximizeable) DELEGATE(bool, isMinimizeable) DELEGATE(bool, providesContextHelp) DELEGATE(bool, isModal) DELEGATE(bool, isShadeable) DELEGATE(bool, isMoveable) DELEGATE(bool, isResizeable) DELEGATE(WId, windowId) DELEGATE(WId, decorationId) DELEGATE(int, width) DELEGATE(int, height) +DELEGATE(QSize, size) DELEGATE(QPalette, palette) DELEGATE(Qt::Edges, adjacentScreenEdges) #undef DELEGATE bool DecoratedClient::hasApplicationMenu() const { if (const auto *appMenuEnabledPrivate = dynamic_cast(d.get())) { return appMenuEnabledPrivate->hasApplicationMenu(); } return false; } bool DecoratedClient::isApplicationMenuActive() const { if (const auto *appMenuEnabledPrivate = dynamic_cast(d.get())) { return appMenuEnabledPrivate->isApplicationMenuActive(); } return false; } QPointer< Decoration > DecoratedClient::decoration() const { return QPointer(d->decoration()); } QColor DecoratedClient::color(QPalette::ColorGroup group, QPalette::ColorRole role) const { return d->palette().color(group, role); } QColor DecoratedClient::color(ColorGroup group, ColorRole role) const { return d->color(group, role); } void DecoratedClient::showApplicationMenu(int actionId) { if (auto *appMenuEnabledPrivate = dynamic_cast(d.get())) { appMenuEnabledPrivate->showApplicationMenu(actionId); } } } // namespace diff --git a/src/decoratedclient.h b/src/decoratedclient.h index a250052..061de76 100644 --- a/src/decoratedclient.h +++ b/src/decoratedclient.h @@ -1,290 +1,296 @@ /* * Copyright 2014 Martin Gräßlin * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) version 3, or any * later version accepted by the membership of KDE e.V. (or its * successor approved by the membership of KDE e.V.), which shall * act as a proxy defined in Section 6 of version 3 of the license. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef KDECORATION2_DECORATED_CLIENT_H #define KDECORATION2_DECORATED_CLIENT_H #include #include "decorationdefines.h" #include #include #include #include #include #include #include namespace KDecoration2 { class Decoration; class DecorationBridge; class DecoratedClientPrivate; /** * @brief The Client which gets decorated. * * The DecoratedClient provides access to all the properties relevant for decorating the Client. * Each DecoratedClient is bound to one Decoration and each Decoration is bound to this one * DecoratedClient. * * The DecoratedClient only exports properties, it does not provide any means to change the state. * To change state one needs to call the methods on Decoration. This is as the backend might * disallow state changes. Therefore any changes should be bound to the change signals of the * DecoratedClient and not be bound to state changes of input elements (such as a button). */ class KDECORATIONS2_EXPORT DecoratedClient : public QObject { Q_OBJECT /** * The Decoration of this DecoratedClient **/ Q_PROPERTY(KDecoration2::Decoration *decoration READ decoration CONSTANT) /** * Whether the DecoratedClient is active (has focus) or is inactive. **/ Q_PROPERTY(bool active READ isActive NOTIFY activeChanged) /** * The caption of the DecoratedClient. **/ Q_PROPERTY(QString caption READ caption NOTIFY captionChanged) /** * The virtual desktop of the DecoratedClient. The special value @c -1 means on all * desktops. For this prefer using the property onAllDesktops. **/ Q_PROPERTY(int desktop READ desktop NOTIFY desktopChanged) /** * Whether the DecoratedClient is on all desktops or on just one. **/ Q_PROPERTY(bool onAllDesktops READ isOnAllDesktops NOTIFY onAllDesktopsChanged) /** * Whether the DecoratedClient is shaded. Shaded means that the actual content is * not visible, only the Decoration is visible. **/ Q_PROPERTY(bool shaded READ isShaded NOTIFY shadedChanged) /** * The icon of the DecoratedClient. This can be used as the icon for the window menu button. **/ Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged) /** * Whether the DecoratedClient is maximized. A DecoratedClient is maximized if it is both * maximizedHorizontally and maximizedVertically. The Decoration of a maximized DecoratedClient * should only consist of the title bar area. **/ Q_PROPERTY(bool maximized READ isMaximized NOTIFY maximizedChanged) /** * Whether the DecoratedClient is maximized horizontally. A horizontally maximized DecoratedClient * uses the maximal possible width. **/ Q_PROPERTY(bool maximizedHorizontally READ isMaximizedHorizontally NOTIFY maximizedHorizontallyChanged) /** * Whether the DecoratedClient is maximized vertically. A vertically maximized DecoratedClient * uses the maximal possible height. **/ Q_PROPERTY(bool maximizedVertically READ isMaximizedVertically NOTIFY maximizedVerticallyChanged) /** * Whether the DecoratedClient is set to be kept above other DecoratedClients. There can be multiple * DecoratedClients which are set to be kept above. **/ Q_PROPERTY(bool keepAbove READ isKeepAbove NOTIFY keepAboveChanged) /** * Whether the DecoratedClient is set to be kept below other DecoratedClients. There can be multiple * DecoratedClients which are set to be kept below. **/ Q_PROPERTY(bool keepBelow READ isKeepBelow NOTIFY keepBelowChanged) /** * Whether the DecoratedClient can be closed. If this property is @c false a DecorationButton * for closing the DecoratedClient should be disabled. **/ Q_PROPERTY(bool closeable READ isCloseable NOTIFY closeableChanged) /** * Whether the DecoratedClient can be maximized. If this property is @c false a DecorationButton * for maximizing the DecoratedClient should be disabled. **/ Q_PROPERTY(bool maximizeable READ isMaximizeable NOTIFY maximizeableChanged) /** * Whether the DecoratedClient can be minimized. If this property is @c false a DecorationButton * for minimizing the DecoratedClient should be disabled. **/ Q_PROPERTY(bool minimizeable READ isMinimizeable NOTIFY minimizeableChanged) /** * Whether the DecoratedClient provides context help. * The Decoration should only show a context help button if this property is @c true. **/ Q_PROPERTY(bool providesContextHelp READ providesContextHelp NOTIFY providesContextHelpChanged) /** * Whether the DecoratedClient is a modal dialog. **/ Q_PROPERTY(bool modal READ isModal CONSTANT) /** * Whether the DecoratedClient can be shaded. If this property is @c false a DecorationButton * for shading the DecoratedClient should be disabled. **/ Q_PROPERTY(bool shadeable READ isShadeable NOTIFY shadeableChanged) /** * Whether the DecoratedClient can be moved. **/ Q_PROPERTY(bool moveable READ isMoveable NOTIFY moveableChanged) /** * Whether the DecoratedClient can be resized. **/ Q_PROPERTY(bool resizeable READ isResizeable NOTIFY resizeableChanged) /** * The width of the DecoratedClient. **/ Q_PROPERTY(int width READ width NOTIFY widthChanged) /** * The height of the DecoratedClient. **/ Q_PROPERTY(int height READ height NOTIFY heightChanged) + /** + * The size of the DecoratedClient. + **/ + Q_PROPERTY(QSize size READ size NOTIFY sizeChanged) /** * The palette this DecoratedClient uses. The palette might be different for each * DecoratedClient and the Decoration should honor the palette. **/ Q_PROPERTY(QPalette palette READ palette NOTIFY paletteChanged) /** * The Edges which are adjacent to a screen edge. E.g. for a maximized DecoratedClient this * will include all Edges. The Decoration can use this information to hide borders. **/ Q_PROPERTY(Qt::Edges adjacentScreenEdges READ adjacentScreenEdges NOTIFY adjacentScreenEdgesChanged) /** * Whether the DecoratedClient has an application menu * @since 5.9 */ Q_PROPERTY(bool hasApplicationMenu READ hasApplicationMenu NOTIFY hasApplicationMenuChanged) /** * Whether the application menu for this DecoratedClient is currently shown to the user * The Decoration can use this information to highlight the respective button. * @since 5.9 */ Q_PROPERTY(bool applicationMenuActive READ isApplicationMenuActive NOTIFY applicationMenuActiveChanged) // TODO: properties for windowId and decorationId? public: DecoratedClient() = delete; ~DecoratedClient() override; bool isActive() const; QString caption() const; int desktop() const; bool isOnAllDesktops() const; bool isShaded() const; QIcon icon() const; bool isMaximized() const; bool isMaximizedHorizontally() const; bool isMaximizedVertically() const; bool isKeepAbove() const; bool isKeepBelow() const; bool isCloseable() const; bool isMaximizeable() const; bool isMinimizeable() const; bool providesContextHelp() const; bool isModal() const; bool isShadeable() const; bool isMoveable() const; bool isResizeable() const; Qt::Edges adjacentScreenEdges() const; WId windowId() const; WId decorationId() const; int width() const; int height() const; + QSize size() const; QPointer decoration() const; QPalette palette() const; /** * Used to get colors in QPalette. * @param group The color group * @param role The color role * @return palette().color(group, role) * @since 5.3 **/ QColor color(QPalette::ColorGroup group, QPalette::ColorRole role) const; /** * Used to get additional colors that are not in QPalette. * @param group The color group * @param role The color role * @return The color if provided for combination of group and role, otherwise invalid QColor. * @since 5.3 **/ QColor color(ColorGroup group, ColorRole role) const; /** * Whether the DecoratedClient has an application menu * @since 5.9 */ bool hasApplicationMenu() const; /** * Whether the application menu for this DecoratedClient is currently shown to the user * The Decoration can use this information to highlight the respective button. * @since 5.9 */ bool isApplicationMenuActive() const; /** * Request the application menu to be shown to the user * @param actionId The DBus menu ID of the action that should be highlighted, 0 for none. */ void showApplicationMenu(int actionId); Q_SIGNALS: void activeChanged(bool); void captionChanged(QString); void desktopChanged(int); void onAllDesktopsChanged(bool); void shadedChanged(bool); void iconChanged(QIcon); void maximizedChanged(bool); void maximizedHorizontallyChanged(bool); void maximizedVerticallyChanged(bool); void keepAboveChanged(bool); void keepBelowChanged(bool); void closeableChanged(bool); void maximizeableChanged(bool); void minimizeableChanged(bool); void providesContextHelpChanged(bool); void shadeableChanged(bool); void moveableChanged(bool); void resizeableChanged(bool); void widthChanged(int); void heightChanged(int); + void sizeChanged(const QSize &size); void paletteChanged(const QPalette &palette); void adjacentScreenEdgesChanged(Qt::Edges edges); void hasApplicationMenuChanged(bool); void applicationMenuActiveChanged(bool); private: friend class Decoration; DecoratedClient(Decoration *parent, DecorationBridge *bridge); const std::unique_ptr d; }; } // namespace #endif diff --git a/src/private/CMakeLists.txt b/src/private/CMakeLists.txt index 9e6e590..2daa18e 100644 --- a/src/private/CMakeLists.txt +++ b/src/private/CMakeLists.txt @@ -1,55 +1,55 @@ set(libkdecoration2Private_SRCS decoratedclientprivate.cpp decorationbridge.cpp decorationsettingsprivate.cpp ) add_library(kdecorations2private SHARED ${libkdecoration2Private_SRCS}) generate_export_header( kdecorations2private BASE_NAME KDECORATIONS_PRIVATE EXPORT_FILE_NAME kdecoration2/private/kdecoration2_private_export.h ) add_library(KDecoration2::KDecorationPrivate ALIAS kdecorations2private) target_link_libraries(kdecorations2private PUBLIC Qt5::Core Qt5::Gui ) target_include_directories(kdecorations2private INTERFACE "$" ) set_target_properties(kdecorations2private PROPERTIES VERSION ${KDECORATION2_VERSION_STRING} - SOVERSION 6 + SOVERSION 7 EXPORT_NAME KDecoration2Private ) ecm_generate_headers(KDecoration2Private_CamelCase_HEADERS HEADER_NAMES DecoratedClientPrivate DecorationBridge DecorationSettingsPrivate PREFIX KDecoration2/Private REQUIRED_HEADERS KDecoration2Private_HEADERS ) install(FILES ${KDecoration2Private_CamelCase_HEADERS} DESTINATION ${KDECORATION2_INCLUDEDIR}/KDecoration2/Private COMPONENT Devel) install(TARGETS kdecorations2private EXPORT KDecoration2Targets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/kdecoration2/private/kdecoration2_private_export.h ${KDecoration2Private_HEADERS} DESTINATION ${KDECORATION2_INCLUDEDIR}/kdecoration2/private COMPONENT Devel ) diff --git a/src/private/decoratedclientprivate.h b/src/private/decoratedclientprivate.h index 645fb7b..5b813c0 100644 --- a/src/private/decoratedclientprivate.h +++ b/src/private/decoratedclientprivate.h @@ -1,122 +1,123 @@ /* * Copyright 2014 Martin Gräßlin * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) version 3, or any * later version accepted by the membership of KDE e.V. (or its * successor approved by the membership of KDE e.V.), which shall * act as a proxy defined in Section 6 of version 3 of the license. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef KDECORATION2_DECORATED_CLIENT_PRIVATE_H #define KDECORATION2_DECORATED_CLIENT_PRIVATE_H #include #include "../decorationdefines.h" #include #include // // W A R N I N G // ------------- // // This file is not part of the KDecoration2 API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // namespace KDecoration2 { class Decoration; class DecoratedClient; class KDECORATIONS_PRIVATE_EXPORT DecoratedClientPrivate { public: virtual ~DecoratedClientPrivate(); virtual bool isActive() const = 0; virtual QString caption() const = 0; virtual int desktop() const = 0; virtual bool isOnAllDesktops() const = 0; virtual bool isShaded() const = 0; virtual QIcon icon() const = 0; virtual bool isMaximized() const = 0; virtual bool isMaximizedHorizontally() const = 0; virtual bool isMaximizedVertically() const = 0; virtual bool isKeepAbove() const = 0; virtual bool isKeepBelow() const = 0; virtual bool isCloseable() const = 0; virtual bool isMaximizeable() const = 0; virtual bool isMinimizeable() const = 0; virtual bool providesContextHelp() const = 0; virtual bool isModal() const = 0; virtual bool isShadeable() const = 0; virtual bool isMoveable() const = 0; virtual bool isResizeable() const = 0; virtual WId windowId() const = 0; virtual WId decorationId() const = 0; virtual int width() const = 0; virtual int height() const = 0; + virtual QSize size() const = 0; virtual QPalette palette() const = 0; virtual Qt::Edges adjacentScreenEdges() const = 0; virtual void requestShowToolTip(const QString &text) = 0; virtual void requestHideToolTip() = 0; virtual void requestClose() = 0; virtual void requestToggleMaximization(Qt::MouseButtons buttons) = 0; virtual void requestMinimize() = 0; virtual void requestContextHelp() = 0; virtual void requestToggleOnAllDesktops() = 0; virtual void requestToggleShade() = 0; virtual void requestToggleKeepAbove() = 0; virtual void requestToggleKeepBelow() = 0; virtual void requestShowWindowMenu() = 0; Decoration *decoration(); Decoration *decoration() const; virtual QColor color(ColorGroup group, ColorRole role) const; protected: explicit DecoratedClientPrivate(DecoratedClient *client, Decoration *decoration); DecoratedClient *client(); private: class Private; const QScopedPointer d; }; class KDECORATIONS_PRIVATE_EXPORT ApplicationMenuEnabledDecoratedClientPrivate : public DecoratedClientPrivate { public: ~ApplicationMenuEnabledDecoratedClientPrivate() override; virtual bool hasApplicationMenu() const = 0; virtual bool isApplicationMenuActive() const = 0; virtual void showApplicationMenu(int actionId) = 0; virtual void requestShowApplicationMenu(const QRect &rect, int actionId) = 0; protected: explicit ApplicationMenuEnabledDecoratedClientPrivate(DecoratedClient *client, Decoration *decoration); }; } // namespace #endif