]> cloud.milkyroute.net Git - dolphin.git/blob - src/dolphiniconsview.h
Initial step for showing the terminal embedded inside Dolphin instead of opening...
[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 <QStyleOptionViewItem>
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 /**
55 * Updates the size of the grid
56 * depending on the state of \a showPreview.
57 */
58 void updateGridSize(bool showPreview);
59
60 void zoomIn();
61 void zoomOut();
62
63 private:
64 bool isZoomInPossible() const;
65 bool isZoomOutPossible() const;
66
67 /** Returns the increased icon size for the size \a size. */
68 int increasedIconSize(int size) const;
69
70 /** Returns the decreased icon size for the size \a size. */
71 int decreasedIconSize(int size) const;
72
73 private:
74 DolphinController* m_controller;
75 QStyleOptionViewItem m_viewOptions;
76 };
77
78 #endif