File indexing completed on 2024-04-28 05:52:36

0001 /*
0002     This file is part of the Okteta Gui library, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2008 Friedrich W. H. Kossebau <kossebau@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef OKTETA_DROPPER_HPP
0010 #define OKTETA_DROPPER_HPP
0011 
0012 // Okteta core
0013 #include <Okteta/Address>
0014 
0015 class QDragEnterEvent;
0016 class QDragMoveEvent;
0017 class QDragLeaveEvent;
0018 class QDropEvent;
0019 
0020 namespace Okteta {
0021 class AbstractByteArrayView;
0022 
0023 class Dropper
0024 {
0025 public:
0026     explicit Dropper(AbstractByteArrayView* view);
0027     Dropper(const Dropper&) = delete;
0028 
0029     ~Dropper();
0030 
0031     Dropper& operator=(const Dropper&) = delete;
0032 
0033 public: // AbstractMouseController API
0034     bool handleDragEnterEvent(QDragEnterEvent* dragEnterEvent);
0035     bool handleDragMoveEvent(QDragMoveEvent* dragMoveEvent);
0036     bool handleDragLeaveEvent(QDragLeaveEvent* dragLeaveEvent);
0037     bool handleDropEvent(QDropEvent* dropEvent);
0038 
0039 public:
0040     bool isActive() const;
0041 
0042 private:
0043     void handleInternalDrag(QDropEvent* dropEvent, AbstractByteArrayView* sourceByteArrayView);
0044 
0045 private:
0046     AbstractByteArrayView* mByteArrayView;
0047 
0048     Address mBeforeDragCursorPos;
0049     bool mBeforeDragCursorIsBehind : 1;
0050     bool mCursorIsMovedByDrag : 1;
0051 
0052     bool mIsActive : 1;
0053 };
0054 
0055 }
0056 
0057 #endif