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 <klistview.h>
24 #include <kitemcategorizer.h>
25 #include <QtGui/QStyleOption>
26 #include <libdolphin_export.h>
28 class DolphinController
;
29 class DolphinItemCategorizer
;
33 * @brief Represents the view, where each item is shown as an icon.
35 * It is also possible that instead of the icon a preview of the item
38 class LIBDOLPHINPRIVATE_EXPORT DolphinIconsView
: public KListView
43 explicit DolphinIconsView(QWidget
* parent
, DolphinController
* controller
);
44 virtual ~DolphinIconsView();
47 virtual QStyleOptionViewItem
viewOptions() const;
48 virtual void contextMenuEvent(QContextMenuEvent
* event
);
49 virtual void mousePressEvent(QMouseEvent
* event
);
50 virtual void mouseReleaseEvent(QMouseEvent
* event
);
51 virtual void dragEnterEvent(QDragEnterEvent
* event
);
52 virtual void dragMoveEvent(QDragMoveEvent
* event
);
53 virtual void dropEvent(QDropEvent
* event
);
54 virtual void paintEvent(QPaintEvent
* event
);
57 void slotShowPreviewChanged(bool show
);
58 void slotShowAdditionalInfoChanged(bool show
);
63 bool isZoomInPossible() const;
64 bool isZoomOutPossible() const;
66 /** Returns the increased icon size for the size \a size. */
67 int increasedIconSize(int size
) const;
69 /** Returns the decreased icon size for the size \a size. */
70 int decreasedIconSize(int size
) const;
73 * Updates the size of the grid depending on the state
74 * of \a showPreview and \a showAdditionalInfo.
76 void updateGridSize(bool showPreview
, bool showAdditionalInfo
);
79 DolphinController
* m_controller
;
80 QStyleOptionViewItem m_viewOptions
;
82 bool m_dragging
; // TODO: remove this property when the issue #160611 is solved in Qt 4.4
83 QRect m_dropRect
; // TODO: remove this property when the issue #160611 is solved in Qt 4.4