File indexing completed on 2024-04-28 05:30:12

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 // Qt
0013 #include <QObject>
0014 // xcb
0015 #include <xcb/xcb.h>
0016 
0017 class QPoint;
0018 class OrgKdeKappmenuInterface;
0019 class QDBusObjectPath;
0020 class QDBusServiceWatcher;
0021 
0022 namespace KWin
0023 {
0024 
0025 class Window;
0026 
0027 class ApplicationMenu : public QObject
0028 {
0029     Q_OBJECT
0030 
0031 public:
0032     explicit ApplicationMenu();
0033 
0034     void showApplicationMenu(const QPoint &pos, Window *c, int actionId);
0035 
0036     bool applicationMenuEnabled() const;
0037 
0038     void setViewEnabled(bool enabled);
0039 
0040 Q_SIGNALS:
0041     void applicationMenuEnabledChanged(bool enabled);
0042 
0043 private Q_SLOTS:
0044     void slotShowRequest(const QString &serviceName, const QDBusObjectPath &menuObjectPath, int actionId);
0045     void slotMenuShown(const QString &serviceName, const QDBusObjectPath &menuObjectPath);
0046     void slotMenuHidden(const QString &serviceName, const QDBusObjectPath &menuObjectPath);
0047 
0048 private:
0049     OrgKdeKappmenuInterface *m_appmenuInterface;
0050     QDBusServiceWatcher *m_kappMenuWatcher;
0051 
0052     Window *findWindowWithApplicationMenu(const QString &serviceName, const QDBusObjectPath &menuObjectPath);
0053 
0054     bool m_applicationMenuEnabled = false;
0055 };
0056 
0057 }