summaryrefslogtreecommitdiffstats
path: root/src/basketlistview.h
blob: d64d39591faadc3ca8482bcf1c0bdf6ad8a69a2c (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
/***************************************************************************
 *   Copyright (C) 2003 by S�astien Laot                                 *
 *   slaout@linux62.org                                                    *
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
 ***************************************************************************/

#ifndef BASKETLISTVIEW_H
#define BASKETLISTVIEW_H

#include <tdelistview.h>
#include <tqtimer.h>

class Basket;

class BasketListViewItem : public TQListViewItem
{
	public:
	/// CONSTRUCTOR AND DESTRUCTOR:
		BasketListViewItem(TQListView     *parent, Basket *basket);
		BasketListViewItem(TQListViewItem *parent, Basket *basket);
		BasketListViewItem(TQListView     *parent, TQListViewItem *after, Basket *basket);
		BasketListViewItem(TQListViewItem *parent, TQListViewItem *after, Basket *basket);
		~BasketListViewItem();
		///
		bool acceptDrop(const TQMimeSource *mime) const;
		void dropped(TQDropEvent *event);
		Basket *basket() { return m_basket; }
		void setup();
		int width(const TQFontMetrics &fontMetrics, const TQListView *listView, int column) const;
		BasketListViewItem* lastChild();
		BasketListViewItem* prevSibling();
		BasketListViewItem* shownItemAbove();
		BasketListViewItem* shownItemBelow();
		TQStringList childNamesTree(int deep = 0);
		void moveChildsBaskets();
		void ensureVisible();
		bool isShown();
		bool isCurrentBasket();
		void paintCell(TQPainter *painter, const TQColorGroup &colorGroup, int column, int width, int align);
		TQString escapedName(const TQString &string);
		///
		TQPixmap circledTextPixmap(const TQString &text, int height, const TQFont &font, const TQColor &color);
		TQPixmap foundCountPixmap(bool isLoading, int countFound, bool childsAreLoading, int countChildsFound, const TQFont &font, int height);
		bool haveChildsLoading();
		bool haveHiddenChildsLoading();
		bool haveChildsLocked();
		bool haveHiddenChildsLocked();
		int countChildsFound();
		int countHiddenChildsFound();

		void setUnderDrag(bool);
		bool isAbbreviated();
		///
//	TQDragObject* dragObject();
//	bool acceptDrop ( const TQMimeSource * mime ) const;
	private:
		Basket *m_basket;
		int     m_width;
		bool m_isUnderDrag;
		bool m_isAbbreviated;
};

class BasketTreeListView : public TDEListView
{
	TQ_OBJECT
  
	public:
		BasketTreeListView(TQWidget *parent = 0, const char *name = 0);
		void contentsDragEnterEvent(TQDragEnterEvent *event);
		void removeExpands();
		void contentsDragLeaveEvent(TQDragLeaveEvent *event);
		void contentsDragMoveEvent(TQDragMoveEvent *event);
		void contentsDropEvent(TQDropEvent *event);
		void resizeEvent(TQResizeEvent *event);
		void paintEmptyArea(TQPainter *painter, const TQRect &rect);
	protected:
		void focusInEvent(TQFocusEvent*);
		void viewportResizeEvent(TQResizeEvent *event);
	private:
		TQTimer         m_autoOpenTimer;
		TQListViewItem *m_autoOpenItem;
	private slots:
		void autoOpen();
	private:
		void setItemUnderDrag(BasketListViewItem* item);
		BasketListViewItem* m_itemUnderDrag;

};

#endif // BASKETLISTVIEW_H