File indexing completed on 2024-04-28 16:48:39

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2011 Lionel Chauvin <megabigbug@yahoo.fr>
0006     SPDX-FileCopyrightText: 2011, 2012 Cédric Bellegarde <gnumdk@gmail.com>
0007     SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
0008 
0009     SPDX-License-Identifier: GPL-2.0-or-later
0010 */
0011 #pragma once
0012 // KWin
0013 #include <kwinglobals.h>
0014 // Qt
0015 #include <QObject>
0016 // xcb
0017 #include <xcb/xcb.h>
0018 
0019 class QPoint;
0020 class OrgKdeKappmenuInterface;
0021 class QDBusObjectPath;
0022 class QDBusServiceWatcher;
0023 
0024 namespace KWin
0025 {
0026 
0027 class Window;
0028 
0029 class ApplicationMenu : public QObject
0030 {
0031     Q_OBJECT
0032 
0033 public:
0034     explicit ApplicationMenu();
0035 
0036     void showApplicationMenu(const QPoint &pos, Window *c, int actionId);
0037 
0038     bool applicationMenuEnabled() const;
0039 
0040     void setViewEnabled(bool enabled);
0041 
0042 Q_SIGNALS:
0043     void applicationMenuEnabledChanged(bool enabled);
0044 
0045 private Q_SLOTS:
0046     void slotShowRequest(const QString &serviceName, const QDBusObjectPath &menuObjectPath, int actionId);
0047     void slotMenuShown(const QString &serviceName, const QDBusObjectPath &menuObjectPath);
0048     void slotMenuHidden(const QString &serviceName, const QDBusObjectPath &menuObjectPath);
0049 
0050 private:
0051     OrgKdeKappmenuInterface *m_appmenuInterface;
0052     QDBusServiceWatcher *m_kappMenuWatcher;
0053 
0054     Window *findWindowWithApplicationMenu(const QString &serviceName, const QDBusObjectPath &menuObjectPath);
0055 
0056     bool m_applicationMenuEnabled = false;
0057 };
0058 
0059 }