1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #ifndef DOLPHINICONSVIEW_H
21 #define DOLPHINICONSVIEW_H
23 #include <kcategorizedview.h>
25 #include <kfileitem.h>
26 #include <kfileitemdelegate.h>
30 #include <QStyleOption>
32 #include <libdolphin_export.h>
34 class DolphinController
;
35 class SelectionManager
;
36 class DolphinCategoryDrawer
;
37 class DolphinViewAutoScroller
;
40 * @brief Represents the view, where each item is shown as an icon.
42 * It is also possible that instead of the icon a preview of the item
45 class LIBDOLPHINPRIVATE_EXPORT DolphinIconsView
: public KCategorizedView
50 explicit DolphinIconsView(QWidget
* parent
, DolphinController
* controller
);
51 virtual ~DolphinIconsView();
52 virtual void scrollTo(const QModelIndex
& index
, ScrollHint hint
= EnsureVisible
);
55 virtual void dataChanged(const QModelIndex
& topLeft
, const QModelIndex
& bottomRight
);
58 virtual QStyleOptionViewItem
viewOptions() const;
59 virtual void contextMenuEvent(QContextMenuEvent
* event
);
60 virtual void mousePressEvent(QMouseEvent
* event
);
61 virtual void startDrag(Qt::DropActions supportedActions
);
62 virtual void dragEnterEvent(QDragEnterEvent
* event
);
63 virtual void dragLeaveEvent(QDragLeaveEvent
* event
);
64 virtual void dragMoveEvent(QDragMoveEvent
* event
);
65 virtual void dropEvent(QDropEvent
* event
);
66 virtual void keyPressEvent(QKeyEvent
* event
);
67 virtual void wheelEvent(QWheelEvent
* event
);
68 virtual void showEvent(QShowEvent
* event
);
69 virtual void leaveEvent(QEvent
* event
);
70 virtual void currentChanged(const QModelIndex
& current
, const QModelIndex
& previous
);
71 virtual void resizeEvent(QResizeEvent
* event
);
74 void slotShowPreviewChanged();
75 void slotAdditionalInfoChanged();
76 void setZoomLevel(int level
);
77 void requestActivation();
82 * Updates the size of the grid depending on the state
83 * of \a showPreview and \a additionalInfoCount.
85 void updateGridSize(bool showPreview
, int additionalInfoCount
);
88 * Returns the number of additional information lines that should
89 * be shown below the item name.
91 int additionalInfoCount() const;
94 bool m_enableScrollTo
;
95 DolphinController
* m_controller
;
96 SelectionManager
* m_selectionManager
;
97 DolphinViewAutoScroller
* m_autoScroller
;
98 DolphinCategoryDrawer
* m_categoryDrawer
;
101 QSize m_decorationSize
;
102 QStyleOptionViewItem::Position m_decorationPosition
;
103 Qt::Alignment m_displayAlignment
;