1
/***************************************************************************
2
* Copyright (C) 2006 by Peter Penz *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the *
17
* Free Software Foundation, Inc., *
18
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19
***************************************************************************/
21
#ifndef DOLPHINICONSVIEW_H
22
#define DOLPHINICONSVIEW_H
24
#include <kfileiconview.h>
27
#include <QDragEnterEvent>
29
#include <QMouseEvent>
30
#include <QDragMoveEvent>
32
#include <itemeffectsmanager.h>
37
* @brief Represents the view, where each item is shown as an icon.
39
* It is also possible that instead of the icon a preview of the item
44
class DolphinIconsView : public KFileIconView, public ItemEffectsManager
54
DolphinIconsView(DolphinView *parent, LayoutMode layoutMode);
56
virtual ~DolphinIconsView();
58
void setLayoutMode(LayoutMode mode);
59
LayoutMode layoutMode() const { return m_layoutMode; }
61
/** @see ItemEffectsManager::updateItems */
62
virtual void beginItemUpdates();
64
/** @see ItemEffectsManager::updateItems */
65
virtual void endItemUpdates();
68
* Reads out the dolphin settings for the icons view and refreshs
71
// TODO: Other view implementations use a similar interface. When using
72
// Interview in Qt4 this method should be moved to a base class (currently
73
// not possible due to having different base classes for the views).
74
void refreshSettings();
76
/** @see ItemEffectsManager::zoomIn() */
77
virtual void zoomIn();
79
/** @see ItemEffectsManager::zoomOut() */
80
virtual void zoomOut();
82
/** @see ItemEffectsManager::isZoomInPossible() */
83
virtual bool isZoomInPossible() const;
85
/** @see ItemEffectsManager::isZoomOutPossible() */
86
virtual bool isZoomOutPossible() const;
90
* Bypass a layout issue in KFileIconView in combination with previews.
91
* @see KFileIconView::arrangeItemsInGrid
93
virtual void arrangeItemsInGrid(bool updated = true);
97
* Is send, if the details view should be activated. Usually an activation
98
* is triggered by a mouse click.
100
void signalRequestActivation();
103
/** @see ItemEffectsManager::setContextPixmap */
104
virtual void setContextPixmap(void* context,
105
const QPixmap& pixmap);
107
/** @see ItemEffectsManager::contextPixmap */
108
virtual const QPixmap* contextPixmap(void* context);
110
/** @see ItemEffectsManager::firstContext */
111
virtual void* firstContext();
113
/** @see ItemEffectsManager::nextContext */
114
virtual void* nextContext(void* context);
116
/** @see ItemEffectsManager::contextFileInfo */
117
virtual KFileItem* contextFileInfo(void* context);
119
/** @see KFileIconView::contentsMousePressEvent */
120
virtual void contentsMousePressEvent(QMouseEvent* event);
122
/** @see KFileIconView::contentsMouseReleaseEvent */
123
virtual void contentsMouseReleaseEvent(QMouseEvent* event);
125
/** @see KFileIconView::drawBackground */
126
virtual void drawBackground(QPainter* painter, const QRect& rect);
128
/** @see KFileIconView::dragObject */
129
virtual Q3DragObject* dragObject();
131
/** @see KFileIconView::contentsDragEnterEvent */
132
virtual void contentsDragEnterEvent(QDragEnterEvent* event);
134
/** @see KFileIconView::contentsDragMoveEvent */
135
virtual void contentsDragMoveEvent(QDragMoveEvent* event);
137
/** @see KFileIconView::contentsDropEvent */
138
virtual void contentsDropEvent(QDropEvent* event);
141
/** Is connected to the onItem-signal from KFileIconView. */
142
void slotOnItem(Q3IconViewItem* item);
144
/** Is connected to the onViewport-signal from KFileIconView. */
145
void slotOnViewport();
148
* Opens the context menu for the item \a item on the given
151
void slotContextMenuRequested(Q3IconViewItem* item,
154
/** Renames the item \a item to the name \a name. */
155
void slotItemRenamed(Q3IconViewItem* item,
156
const QString& name);
158
void slotActivationUpdate();
159
void slotUpdateDisabledItems();
162
int m_previewIconSize;
163
LayoutMode m_layoutMode;
164
DolphinView* m_dolphinView;
166
/** Returns the increased icon size for the size \a size. */
167
int increasedIconSize(int size) const;
169
/** Returns the decreased icon size for the size \a size. */
170
int decreasedIconSize(int size) const;