1 /***************************************************************************
2 * Copyright (C) 2003 by S�astien Laot *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #ifndef BASKETLISTVIEW_H
22 #define BASKETLISTVIEW_H
24 #include <klistview.h>
28 #include <QResizeEvent>
29 #include <QDragEnterEvent>
31 #include <QDragMoveEvent>
32 #include <QFocusEvent>
33 #include <QDragLeaveEvent>
37 class BasketListViewItem
: public Q3ListViewItem
40 /// CONSTRUCTOR AND DESTRUCTOR:
41 BasketListViewItem(Q3ListView
*parent
, Basket
*basket
);
42 BasketListViewItem(Q3ListViewItem
*parent
, Basket
*basket
);
43 BasketListViewItem(Q3ListView
*parent
, Q3ListViewItem
*after
, Basket
*basket
);
44 BasketListViewItem(Q3ListViewItem
*parent
, Q3ListViewItem
*after
, Basket
*basket
);
45 ~BasketListViewItem();
47 bool acceptDrop(const QMimeSource
*mime
) const;
48 void dropped(QDropEvent
*event
);
49 Basket
*basket() { return m_basket
; }
51 int width(const QFontMetrics
&fontMetrics
, const Q3ListView
*listView
, int column
) const;
52 BasketListViewItem
* lastChild();
53 BasketListViewItem
* prevSibling();
54 BasketListViewItem
* shownItemAbove();
55 BasketListViewItem
* shownItemBelow();
56 QStringList
childNamesTree(int deep
= 0);
57 void moveChildsBaskets();
60 bool isCurrentBasket();
61 void paintCell(QPainter
*painter
, const QColorGroup
&colorGroup
, int column
, int width
, int align
);
62 QString
escapedName(const QString
&string
);
64 QPixmap
circledTextPixmap(const QString
&text
, int height
, const QFont
&font
, const QColor
&color
);
65 QPixmap
foundCountPixmap(bool isLoading
, int countFound
, bool childsAreLoading
, int countChildsFound
, const QFont
&font
, int height
);
66 bool haveChildsLoading();
67 bool haveHiddenChildsLoading();
68 bool haveChildsLocked();
69 bool haveHiddenChildsLocked();
70 int countChildsFound();
71 int countHiddenChildsFound();
73 void setUnderDrag(bool);
76 // QDragObject* dragObject();
77 // bool acceptDrop ( const QMimeSource * mime ) const;
85 class BasketTreeListView
: public KListView
89 BasketTreeListView(QWidget
*parent
= 0, const char *name
= 0);
90 void contentsDragEnterEvent(QDragEnterEvent
*event
);
92 void contentsDragLeaveEvent(QDragLeaveEvent
*event
);
93 void contentsDragMoveEvent(QDragMoveEvent
*event
);
94 void contentsDropEvent(QDropEvent
*event
);
95 void resizeEvent(QResizeEvent
*event
);
96 void paintEmptyArea(QPainter
*painter
, const QRect
&rect
);
98 void focusInEvent(QFocusEvent
*);
99 void viewportResizeEvent(QResizeEvent
*event
);
101 QTimer m_autoOpenTimer
;
102 Q3ListViewItem
*m_autoOpenItem
;
106 void setItemUnderDrag(BasketListViewItem
* item
);
107 BasketListViewItem
* m_itemUnderDrag
;
111 #endif // BASKETLISTVIEW_H