File indexing completed on 2024-05-12 16:39:36

0001 /* This file is part of the KDE project
0002    Copyright (C) 2002, 2003 Joseph Wenninger <jowenn@kde.org>
0003    Copyright (C) 2005 Jarosław Staniek <staniek@kde.org>
0004 
0005    This library is free software; you can redistribute it and/or
0006    modify it under the terms of the GNU Library General Public
0007    License as published by the Free Software Foundation; either
0008    version 2 of the License, or (at your option) any later version.
0009 
0010    This library is distributed in the hope that it will be useful,
0011    but WITHOUT ANY WARRANTY; without even the implied warranty of
0012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013    Library General Public License for more details.
0014 
0015    You should have received a copy of the GNU Library General Public License
0016    along with this library; see the file COPYING.LIB.  If not, write to
0017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019 */
0020 
0021 #ifndef KEXI_DRAGOBJECTS_H_
0022 #define KEXI_DRAGOBJECTS_H_
0023 
0024 #include <QDragMoveEvent>
0025 #include <QDropEvent>
0026 #include <QDrag>
0027 
0028 #include "kexicore_export.h"
0029 
0030 class QStringList;
0031 class QWidget;
0032 
0033 //! Drag object containing information about field(s).
0034 class KEXICORE_EXPORT KexiFieldDrag
0035 {
0036 public:
0037     /*! \return true if event \a e (of class QDragMoveEvent or QDropEvent)
0038      can be decoded as "kexi/fields" data. If decoding of "kexi/field"
0039      type is supported, decoding of "kexi/fields" is always supported.
0040      */
0041     static bool canDecode(QDropEvent* e);
0042 
0043     /*! Decodes data of multiple-field drag ("kexi/fields" mime type) coming with event \a e.
0044      Sets \a sourceMimeType, \a sourceName and \a fields. Also works with "kexi/field" data.
0045      \return true on successful decoding (\a e will be accepted in such case). */
0046     static bool decode(QDropEvent *e, QString *sourceMimeType,
0047                        QString *sourceName, QStringList *fields);
0048 };
0049 
0050 //! Drag object containing information about data provider.
0051 class KEXICORE_EXPORT KexiDataProviderDrag : public QDrag
0052 {
0053 public:
0054     KexiDataProviderDrag(const QString& sourceMimeType, const QString& sourceName,
0055                          QWidget *parent = 0);
0056     ~KexiDataProviderDrag();
0057 
0058     static bool canDecode(QDragMoveEvent* e);
0059     static bool decode(QDropEvent* e, QString* sourceMimeType, QString* sourceName);
0060 
0061 };
0062 
0063 #endif