konq_drag.h
00001 /* This file is part of the KDE project 00002 Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #ifndef __konqdrag_h__ 00020 #define __konqdrag_h__ 00021 00022 #include <tqdragobject.h> 00023 #include <tqrect.h> 00024 #include <tqstring.h> 00025 #include <tqiconview.h> 00026 00027 #include <libkonq_export.h> 00028 00029 #include <kurl.h> 00030 00031 /***************************************************************************** 00032 * 00033 * Class KonqIconDrag 00034 * 00035 *****************************************************************************/ 00036 00037 // Clipboard/dnd data for: Icons + URLS + isCut 00038 class LIBKONQ_EXPORT KonqIconDrag : public TQIconDrag 00039 { 00040 Q_OBJECT 00041 00042 public: 00043 KonqIconDrag( TQWidget * dragSource, const char* name = 0 ); 00044 virtual ~KonqIconDrag() {} 00045 00046 const char* format( int i ) const; 00047 TQByteArray encodedData( const char* mime ) const; 00048 00049 void append( const TQIconDragItem &item, const TQRect &pr, 00050 const TQRect &tr, const TQString &url ); 00051 00052 void setMoveSelection( bool move ) { m_bCutSelection = move; } 00053 00054 static bool canDecode( const TQMimeSource* e ); 00055 00056 protected: // KDE4: private. And d pointer... 00057 TQStringList urls; 00058 bool m_bCutSelection; 00059 }; 00060 00066 class LIBKONQ_EXPORT KonqIconDrag2 : public KonqIconDrag 00067 { 00068 Q_OBJECT 00069 00070 public: 00071 KonqIconDrag2( TQWidget * dragSource ); 00072 virtual ~KonqIconDrag2() {} 00073 00074 virtual const char* format( int i ) const; 00075 virtual TQByteArray encodedData( const char* mime ) const; 00076 00077 void append( const TQIconDragItem &item, const TQRect &pr, 00078 const TQRect &tr, const TQString &url, const KURL &mostLocalURL ); 00079 00080 private: 00081 TQStringList m_kdeURLs; 00082 }; 00083 00084 // Clipboard/dnd data for: URLS + isCut 00085 class LIBKONQ_EXPORT KonqDrag : public TQUriDrag 00086 { 00087 public: 00088 // KDE4: remove, use KonqDrag constructor instead 00089 static KonqDrag * newDrag( const KURL::List & urls, 00090 bool move, TQWidget * dragSource = 0, const char* name = 0 ); 00091 00100 KonqDrag( const KURL::List & urls, const KURL::List& mostLocalUrls, bool cut, TQWidget * dragSource = 0 ); 00101 00102 protected: 00103 // KDE4: remove 00104 KonqDrag( const TQStrList & urls, bool cut, TQWidget * dragSource, const char* name ); 00105 00106 public: 00107 virtual ~KonqDrag() {} 00108 00109 virtual const char* format( int i ) const; 00110 virtual TQByteArray encodedData( const char* mime ) const; 00111 00112 void setMoveSelection( bool move ) { m_bCutSelection = move; } 00113 00114 // Returns true if the data was cut (used for KonqIconDrag too) 00115 static bool decodeIsCutSelection( const TQMimeSource *e ); 00116 00117 protected: // KDE4: private. And d pointer... 00118 bool m_bCutSelection; 00119 TQStrList m_urls; // this is set to the "most local urls". KDE4: KURL::List 00120 }; 00121 00122 #endif