]> cloud.milkyroute.net Git - dolphin.git/blob - src/itemeffectsmanager.h
commited initial version of Dolphin
[dolphin.git] / src / itemeffectsmanager.h
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz *
3 * peter.penz@gmx.at *
4 * *
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. *
9 * *
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. *
14 * *
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 ***************************************************************************/
20
21 #ifndef ITEMEFFECTSMANAGER_H
22 #define ITEMEFFECTSMANAGER_H
23
24 #include <qobject.h>
25 #include <qpixmap.h>
26 #include <kurl.h>
27 #include <q3valuelist.h>
28 class KFileItem;
29
30 /**
31 * @brief Abstract class to implement item effects for a Dolphin view.
32 *
33 * Derived classes must implement the following pure virtual methods:
34 * - ItemEffectsManager::setContextPixmap()
35 * - ItemEffectsManager::contextPixmap()
36 * - ItemEffectsManager::firstContext()
37 * - ItemEffectsManager::nextContext()
38 * - ItemEffectsManager::contextFileInfo()
39 *
40 * The item effects manager highlights currently active items and also
41 * respects cutted items. A 'context' is defined as abstract data type,
42 * which usually is represented by a KFileListViewItem or
43 * a KFileIconViewItem.
44 *
45 * In Qt4 the item effects manager should get integrated as part of Interview
46 * and hence no abstract context handling should be necessary anymore. The main
47 * purpose of the current interface is to prevent code duplication as there is
48 * no common model shared by QListView and QIconView of Qt3.
49 *
50 * @see DolphinIconsView
51 * @see DolphinDetailsView
52 * @author Peter Penz <peter.penz@gmx.at>
53 */
54 class ItemEffectsManager
55 {
56 public:
57 ItemEffectsManager();
58 virtual ~ItemEffectsManager();
59
60 /** Is invoked before the items get updated. */
61 virtual void beginItemUpdates() = 0;
62
63 /** Is invoked after the items have been updated. */
64 virtual void endItemUpdates() = 0;
65
66 /**
67 * Increases the size of the current set view mode and refreshes
68 * all views. Derived implementations must invoke the base implementation
69 * if zooming in had been done.
70 */
71 virtual void zoomIn();
72
73 /**
74 * Decreases the size of the current set view mode and refreshes
75 * all views. Derived implementations must invoke the base implementation
76 * if zooming out had been done.
77 */
78 virtual void zoomOut();
79
80 /**
81 * Returns true, if zooming in is possible. If false is returned,
82 * the minimal zoom size is possible.
83 */
84 virtual bool isZoomInPossible() const = 0;
85
86 /**
87 * Returns true, if zooming in is possible. If false is returned,
88 * the minimal zoom size is possible.
89 */
90 virtual bool isZoomOutPossible() const = 0;
91
92 protected:
93 virtual void setContextPixmap(void* context,
94 const QPixmap& pixmap) = 0;
95 virtual const QPixmap* contextPixmap(void* context) = 0;
96 virtual void* firstContext() = 0;
97 virtual void* nextContext(void* context) = 0;
98 virtual KFileItem* contextFileInfo(void* context) = 0;
99
100 void activateItem(void* context);
101 void resetActivatedItem();
102 void updateDisabledItems();
103
104 private:
105 struct DisabledItem {
106 KUrl url;
107 QPixmap pixmap;
108 };
109
110 QPixmap* m_pixmapCopy;
111 KUrl m_highlightedURL;
112
113 // contains all items which have been disabled by a 'cut' operation
114 Q3ValueList<DisabledItem> m_disabledItems;
115
116 /** Returns the text for the statusbar for an activated item. */
117 QString statusBarText(KFileItem* fileInfo) const;
118 };
119
120 #endif