summaryrefslogtreecommitdiffstats
path: root/buildtools/autotools/tdefilednddetailview.h
blob: 8af26cf01369232276f418fe251472fbe225de65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/***************************************************************************
*                        tdefilednddetailview.h  -  description
*                           -------------------
*  begin                : Wed Nov 1 2000
*  copyright            : (C) 2000 by Bj�rn Sahlstr�m
*  email                : [email protected]
***************************************************************************/

/***************************************************************************
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*  the Free Software Foundation; either version 2 of the License, or     *
*  (at your option) any later version.                                   *
*                                                                        *
**************************************************************************/

#ifndef TDEFILEDNDDETAILVIEW_H
#define TDEFILEDNDDETAILVIEW_H

//////////////////////////////////////////////////////////////////////
// TQt specific include files
#include <tqwidget.h>
#include <tqtimer.h> 
//////////////////////////////////////////////////////////////////////
// KDE specific include files
#include <tdefiledetailview.h>
#include <kurldrag.h>


/**
	*This is a fileview inherited from @ref KFileDetailView.
	*It adds "drag and drop" handling to the view suitable for a @ref KFileDetailView.
	* No special setup is needed, just connect to the @ref dropped signals
	* and the view will take care of the rest.
	*@short "Drag and drop" aware @ref KFileDetailView	
	*@author Bj�rn Sahlstr�m
  */

class KFileDnDDetailView : public KFileDetailView
{
	TQ_OBJECT
  
public:
	/**  */
	KFileDnDDetailView( TQWidget *parent = 0, const char *name = 0 );
	/**  */
	virtual ~KFileDnDDetailView();
	/**
	* Set this to true if Drag'n drop should be enabled or not, default is enabled
	*/
	void setDnDEnabled( bool );
	/**
	* @returns wether DnD is enabled or not.
	*/
	bool isDnDEnabled() const
	{
		return m_dndEnabled;
	}
	/**
	*Sets the auto open time, which means the time that will
	*elapse before a directory is automatically opened after entered by DnD.
	*Only need to call this if you want to change the predefined time that is 750 ms.
	*This also calls @ref #useAutoOpenTimer so no need to call this to.
	*/
	void setAutoOpenTime( const int& time );
	/**
	*Set this to true if you want the view to use it's auto open functionallity otherwhise set it to false.
	*By default this is turned ON.
	*/
	void useAutoOpenTimer( bool on = true );
	/**
	*@returns true if auto open functionallity is turned ON (default), otherwhise false
	*@see #useAutoOpenTimer
	*@see #setAutoOpenTime
	*/
	bool isAutoOpening() const
	{
		return m_useAutoOpenTimer;
	}
	/** */
	virtual void readConfig( TDEConfig*, const TQString& group = TQString() );
	/** */
	virtual void writeConfig( TDEConfig*, const TQString& group = TQString() );
signals:  // Signals
	/**
	* Emitted whenever an decodable item is dropped in the view.
	* Note: The @ref TQDropEvent contains a @ref KURLDrag object.
	*/
	void dropped( TQDropEvent* );
	/**
	* Emitted whenever an decodable item is dropped in the view
	* Note: The @ref TQDropEvent contains a @ref KURLDrag object.
	*/
	void dropped( KFileView*, TQDropEvent* );
	/**
	* Emitted whenever an decodable item is dropped in the view.
	*@param urls contains a list of all dropped @ref KURL
	*/
	void dropped( KFileView*, KURL::List& urls );
protected slots:  // Protected slots
	/**
	* Called when the auto timer times out. Open the current folder.
	*/
	void slotOpenFolder();
protected:  //Protected Methods
	/**  */
	virtual void contentsDragEnterEvent( TQDragEnterEvent *e );
	/**  */
	virtual void contentsDragMoveEvent( TQDragMoveEvent *e );
	/**  */
	virtual void contentsDragLeaveEvent( TQDragLeaveEvent *e );
	/**  */
	virtual void contentsDropEvent( TQDropEvent* e );
	/**
	* Create dragobject encoding the current selection and starts the drag
	*/
	virtual void startDrag();
	/**
	* @returns the dragObject
	*/
	virtual TQDragObject* dragObject() const;
	/**
	* @returns true if we can decode the drag and support the action
	*/
	virtual bool acceptDrag( TQDropEvent* event ) const;
protected:  // Private attributes
	TQTimer m_autoOpenTimer;
	int m_autoOpenTime;
	bool m_useAutoOpenTimer;
	TQListViewItem* m_dropItem;
	KURLDrag* m_dragObject;
	bool m_dndEnabled;
};

#endif