]> cloud.milkyroute.net Git - dolphin.git/blob - src/dolphiniconsview.h
Provide a hover information when dragging items above other items. TODO: this code...
[dolphin.git] / src / dolphiniconsview.h
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) *
3 * *
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. *
8 * *
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. *
13 * *
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 ***************************************************************************/
19
20 #ifndef DOLPHINICONSVIEW_H
21 #define DOLPHINICONSVIEW_H
22
23 #include <klistview.h>
24 #include <kitemcategorizer.h>
25 #include <QtGui/QStyleOption>
26 #include <libdolphin_export.h>
27
28 class DolphinController;
29 class DolphinItemCategorizer;
30 class DolphinView;
31
32 /**
33 * @brief Represents the view, where each item is shown as an icon.
34 *
35 * It is also possible that instead of the icon a preview of the item
36 * content is shown.
37 */
38 class LIBDOLPHINPRIVATE_EXPORT DolphinIconsView : public KListView
39 {
40 Q_OBJECT
41
42 public:
43 explicit DolphinIconsView(QWidget* parent, DolphinController* controller);
44 virtual ~DolphinIconsView();
45
46 protected:
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);
55
56 private slots:
57 void slotShowPreviewChanged(bool show);
58 void slotShowAdditionalInfoChanged(bool show);
59 void zoomIn();
60 void zoomOut();
61
62 private:
63 bool isZoomInPossible() const;
64 bool isZoomOutPossible() const;
65
66 /** Returns the increased icon size for the size \a size. */
67 int increasedIconSize(int size) const;
68
69 /** Returns the decreased icon size for the size \a size. */
70 int decreasedIconSize(int size) const;
71
72 /**
73 * Updates the size of the grid depending on the state
74 * of \a showPreview and \a showAdditionalInfo.
75 */
76 void updateGridSize(bool showPreview, bool showAdditionalInfo);
77
78 private:
79 DolphinController* m_controller;
80 QStyleOptionViewItem m_viewOptions;
81
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
84 };
85
86 #endif