]> cloud.milkyroute.net Git - dolphin.git/blob - src/dolphiniconsview.h
information sidebar fixes:
[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 mouseReleaseEvent(QMouseEvent* event);
50 virtual void dragEnterEvent(QDragEnterEvent* event);
51 virtual void dropEvent(QDropEvent* event);
52
53 private slots:
54 void slotShowPreviewChanged(bool show);
55 void slotShowAdditionalInfoChanged(bool show);
56 void zoomIn();
57 void zoomOut();
58
59 private:
60 bool isZoomInPossible() const;
61 bool isZoomOutPossible() const;
62
63 /** Returns the increased icon size for the size \a size. */
64 int increasedIconSize(int size) const;
65
66 /** Returns the decreased icon size for the size \a size. */
67 int decreasedIconSize(int size) const;
68
69 /**
70 * Updates the size of the grid depending on the state
71 * of \a showPreview and \a showAdditionalInfo.
72 */
73 void updateGridSize(bool showPreview, bool showAdditionalInfo);
74
75 private:
76 DolphinController* m_controller;
77 QStyleOptionViewItem m_viewOptions;
78 };
79
80 #endif