File indexing completed on 2024-12-22 05:15:23

0001 /*
0002     SPDX-FileCopyrightText: 2014 David Edmundson <kde@davidedmundson.co.uk>
0003     SPDX-FileCopyrightText: 2014 Eike Hein <hein@kde.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include <PlasmaQuick/Dialog>
0011 
0012 class SubMenu : public PlasmaQuick::Dialog
0013 {
0014     Q_OBJECT
0015 
0016     Q_PROPERTY(int offset READ offset WRITE setOffset NOTIFY offsetChanged)
0017     Q_PROPERTY(bool facingLeft READ facingLeft NOTIFY facingLeftChanged)
0018 
0019 public:
0020     explicit SubMenu(QQuickItem *parent = nullptr);
0021     ~SubMenu() override;
0022 
0023     Q_INVOKABLE QRect availableScreenRectForItem(QQuickItem *item) const;
0024 
0025     QPoint popupPosition(QQuickItem *item, const QSize &size) override;
0026 
0027     int offset() const;
0028     void setOffset(int offset);
0029 
0030     bool facingLeft() const
0031     {
0032         return m_facingLeft;
0033     }
0034 
0035 Q_SIGNALS:
0036     void offsetChanged() const;
0037     void facingLeftChanged() const;
0038 
0039 private:
0040     int m_offset;
0041     bool m_facingLeft;
0042 };