delay a few things on startup, such as setting the visibility mode, which ensures...
[personal-kdebase.git] / apps / plasma / applets / folderview / listview.h
blobfe5b70de7f027623d1cd104ffbba9928accb9384
1 /*
2 * Copyright © 2008 Fredrik Höglund <fredrik@kde.org>
3 * Copyright © 2008 Rafael Fernández López <ereslibre@kde.org>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library 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 GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #ifndef LISTVIEW_H
22 #define LISTVIEW_H
24 #include "abstractitemview.h"
26 #include <QAbstractItemDelegate>
27 #include <QPointer>
28 #include <QCache>
29 #include <QTime>
30 #include <QBasicTimer>
33 class KUrl;
34 class KDirModel;
35 class KFileItemDelegate;
36 class KFilePreviewGenerator;
37 class KNewMenu;
38 class QItemSelectionModel;
39 class ProxyModel;
40 class QStyleOptionViewItemV4;
41 class QScrollBar;
44 class ListView : public AbstractItemView
46 Q_OBJECT
48 public:
49 ListView(QGraphicsWidget *parent = 0);
50 ~ListView();
52 void setModel(QAbstractItemModel *model);
54 void setIconSize(const QSize &gridSize);
56 void setWordWrap(bool on);
57 bool wordWrap() const;
59 void setDrawShadows(bool on);
60 bool drawShadows() const;
62 QModelIndex indexAt(const QPointF &point) const;
63 QRect visualRect(const QModelIndex &index) const;
65 protected:
66 void startDrag(const QPointF &pos, QWidget *widget);
67 void updateTextShadows(const QColor &textColor);
68 void updateScrollBar();
69 void updateSizeHint();
70 QStyleOptionViewItemV4 viewOptions() const;
72 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
74 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
75 void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
76 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
77 void mousePressEvent(QGraphicsSceneMouseEvent *event);
78 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
79 void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
80 void wheelEvent(QGraphicsSceneWheelEvent *event);
81 void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
82 void dropEvent(QGraphicsSceneDragDropEvent *event);
83 void resizeEvent(QGraphicsSceneResizeEvent *event);
85 void rowsInserted(const QModelIndex &parent, int first, int last);
86 void rowsRemoved(const QModelIndex &parent, int first, int last);
87 void modelReset();
88 void layoutChanged();
89 void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
91 private:
92 int m_rowHeight;
93 QPersistentModelIndex m_pressedIndex;
94 bool m_dragInProgress;
95 bool m_wordWrap;
96 bool m_drawShadows;
99 #endif // LISTVIEW_H