Ran qt3to4
[basket4.git] / src / basketlistview.h
bloba37111acefdab6336950cb642737a439c5342bfa
1 /***************************************************************************
2 * Copyright (C) 2003 by S�astien Laot *
3 * slaout@linux62.org *
4 * *
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. *
9 * *
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. *
14 * *
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>
25 #include <qtimer.h>
26 //Added by qt3to4:
27 #include <QPixmap>
28 #include <QResizeEvent>
29 #include <QDragEnterEvent>
30 #include <QDropEvent>
31 #include <QDragMoveEvent>
32 #include <QFocusEvent>
33 #include <QDragLeaveEvent>
35 class Basket;
37 class BasketListViewItem : public Q3ListViewItem
39 public:
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();
46 ///
47 bool acceptDrop(const QMimeSource *mime) const;
48 void dropped(QDropEvent *event);
49 Basket *basket() { return m_basket; }
50 void setup();
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();
58 void ensureVisible();
59 bool isShown();
60 bool isCurrentBasket();
61 void paintCell(QPainter *painter, const QColorGroup &colorGroup, int column, int width, int align);
62 QString escapedName(const QString &string);
63 ///
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);
74 bool isAbbreviated();
75 ///
76 // QDragObject* dragObject();
77 // bool acceptDrop ( const QMimeSource * mime ) const;
78 private:
79 Basket *m_basket;
80 int m_width;
81 bool m_isUnderDrag;
82 bool m_isAbbreviated;
85 class BasketTreeListView : public KListView
87 Q_OBJECT
88 public:
89 BasketTreeListView(QWidget *parent = 0, const char *name = 0);
90 void contentsDragEnterEvent(QDragEnterEvent *event);
91 void removeExpands();
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);
97 protected:
98 void focusInEvent(QFocusEvent*);
99 void viewportResizeEvent(QResizeEvent *event);
100 private:
101 QTimer m_autoOpenTimer;
102 Q3ListViewItem *m_autoOpenItem;
103 private slots:
104 void autoOpen();
105 private:
106 void setItemUnderDrag(BasketListViewItem* item);
107 BasketListViewItem* m_itemUnderDrag;
111 #endif // BASKETLISTVIEW_H