File indexing completed on 2024-04-14 03:53:15

0001 /*
0002     SPDX-FileCopyrightText: 2009 Rahman Duran <rahman.duran@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef KURLNAVIGATORMENU_P_H
0008 #define KURLNAVIGATORMENU_P_H
0009 
0010 #include <QMenu>
0011 
0012 namespace KDEPrivate
0013 {
0014 /**
0015  * @brief Provides drop-down menus for the URL navigator.
0016  *
0017  * The implementation extends QMenu with drag & drop support.
0018  *
0019  * @internal
0020  */
0021 class KUrlNavigatorMenu : public QMenu
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     explicit KUrlNavigatorMenu(QWidget *parent);
0027     ~KUrlNavigatorMenu() override;
0028 
0029 Q_SIGNALS:
0030     /**
0031      * Is emitted when drop event occurs.
0032      */
0033     void urlsDropped(QAction *action, QDropEvent *event);
0034 
0035     /**
0036      * Is emitted, if the action \p action has been clicked.
0037      */
0038     void mouseButtonClicked(QAction *action, Qt::MouseButton button);
0039 
0040 protected:
0041     void dragEnterEvent(QDragEnterEvent *event) override;
0042     void dragMoveEvent(QDragMoveEvent *event) override;
0043     void dropEvent(QDropEvent *event) override;
0044     void mouseMoveEvent(QMouseEvent *event) override;
0045     void mouseReleaseEvent(QMouseEvent *event) override;
0046 
0047 private:
0048     const QPoint m_initialMousePosition;
0049     bool m_mouseMoved;
0050 };
0051 
0052 } // namespace KDEPrivate
0053 
0054 #endif