-rw-r--r-- | microkde/kdeui/klistview.h | 121 |
1 files changed, 66 insertions, 55 deletions
diff --git a/microkde/kdeui/klistview.h b/microkde/kdeui/klistview.h index 9f0d9fd..2176525 100644 --- a/microkde/kdeui/klistview.h +++ b/microkde/kdeui/klistview.h | |||
@@ -1,215 +1,226 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 2000 Reginald Stadlbauer <reggie@kde.org> | 2 | Copyright (C) 2000 Reginald Stadlbauer <reggie@kde.org> |
3 | Copyright (C) 2000 Charles Samuels <charles@kde.org> | 3 | Copyright (C) 2000 Charles Samuels <charles@kde.org> |
4 | Copyright (C) 2000 Peter Putzer <putzer@kde.org> | 4 | Copyright (C) 2000 Peter Putzer <putzer@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License version 2 as published by the Free Software Foundation. | 8 | License version 2 as published by the Free Software Foundation. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | #ifndef KLISTVIEW_H | 20 | #ifndef KLISTVIEW_H |
21 | #define KLISTVIEW_H | 21 | #define KLISTVIEW_H |
22 | 22 | ||
23 | #include <qlistview.h> | 23 | #include <q3listview.h> |
24 | 24 | ||
25 | #include <qptrlist.h> | 25 | #include <q3ptrlist.h> |
26 | //Added by qt3to4: | ||
27 | #include <QDragMoveEvent> | ||
28 | #include <QDropEvent> | ||
29 | #include <QDragLeaveEvent> | ||
30 | #include <QPaintEvent> | ||
31 | #include <QResizeEvent> | ||
32 | #include <QFocusEvent> | ||
33 | #include <QMouseEvent> | ||
34 | #include <QKeyEvent> | ||
35 | #include <QEvent> | ||
36 | #include <QDragEnterEvent> | ||
26 | 37 | ||
27 | //US | 38 | //US |
28 | class QDropEvent; | 39 | class QDropEvent; |
29 | class QDragLeaveEvent; | 40 | class QDragLeaveEvent; |
30 | class QDragMoveEvent; | 41 | class QDragMoveEvent; |
31 | class QDragEnterEvent; | 42 | class QDragEnterEvent; |
32 | 43 | ||
33 | class QDragObject; | 44 | class Q3DragObject; |
34 | class KConfig; | 45 | class KConfig; |
35 | class KLineEdit; | 46 | class KLineEdit; |
36 | /** | 47 | /** |
37 | * This Widget extends the functionality of QListView to honor the system | 48 | * This Widget extends the functionality of QListView to honor the system |
38 | * wide settings for Single Click/Double Click mode, AutoSelection and | 49 | * wide settings for Single Click/Double Click mode, AutoSelection and |
39 | * ChangeCursorOverLink (TM). | 50 | * ChangeCursorOverLink (TM). |
40 | * | 51 | * |
41 | * There is a new signal executed(). It gets connected to either | 52 | * There is a new signal executed(). It gets connected to either |
42 | * @ref QListView::clicked() or @ref QListView::doubleClicked() depending on the KDE | 53 | * @ref QListView::clicked() or @ref QListView::doubleClicked() depending on the KDE |
43 | * wide Single Click/Double Click settings. It is strongly recommended that | 54 | * wide Single Click/Double Click settings. It is strongly recommended that |
44 | * you use this signal instead of the above mentioned. This way you dont | 55 | * you use this signal instead of the above mentioned. This way you dont |
45 | * need to care about the current settings. | 56 | * need to care about the current settings. |
46 | * If you want to get informed when the user selects something connect to the | 57 | * If you want to get informed when the user selects something connect to the |
47 | * QListView::selectionChanged() signal. | 58 | * QListView::selectionChanged() signal. |
48 | * | 59 | * |
49 | * Drag-and-Drop is supported with the signal @ref #dropped(), just @ref #setAcceptDrops(true) | 60 | * Drag-and-Drop is supported with the signal @ref #dropped(), just @ref #setAcceptDrops(true) |
50 | * and connect it to a suitable slot. | 61 | * and connect it to a suitable slot. |
51 | * To see where you are dropping, @ref setDropVisualizer(true). | 62 | * To see where you are dropping, @ref setDropVisualizer(true). |
52 | * And also you'll need @ref acceptDrag(QDropEvent*) | 63 | * And also you'll need @ref acceptDrag(QDropEvent*) |
53 | * | 64 | * |
54 | * KListView is drag-enabled, too: to benefit from that you've got derive from it. | 65 | * KListView is drag-enabled, too: to benefit from that you've got derive from it. |
55 | * Reimplement @ref dragObject() and (possibly) @ref startDrag(), | 66 | * Reimplement @ref dragObject() and (possibly) @ref startDrag(), |
56 | * and @ref setDragEnabled(true). | 67 | * and @ref setDragEnabled(true). |
57 | * | 68 | * |
58 | * @version $Id$ | 69 | * @version $Id$ |
59 | */ | 70 | */ |
60 | class KListView : public QListView | 71 | class KListView : public Q3ListView |
61 | { | 72 | { |
62 | Q_OBJECT | 73 | Q_OBJECT |
63 | Q_ENUMS( SelectionModeExt ) | 74 | Q_ENUMS( SelectionModeExt ) |
64 | Q_PROPERTY( bool fullWidth READ fullWidth WRITE setFullWidth ) | 75 | Q_PROPERTY( bool fullWidth READ fullWidth WRITE setFullWidth ) |
65 | Q_PROPERTY( bool itemsMovable READ itemsMovable WRITE setItemsMovable ) | 76 | Q_PROPERTY( bool itemsMovable READ itemsMovable WRITE setItemsMovable ) |
66 | Q_PROPERTY( bool itemsRenameable READ itemsRenameable WRITE setItemsRenameable ) | 77 | Q_PROPERTY( bool itemsRenameable READ itemsRenameable WRITE setItemsRenameable ) |
67 | Q_PROPERTY( bool dragEnabled READ dragEnabled WRITE setDragEnabled ) | 78 | Q_PROPERTY( bool dragEnabled READ dragEnabled WRITE setDragEnabled ) |
68 | Q_PROPERTY( bool autoOpen READ autoOpen WRITE setAutoOpen ) | 79 | Q_PROPERTY( bool autoOpen READ autoOpen WRITE setAutoOpen ) |
69 | Q_PROPERTY( bool dropVisualizer READ dropVisualizer WRITE setDropVisualizer ) | 80 | Q_PROPERTY( bool dropVisualizer READ dropVisualizer WRITE setDropVisualizer ) |
70 | //US Q_PROPERTY( int tooltipColumn READ tooltipColumn WRITE setTooltipColumn ) | 81 | //US Q_PROPERTY( int tooltipColumn READ tooltipColumn WRITE setTooltipColumn ) |
71 | Q_PROPERTY( int dropVisualizerWidth READ dropVisualizerWidth WRITE setDropVisualizerWidth ) | 82 | Q_PROPERTY( int dropVisualizerWidth READ dropVisualizerWidth WRITE setDropVisualizerWidth ) |
72 | Q_PROPERTY( QColor alternateBackground READ alternateBackground WRITE setAlternateBackground ) | 83 | Q_PROPERTY( QColor alternateBackground READ alternateBackground WRITE setAlternateBackground ) |
73 | 84 | ||
74 | Q_OVERRIDE( SelectionModeExt selectionMode READ selectionModeExt WRITE setSelectionModeExt ) | 85 | Q_OVERRIDE( SelectionModeExt selectionMode READ selectionModeExt WRITE setSelectionModeExt ) |
75 | 86 | ||
76 | public: | 87 | public: |
77 | /** | 88 | /** |
78 | * Possible selection modes. | 89 | * Possible selection modes. |
79 | * | 90 | * |
80 | * The first four correspond directly to QListView::SelectionMode, while | 91 | * The first four correspond directly to QListView::SelectionMode, while |
81 | * the FileManager selection mode is defined as follows: | 92 | * the FileManager selection mode is defined as follows: |
82 | * @li home: move to the first | 93 | * @li home: move to the first |
83 | * @li end: move to the last | 94 | * @li end: move to the last |
84 | * @li PgUp/PgDn: move one page up/down | 95 | * @li PgUp/PgDn: move one page up/down |
85 | * @li up/down: move one item up/down | 96 | * @li up/down: move one item up/down |
86 | * @li insert: toggle selection of current and move to the next | 97 | * @li insert: toggle selection of current and move to the next |
87 | * @li space: toggle selection of the current | 98 | * @li space: toggle selection of the current |
88 | * @li CTRL+up: move to the previous item and toggle selection of this one | 99 | * @li CTRL+up: move to the previous item and toggle selection of this one |
89 | * @li CTRL+down: toggle selection of the current item and move to the next | 100 | * @li CTRL+down: toggle selection of the current item and move to the next |
90 | * @li CTRL+end: toggle selection from (including) the current | 101 | * @li CTRL+end: toggle selection from (including) the current |
91 | * item to (including) the last item | 102 | * item to (including) the last item |
92 | * @li CTRL+home: toggle selection from (including) the current | 103 | * @li CTRL+home: toggle selection from (including) the current |
93 | * item to the (including) the first item | 104 | * item to the (including) the first item |
94 | * @li CTRL+PgDn: toggle selection from (including) the current | 105 | * @li CTRL+PgDn: toggle selection from (including) the current |
95 | * item to (excluding) the item one page down | 106 | * item to (excluding) the item one page down |
96 | * @li CTRL+PgUp: toggle selection from (excluding) the current | 107 | * @li CTRL+PgUp: toggle selection from (excluding) the current |
97 | * item to (including) the item one page up | 108 | * item to (including) the item one page up |
98 | * | 109 | * |
99 | * The combinations work the same with SHIFT instead of CTRL, except | 110 | * The combinations work the same with SHIFT instead of CTRL, except |
100 | * that if you start selecting something using SHIFT everything selected | 111 | * that if you start selecting something using SHIFT everything selected |
101 | * before will be deselected first. | 112 | * before will be deselected first. |
102 | * | 113 | * |
103 | * Additionally the current item is always selected automatically when | 114 | * Additionally the current item is always selected automatically when |
104 | * navigating using the keyboard, except other items were selected explicitely. | 115 | * navigating using the keyboard, except other items were selected explicitely. |
105 | * | 116 | * |
106 | * This way e.g. SHIFT+up/PgUp then SHIFT+down/PgDn leaves no item selected | 117 | * This way e.g. SHIFT+up/PgUp then SHIFT+down/PgDn leaves no item selected |
107 | */ | 118 | */ |
108 | enum SelectionModeExt { | 119 | enum SelectionModeExt { |
109 | Single = QListView::Single, | 120 | Single = Q3ListView::Single, |
110 | Multi = QListView::Multi, | 121 | Multi = Q3ListView::Multi, |
111 | Extended = QListView::Extended, | 122 | Extended = Q3ListView::Extended, |
112 | NoSelection = QListView::NoSelection, | 123 | NoSelection = Q3ListView::NoSelection, |
113 | FileManager | 124 | FileManager |
114 | }; | 125 | }; |
115 | void repaintContents( bool erase = true ) | 126 | void repaintContents( bool erase = true ) |
116 | { | 127 | { |
117 | QScrollView::repaintContents( contentsX(), contentsY(), | 128 | Q3ScrollView::repaintContents( contentsX(), contentsY(), |
118 | visibleWidth(), visibleHeight(), erase ); | 129 | visibleWidth(), visibleHeight(), erase ); |
119 | }; | 130 | }; |
120 | /** | 131 | /** |
121 | * Constructor. | 132 | * Constructor. |
122 | * | 133 | * |
123 | * The parameters @p parent and @p name are handled by | 134 | * The parameters @p parent and @p name are handled by |
124 | * @ref QListView, as usual. | 135 | * @ref QListView, as usual. |
125 | */ | 136 | */ |
126 | KListView (QWidget *parent = 0, const char *name = 0, bool emulateRightMouse = true ); | 137 | KListView (QWidget *parent = 0, const char *name = 0, bool emulateRightMouse = true ); |
127 | 138 | ||
128 | /** | 139 | /** |
129 | * Destructor. | 140 | * Destructor. |
130 | */ | 141 | */ |
131 | virtual ~KListView(); | 142 | virtual ~KListView(); |
132 | 143 | ||
133 | virtual QSize sizeHint() const; | 144 | virtual QSize sizeHint() const; |
134 | /** | 145 | /** |
135 | * Reimplemented for internal reasons. | 146 | * Reimplemented for internal reasons. |
136 | * Further reimplementations should call this function or else | 147 | * Further reimplementations should call this function or else |
137 | * some features may not work correctly. | 148 | * some features may not work correctly. |
138 | * | 149 | * |
139 | * The API is unaffected. | 150 | * The API is unaffected. |
140 | */ | 151 | */ |
141 | virtual void setAcceptDrops (bool); | 152 | virtual void setAcceptDrops (bool); |
142 | 153 | ||
143 | /** | 154 | /** |
144 | * This function determines whether the given coordinates are within the | 155 | * This function determines whether the given coordinates are within the |
145 | * execute area. The execute area is the part of a @ref QListViewItem where mouse | 156 | * execute area. The execute area is the part of a @ref QListViewItem where mouse |
146 | * clicks or double clicks respectively generate a @ref #executed() signal. | 157 | * clicks or double clicks respectively generate a @ref #executed() signal. |
147 | * Depending on @ref QListView::allColumnsShowFocus() this is either the | 158 | * Depending on @ref QListView::allColumnsShowFocus() this is either the |
148 | * whole item or only the first column. | 159 | * whole item or only the first column. |
149 | * @return true if point is inside execute area of an item, false in all | 160 | * @return true if point is inside execute area of an item, false in all |
150 | * other cases including the case that it is over the viewport. | 161 | * other cases including the case that it is over the viewport. |
151 | */ | 162 | */ |
152 | virtual bool isExecuteArea( const QPoint& point ); | 163 | virtual bool isExecuteArea( const QPoint& point ); |
153 | 164 | ||
154 | /** | 165 | /** |
155 | * Same thing, but from an x coordinate only. This only checks if x is in | 166 | * Same thing, but from an x coordinate only. This only checks if x is in |
156 | * the first column (if all columns don't show focus), without testing if | 167 | * the first column (if all columns don't show focus), without testing if |
157 | * the y coordinate is over an item or not. | 168 | * the y coordinate is over an item or not. |
158 | */ | 169 | */ |
159 | bool isExecuteArea( int x ); | 170 | bool isExecuteArea( int x ); |
160 | 171 | ||
161 | /** | 172 | /** |
162 | * @return a list containing the currently selected items. | 173 | * @return a list containing the currently selected items. |
163 | */ | 174 | */ |
164 | QPtrList<QListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?) | 175 | Q3PtrList<Q3ListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?) |
165 | 176 | ||
166 | /** | 177 | /** |
167 | * Arbitrarily move @p item to @p parent, positioned immediately after item @p after. | 178 | * Arbitrarily move @p item to @p parent, positioned immediately after item @p after. |
168 | */ | 179 | */ |
169 | void moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after); | 180 | void moveItem(Q3ListViewItem *item, Q3ListViewItem *parent, Q3ListViewItem *after); |
170 | 181 | ||
171 | /** | 182 | /** |
172 | * @return the last item (not child!) of this listview. | 183 | * @return the last item (not child!) of this listview. |
173 | * | 184 | * |
174 | * @see lastChild() | 185 | * @see lastChild() |
175 | */ | 186 | */ |
176 | QListViewItem *lastItem() const; | 187 | Q3ListViewItem *lastItem() const; |
177 | 188 | ||
178 | /** | 189 | /** |
179 | * @return the last child of this listview. | 190 | * @return the last child of this listview. |
180 | * | 191 | * |
181 | * @see lastItem() | 192 | * @see lastItem() |
182 | */ | 193 | */ |
183 | QListViewItem* lastChild () const; | 194 | Q3ListViewItem* lastChild () const; |
184 | 195 | ||
185 | /** | 196 | /** |
186 | * @return the lineedit used for inline renaming. | 197 | * @return the lineedit used for inline renaming. |
187 | * Use that to setup a @ref KCompletion or @ref QValidator for the lineedit | 198 | * Use that to setup a @ref KCompletion or @ref QValidator for the lineedit |
188 | * | 199 | * |
189 | * @since 3.2 | 200 | * @since 3.2 |
190 | */ | 201 | */ |
191 | KLineEdit* renameLineEdit() const; | 202 | KLineEdit* renameLineEdit() const; |
192 | 203 | ||
193 | /** | 204 | /** |
194 | * @returns if it is legal to move items in the list view. True by default. | 205 | * @returns if it is legal to move items in the list view. True by default. |
195 | * | 206 | * |
196 | * @see #setDragEnabled() | 207 | * @see #setDragEnabled() |
197 | * @see #setItemsMovable() | 208 | * @see #setItemsMovable() |
198 | */ | 209 | */ |
199 | bool itemsMovable() const; | 210 | bool itemsMovable() const; |
200 | 211 | ||
201 | /** | 212 | /** |
202 | * @return whether inplace-renaming has been enabled. False by default. | 213 | * @return whether inplace-renaming has been enabled. False by default. |
203 | * | 214 | * |
204 | * @see #setItemsRenameable() | 215 | * @see #setItemsRenameable() |
205 | */ | 216 | */ |
206 | bool itemsRenameable() const; | 217 | bool itemsRenameable() const; |
207 | 218 | ||
208 | /** | 219 | /** |
209 | * @return whether dragging is enabled. False by default. | 220 | * @return whether dragging is enabled. False by default. |
210 | * | 221 | * |
211 | * @see #setDragEnabled() | 222 | * @see #setDragEnabled() |
212 | */ | 223 | */ |
213 | bool dragEnabled() const; | 224 | bool dragEnabled() const; |
214 | 225 | ||
215 | /** | 226 | /** |
@@ -247,103 +258,103 @@ public: | |||
247 | * @deprecated | 258 | * @deprecated |
248 | */ | 259 | */ |
249 | bool createChildren() const; | 260 | bool createChildren() const; |
250 | 261 | ||
251 | /** | 262 | /** |
252 | * @return true if drawing of the drop-highlighter has been enabled. False by default. | 263 | * @return true if drawing of the drop-highlighter has been enabled. False by default. |
253 | * | 264 | * |
254 | * @see #setDropHighlighter() | 265 | * @see #setDropHighlighter() |
255 | */ | 266 | */ |
256 | bool dropHighlighter() const; | 267 | bool dropHighlighter() const; |
257 | 268 | ||
258 | /** | 269 | /** |
259 | * The dropVisualizerWidth defaults to 4. | 270 | * The dropVisualizerWidth defaults to 4. |
260 | * | 271 | * |
261 | * @see #setDropVisualizerWidth() | 272 | * @see #setDropVisualizerWidth() |
262 | * @return the current width of the drop-visualizer. | 273 | * @return the current width of the drop-visualizer. |
263 | */ | 274 | */ |
264 | int dropVisualizerWidth () const; | 275 | int dropVisualizerWidth () const; |
265 | 276 | ||
266 | /** | 277 | /** |
267 | * @return the "extended" selection mode of this listview. | 278 | * @return the "extended" selection mode of this listview. |
268 | * | 279 | * |
269 | * @see SelectionModeExt | 280 | * @see SelectionModeExt |
270 | * @see setSelectionModeExt | 281 | * @see setSelectionModeExt |
271 | */ | 282 | */ |
272 | SelectionModeExt selectionModeExt () const; | 283 | SelectionModeExt selectionModeExt () const; |
273 | 284 | ||
274 | /** | 285 | /** |
275 | * Returns the index of @p item within the item tree or -1 if | 286 | * Returns the index of @p item within the item tree or -1 if |
276 | * @p item doesn't exist in this list view. This function takes | 287 | * @p item doesn't exist in this list view. This function takes |
277 | * all items into account not only the visible ones. | 288 | * all items into account not only the visible ones. |
278 | */ | 289 | */ |
279 | int itemIndex( const QListViewItem *item ) const; | 290 | int itemIndex( const Q3ListViewItem *item ) const; |
280 | 291 | ||
281 | /** | 292 | /** |
282 | * Returns the item of @p index within the item tree or 0 if | 293 | * Returns the item of @p index within the item tree or 0 if |
283 | * @p index doesn't exist in this list view. This function takes | 294 | * @p index doesn't exist in this list view. This function takes |
284 | * all items into account not only the visible ones. | 295 | * all items into account not only the visible ones. |
285 | */ | 296 | */ |
286 | QListViewItem* itemAtIndex(int index); | 297 | Q3ListViewItem* itemAtIndex(int index); |
287 | 298 | ||
288 | /** | 299 | /** |
289 | * @deprecated | 300 | * @deprecated |
290 | * @see #setFullWidth() | 301 | * @see #setFullWidth() |
291 | */ | 302 | */ |
292 | void setFullWidth(); | 303 | void setFullWidth(); |
293 | 304 | ||
294 | /** | 305 | /** |
295 | * Let the last column fit exactly all the available width. | 306 | * Let the last column fit exactly all the available width. |
296 | * | 307 | * |
297 | * @see #fullWidth() | 308 | * @see #fullWidth() |
298 | */ | 309 | */ |
299 | void setFullWidth(bool fullWidth); | 310 | void setFullWidth(bool fullWidth); |
300 | 311 | ||
301 | /** | 312 | /** |
302 | * Returns whether the last column is set to fit the available width. | 313 | * Returns whether the last column is set to fit the available width. |
303 | * | 314 | * |
304 | * @see #setFullWidth() | 315 | * @see #setFullWidth() |
305 | */ | 316 | */ |
306 | bool fullWidth() const; | 317 | bool fullWidth() const; |
307 | 318 | ||
308 | /** | 319 | /** |
309 | * Reimplemented for full width support | 320 | * Reimplemented for full width support |
310 | * | 321 | * |
311 | * @see #removeColumn() | 322 | * @see #removeColumn() |
312 | */ | 323 | */ |
313 | virtual int addColumn(const QString& label, int width = -1); | 324 | virtual int addColumn(const QString& label, int width = -1); |
314 | /** | 325 | /** |
315 | * Reimplemented for full width support | 326 | * Reimplemented for full width support |
316 | */ | 327 | */ |
317 | virtual int addColumn(const QIconSet& iconset, const QString& label, int width = -1); | 328 | virtual int addColumn(const QIcon& iconset, const QString& label, int width = -1); |
318 | /** | 329 | /** |
319 | * Reimplemented for full width support | 330 | * Reimplemented for full width support |
320 | * | 331 | * |
321 | * @see #addColumn() | 332 | * @see #addColumn() |
322 | */ | 333 | */ |
323 | virtual void removeColumn(int index); | 334 | virtual void removeColumn(int index); |
324 | 335 | ||
325 | /** | 336 | /** |
326 | * sets the alternate background background color. | 337 | * sets the alternate background background color. |
327 | * This only has an effect if the items are KListViewItems | 338 | * This only has an effect if the items are KListViewItems |
328 | * | 339 | * |
329 | * @param c the color to use for every other item. Set to an invalid | 340 | * @param c the color to use for every other item. Set to an invalid |
330 | * colour to disable alternate colours. | 341 | * colour to disable alternate colours. |
331 | * | 342 | * |
332 | * @see #alternateBackground() | 343 | * @see #alternateBackground() |
333 | **/ | 344 | **/ |
334 | void setAlternateBackground(const QColor &c); | 345 | void setAlternateBackground(const QColor &c); |
335 | /** | 346 | /** |
336 | * @return the alternate background color | 347 | * @return the alternate background color |
337 | * | 348 | * |
338 | * @see #setAlternateBackground() | 349 | * @see #setAlternateBackground() |
339 | */ | 350 | */ |
340 | const QColor &alternateBackground() const; | 351 | const QColor &alternateBackground() const; |
341 | 352 | ||
342 | /** | 353 | /** |
343 | * Saves the list view's layout (column widtsh, column order, sort column) | 354 | * Saves the list view's layout (column widtsh, column order, sort column) |
344 | * to a KConfig group | 355 | * to a KConfig group |
345 | * | 356 | * |
346 | * @param config the @ref KConfig object to write to | 357 | * @param config the @ref KConfig object to write to |
347 | * @param group the config group to use | 358 | * @param group the config group to use |
348 | */ | 359 | */ |
349 | void saveLayout(KConfig *config, const QString &group) const; | 360 | void saveLayout(KConfig *config, const QString &group) const; |
@@ -359,230 +370,230 @@ public: | |||
359 | * Reimplemented to remember the current sort column and order. | 370 | * Reimplemented to remember the current sort column and order. |
360 | * @param column is the column to be sorted, or -1 to sort in order of | 371 | * @param column is the column to be sorted, or -1 to sort in order of |
361 | * insertion | 372 | * insertion |
362 | * @param whether to sort ascending (or descending) | 373 | * @param whether to sort ascending (or descending) |
363 | */ | 374 | */ |
364 | virtual void setSorting(int column, bool ascending = true); | 375 | virtual void setSorting(int column, bool ascending = true); |
365 | 376 | ||
366 | /** | 377 | /** |
367 | * @return the currently sorted column, or -1 if none is sorted | 378 | * @return the currently sorted column, or -1 if none is sorted |
368 | */ | 379 | */ |
369 | int columnSorted(void) const; | 380 | int columnSorted(void) const; |
370 | 381 | ||
371 | /** | 382 | /** |
372 | * @return whether the current sort is ascending (or descending) | 383 | * @return whether the current sort is ascending (or descending) |
373 | */ | 384 | */ |
374 | bool ascendingSort(void) const; | 385 | bool ascendingSort(void) const; |
375 | 386 | ||
376 | //US we do not have a "global KDE" variable to setup singleClick functionality | 387 | //US we do not have a "global KDE" variable to setup singleClick functionality |
377 | void setSingleClick(bool s); | 388 | void setSingleClick(bool s); |
378 | 389 | ||
379 | 390 | ||
380 | signals: | 391 | signals: |
381 | 392 | ||
382 | /** | 393 | /** |
383 | * This signal is emitted whenever the user executes an listview item. | 394 | * This signal is emitted whenever the user executes an listview item. |
384 | * That means depending on the KDE wide Single Click/Double Click | 395 | * That means depending on the KDE wide Single Click/Double Click |
385 | * setting the user clicked or double clicked on that item. | 396 | * setting the user clicked or double clicked on that item. |
386 | * @param item is the pointer to the executed listview item. | 397 | * @param item is the pointer to the executed listview item. |
387 | * | 398 | * |
388 | * Note that you may not delete any @ref QListViewItem objects in slots | 399 | * Note that you may not delete any @ref QListViewItem objects in slots |
389 | * connected to this signal. | 400 | * connected to this signal. |
390 | */ | 401 | */ |
391 | void executed( QListViewItem *item ); | 402 | void executed( Q3ListViewItem *item ); |
392 | 403 | ||
393 | /** | 404 | /** |
394 | * This signal is emitted whenever the user executes an listview item. | 405 | * This signal is emitted whenever the user executes an listview item. |
395 | * That means depending on the KDE wide Single Click/Double Click | 406 | * That means depending on the KDE wide Single Click/Double Click |
396 | * setting the user clicked or double clicked on that item. | 407 | * setting the user clicked or double clicked on that item. |
397 | * @param item is the pointer to the executed listview item. | 408 | * @param item is the pointer to the executed listview item. |
398 | * @param pos is the position where the user has clicked | 409 | * @param pos is the position where the user has clicked |
399 | * @param c is the column into which the user clicked. | 410 | * @param c is the column into which the user clicked. |
400 | * | 411 | * |
401 | * Note that you may not delete any @ref QListViewItem objects in slots | 412 | * Note that you may not delete any @ref QListViewItem objects in slots |
402 | * connected to this signal. | 413 | * connected to this signal. |
403 | */ | 414 | */ |
404 | void executed( QListViewItem *item, const QPoint &pos, int c ); | 415 | void executed( Q3ListViewItem *item, const QPoint &pos, int c ); |
405 | 416 | ||
406 | /** | 417 | /** |
407 | * This signal gets emitted whenever the user double clicks into the | 418 | * This signal gets emitted whenever the user double clicks into the |
408 | * listview. | 419 | * listview. |
409 | * @param item is the pointer to the clicked listview item. | 420 | * @param item is the pointer to the clicked listview item. |
410 | * @param pos is the position where the user has clicked, and | 421 | * @param pos is the position where the user has clicked, and |
411 | * @param c is the column into which the user clicked. | 422 | * @param c is the column into which the user clicked. |
412 | * | 423 | * |
413 | * Note that you may not delete any @ref QListViewItem objects in slots | 424 | * Note that you may not delete any @ref QListViewItem objects in slots |
414 | * connected to this signal. | 425 | * connected to this signal. |
415 | * | 426 | * |
416 | * This signal is more or less here for the sake of completeness. | 427 | * This signal is more or less here for the sake of completeness. |
417 | * You should normally not need to use this. In most cases its better | 428 | * You should normally not need to use this. In most cases its better |
418 | * to use @ref #executed() instead. | 429 | * to use @ref #executed() instead. |
419 | */ | 430 | */ |
420 | void doubleClicked( QListViewItem *item, const QPoint &pos, int c ); | 431 | void doubleClicked( Q3ListViewItem *item, const QPoint &pos, int c ); |
421 | void contextRequest( QListViewItem *item, const QPoint &pos, int c ); | 432 | void contextRequest( Q3ListViewItem *item, const QPoint &pos, int c ); |
422 | 433 | ||
423 | /** | 434 | /** |
424 | * This signal gets emitted whenever something acceptable is | 435 | * This signal gets emitted whenever something acceptable is |
425 | * dropped onto the listview. | 436 | * dropped onto the listview. |
426 | * | 437 | * |
427 | * @param e is the drop event itself (it has already been accepted) | 438 | * @param e is the drop event itself (it has already been accepted) |
428 | * @param after is the item after which the drop occured (or 0L, if | 439 | * @param after is the item after which the drop occured (or 0L, if |
429 | * the drop was above all items) | 440 | * the drop was above all items) |
430 | * | 441 | * |
431 | * @see #acceptDrop() | 442 | * @see #acceptDrop() |
432 | */ | 443 | */ |
433 | void dropped (QDropEvent * e, QListViewItem *after); | 444 | void dropped (QDropEvent * e, Q3ListViewItem *after); |
434 | 445 | ||
435 | /** | 446 | /** |
436 | * This signal gets emitted whenever something acceptable is | 447 | * This signal gets emitted whenever something acceptable is |
437 | * dropped onto the listview. | 448 | * dropped onto the listview. |
438 | * | 449 | * |
439 | * This is an overloaded version of the above (provided to simplify | 450 | * This is an overloaded version of the above (provided to simplify |
440 | * processing drops outside of the class). | 451 | * processing drops outside of the class). |
441 | * | 452 | * |
442 | * @param list is the listview | 453 | * @param list is the listview |
443 | * @param e is the drop event itself (it has already been accepted) | 454 | * @param e is the drop event itself (it has already been accepted) |
444 | * @param after is the item after which the drop occured (or 0L, if | 455 | * @param after is the item after which the drop occured (or 0L, if |
445 | * the drop was above all items | 456 | * the drop was above all items |
446 | */ | 457 | */ |
447 | void dropped (KListView* list, QDropEvent* e, QListViewItem* after); | 458 | void dropped (KListView* list, QDropEvent* e, Q3ListViewItem* after); |
448 | 459 | ||
449 | /** | 460 | /** |
450 | * This signal gets emitted whenever something acceptable is | 461 | * This signal gets emitted whenever something acceptable is |
451 | * dropped onto the listview. | 462 | * dropped onto the listview. |
452 | * | 463 | * |
453 | * This function also provides a parent, in the event that your listview | 464 | * This function also provides a parent, in the event that your listview |
454 | * is a tree | 465 | * is a tree |
455 | * @param list is the listview | 466 | * @param list is the listview |
456 | * @param e is the drop event itself (it has already been accepted) | 467 | * @param e is the drop event itself (it has already been accepted) |
457 | * @param parent the item that is to be the parent of the new item | 468 | * @param parent the item that is to be the parent of the new item |
458 | * @param after is the item after which the drop occured (or 0L, if | 469 | * @param after is the item after which the drop occured (or 0L, if |
459 | * the drop was above all items | 470 | * the drop was above all items |
460 | */ | 471 | */ |
461 | void dropped (KListView* list, QDropEvent* e, QListViewItem* parent, QListViewItem* after); | 472 | void dropped (KListView* list, QDropEvent* e, Q3ListViewItem* parent, Q3ListViewItem* after); |
462 | 473 | ||
463 | /** | 474 | /** |
464 | * This signal gets emitted whenever something acceptable is | 475 | * This signal gets emitted whenever something acceptable is |
465 | * dropped onto the listview. | 476 | * dropped onto the listview. |
466 | * | 477 | * |
467 | * This function also provides a parent, in the event that your listview | 478 | * This function also provides a parent, in the event that your listview |
468 | * is a tree | 479 | * is a tree |
469 | * @param e is the drop event itself (it has already been accepted) | 480 | * @param e is the drop event itself (it has already been accepted) |
470 | * @param parent the item that is to be the parent of the new item | 481 | * @param parent the item that is to be the parent of the new item |
471 | * @param after is the item after which the drop occured (or 0L, if | 482 | * @param after is the item after which the drop occured (or 0L, if |
472 | * the drop was above all items | 483 | * the drop was above all items |
473 | */ | 484 | */ |
474 | void dropped (QDropEvent* e, QListViewItem* parent, QListViewItem* after); | 485 | void dropped (QDropEvent* e, Q3ListViewItem* parent, Q3ListViewItem* after); |
475 | 486 | ||
476 | /** | 487 | /** |
477 | * This signal is emitted when ever the user moves an item in the list via | 488 | * This signal is emitted when ever the user moves an item in the list via |
478 | * DnD. | 489 | * DnD. |
479 | * If more than one item is moved at the same time, this signal is only emitted | 490 | * If more than one item is moved at the same time, this signal is only emitted |
480 | * once. | 491 | * once. |
481 | */ | 492 | */ |
482 | void moved(); | 493 | void moved(); |
483 | 494 | ||
484 | /** | 495 | /** |
485 | * Connect to this signal if you want to do some preprocessing before | 496 | * Connect to this signal if you want to do some preprocessing before |
486 | * a move is made, for example, to disable sorting | 497 | * a move is made, for example, to disable sorting |
487 | * | 498 | * |
488 | * This is sent only once per each groups of moves. That is, for each | 499 | * This is sent only once per each groups of moves. That is, for each |
489 | * drop that is a move this will be emitted once, before KListView calls | 500 | * drop that is a move this will be emitted once, before KListView calls |
490 | * @see moveItem() | 501 | * @see moveItem() |
491 | */ | 502 | */ |
492 | void aboutToMove(); | 503 | void aboutToMove(); |
493 | 504 | ||
494 | /** | 505 | /** |
495 | * This signal is emitted when ever the user moves an item in the list via | 506 | * This signal is emitted when ever the user moves an item in the list via |
496 | * DnD. | 507 | * DnD. |
497 | * If more than one item is moved at the same time, @p afterFirst and | 508 | * If more than one item is moved at the same time, @p afterFirst and |
498 | * @p afterNow will reflect what was true before the move. | 509 | * @p afterNow will reflect what was true before the move. |
499 | * This differs from @ref moved(), so be careful. All the items will have been | 510 | * This differs from @ref moved(), so be careful. All the items will have been |
500 | * moved before @ref moved() is emitted, which is not true in this method. // FIXME | 511 | * moved before @ref moved() is emitted, which is not true in this method. // FIXME |
501 | * @param item the item that was moved | 512 | * @param item the item that was moved |
502 | * @param afterFirst the item that parameter item was in before the move, in the list | 513 | * @param afterFirst the item that parameter item was in before the move, in the list |
503 | * @param afterNow the item it's currently after. | 514 | * @param afterNow the item it's currently after. |
504 | */ | 515 | */ |
505 | void moved (QListViewItem *item, QListViewItem *afterFirst, QListViewItem *afterNow); | 516 | void moved (Q3ListViewItem *item, Q3ListViewItem *afterFirst, Q3ListViewItem *afterNow); |
506 | 517 | ||
507 | 518 | ||
508 | /** | 519 | /** |
509 | * This signal is emitted after all the items have been moved. It reports info for | 520 | * This signal is emitted after all the items have been moved. It reports info for |
510 | * each and every item moved, in order. The first element in @p items associates | 521 | * each and every item moved, in order. The first element in @p items associates |
511 | * with the first of afterFirst and afterNow. | 522 | * with the first of afterFirst and afterNow. |
512 | */ | 523 | */ |
513 | void moved(QPtrList<QListViewItem> &items, QPtrList<QListViewItem> &afterFirst, QPtrList<QListViewItem> &afterNow); | 524 | void moved(Q3PtrList<Q3ListViewItem> &items, Q3PtrList<Q3ListViewItem> &afterFirst, Q3PtrList<Q3ListViewItem> &afterNow); |
514 | 525 | ||
515 | /** | 526 | /** |
516 | * This signal gets emitted when an item is renamed via in-place renaming. | 527 | * This signal gets emitted when an item is renamed via in-place renaming. |
517 | * | 528 | * |
518 | * @param item is the renamed item. | 529 | * @param item is the renamed item. |
519 | * @param str is the new value of column @p col. | 530 | * @param str is the new value of column @p col. |
520 | * @param col is the renamed column. | 531 | * @param col is the renamed column. |
521 | */ | 532 | */ |
522 | void itemRenamed(QListViewItem* item, const QString &str, int col); | 533 | void itemRenamed(Q3ListViewItem* item, const QString &str, int col); |
523 | 534 | ||
524 | /** | 535 | /** |
525 | * Same as above, but without the extra information. | 536 | * Same as above, but without the extra information. |
526 | */ | 537 | */ |
527 | void itemRenamed(QListViewItem* item); | 538 | void itemRenamed(Q3ListViewItem* item); |
528 | void signalDelete(); | 539 | void signalDelete(); |
529 | 540 | ||
530 | /** | 541 | /** |
531 | * This signal is emitted when the shortcut key for popup-menus is pressed. | 542 | * This signal is emitted when the shortcut key for popup-menus is pressed. |
532 | * | 543 | * |
533 | * Normally you should not use this, just connect a slot to signal | 544 | * Normally you should not use this, just connect a slot to signal |
534 | * @ref contextMenu (KListView*, QListViewItem*, const QPoint&) to correctly | 545 | * @ref contextMenu (KListView*, QListViewItem*, const QPoint&) to correctly |
535 | * handle showing context menus regardless of settings. | 546 | * handle showing context menus regardless of settings. |
536 | * | 547 | * |
537 | * @param list is this listview. | 548 | * @param list is this listview. |
538 | * @param item is the @ref currentItem() at the time the key was pressed. May be 0L. | 549 | * @param item is the @ref currentItem() at the time the key was pressed. May be 0L. |
539 | */ | 550 | */ |
540 | void menuShortCutPressed (KListView* list, QListViewItem* item); | 551 | void menuShortCutPressed (KListView* list, Q3ListViewItem* item); |
541 | 552 | ||
542 | /** | 553 | /** |
543 | * This signal is emitted whenever a context-menu should be shown for item @p i. | 554 | * This signal is emitted whenever a context-menu should be shown for item @p i. |
544 | * It automatically adjusts for all settings involved (Menu key, showMenuOnPress/Click). | 555 | * It automatically adjusts for all settings involved (Menu key, showMenuOnPress/Click). |
545 | * | 556 | * |
546 | * @param l is this listview. | 557 | * @param l is this listview. |
547 | * @param i is the item for which the menu should be shown. May be 0L. | 558 | * @param i is the item for which the menu should be shown. May be 0L. |
548 | * @param p is the point at which the menu should be shown. | 559 | * @param p is the point at which the menu should be shown. |
549 | */ | 560 | */ |
550 | void contextMenu (KListView* l, QListViewItem* i, const QPoint& p); | 561 | void contextMenu (KListView* l, Q3ListViewItem* i, const QPoint& p); |
551 | 562 | ||
552 | public slots: | 563 | public slots: |
553 | /** | 564 | /** |
554 | * Rename column @p c of @p item. | 565 | * Rename column @p c of @p item. |
555 | */ | 566 | */ |
556 | virtual void rename(QListViewItem *item, int c); | 567 | virtual void rename(Q3ListViewItem *item, int c); |
557 | 568 | ||
558 | /** | 569 | /** |
559 | * By default, if you called setItemsRenameable(true), | 570 | * By default, if you called setItemsRenameable(true), |
560 | * only the first column is renameable. | 571 | * only the first column is renameable. |
561 | * Use this function to enable the feature on other columns. | 572 | * Use this function to enable the feature on other columns. |
562 | * | 573 | * |
563 | * If you want more intelligent (dynamic) selection, | 574 | * If you want more intelligent (dynamic) selection, |
564 | * you'll have to derive from KListView, | 575 | * you'll have to derive from KListView, |
565 | * and override @ref rename() and call only call it | 576 | * and override @ref rename() and call only call it |
566 | * if you want the item to be renamed. | 577 | * if you want the item to be renamed. |
567 | */ | 578 | */ |
568 | void setRenameable (int column, bool yesno=true); | 579 | void setRenameable (int column, bool yesno=true); |
569 | 580 | ||
570 | /** | 581 | /** |
571 | * Set whether items in the list view can be moved. | 582 | * Set whether items in the list view can be moved. |
572 | * It is enabled by default. | 583 | * It is enabled by default. |
573 | * | 584 | * |
574 | * @see itemsMovable() | 585 | * @see itemsMovable() |
575 | */ | 586 | */ |
576 | virtual void setItemsMovable(bool b); | 587 | virtual void setItemsMovable(bool b); |
577 | 588 | ||
578 | /** | 589 | /** |
579 | * Enables inplace-renaming of items. | 590 | * Enables inplace-renaming of items. |
580 | * It is disabled by default. | 591 | * It is disabled by default. |
581 | * | 592 | * |
582 | * @see itemsRenameable() | 593 | * @see itemsRenameable() |
583 | * @see setRenameable() | 594 | * @see setRenameable() |
584 | */ | 595 | */ |
585 | virtual void setItemsRenameable(bool b); | 596 | virtual void setItemsRenameable(bool b); |
586 | 597 | ||
587 | /** | 598 | /** |
588 | * Enable/Disable the dragging of items. | 599 | * Enable/Disable the dragging of items. |
@@ -644,118 +655,118 @@ public slots: | |||
644 | */ | 655 | */ |
645 | void setTabOrderedRenaming(bool b); | 656 | void setTabOrderedRenaming(bool b); |
646 | 657 | ||
647 | /** | 658 | /** |
648 | * Returns whether tab ordered renaming is enabled | 659 | * Returns whether tab ordered renaming is enabled |
649 | * @since 3.1 | 660 | * @since 3.1 |
650 | */ | 661 | */ |
651 | bool tabOrderedRenaming() const; | 662 | bool tabOrderedRenaming() const; |
652 | 663 | ||
653 | protected: | 664 | protected: |
654 | /** | 665 | /** |
655 | * Determine whether a drop on position @p p would count as | 666 | * Determine whether a drop on position @p p would count as |
656 | * being above or below the QRect @p rect. | 667 | * being above or below the QRect @p rect. |
657 | * | 668 | * |
658 | * @param rect is the rectangle we examine. | 669 | * @param rect is the rectangle we examine. |
659 | * @param p is the point located in the rectangle, p is assumed to be in | 670 | * @param p is the point located in the rectangle, p is assumed to be in |
660 | * viewport coordinates. | 671 | * viewport coordinates. |
661 | */ | 672 | */ |
662 | inline bool below (const QRect& rect, const QPoint& p) | 673 | inline bool below (const QRect& rect, const QPoint& p) |
663 | { | 674 | { |
664 | return (p.y() > (rect.top() + (rect.bottom() - rect.top())/2)); | 675 | return (p.y() > (rect.top() + (rect.bottom() - rect.top())/2)); |
665 | } | 676 | } |
666 | 677 | ||
667 | /** | 678 | /** |
668 | * An overloaded version of below(const QRect&, const QPoint&). | 679 | * An overloaded version of below(const QRect&, const QPoint&). |
669 | * | 680 | * |
670 | * It differs from the above only in what arguments it takes. | 681 | * It differs from the above only in what arguments it takes. |
671 | * | 682 | * |
672 | * @param i the item whose rect() is passed to the above function. | 683 | * @param i the item whose rect() is passed to the above function. |
673 | * @param p is translated from contents coordinates to viewport coordinates | 684 | * @param p is translated from contents coordinates to viewport coordinates |
674 | * before being passed to the above function. | 685 | * before being passed to the above function. |
675 | */ | 686 | */ |
676 | inline bool below (QListViewItem* i, const QPoint& p) | 687 | inline bool below (Q3ListViewItem* i, const QPoint& p) |
677 | { | 688 | { |
678 | return below (itemRect(i), contentsToViewport(p)); | 689 | return below (itemRect(i), contentsToViewport(p)); |
679 | } | 690 | } |
680 | 691 | ||
681 | /** | 692 | /** |
682 | * Reimplemented to reload the alternate background in palette changes. | 693 | * Reimplemented to reload the alternate background in palette changes. |
683 | * @internal | 694 | * @internal |
684 | */ | 695 | */ |
685 | virtual bool event( QEvent * ); | 696 | virtual bool event( QEvent * ); |
686 | 697 | ||
687 | /** | 698 | /** |
688 | * Emit signal @ref #executed. | 699 | * Emit signal @ref #executed. |
689 | * @internal | 700 | * @internal |
690 | */ | 701 | */ |
691 | //US I added buttonstate to pass the current keyboard status | 702 | //US I added buttonstate to pass the current keyboard status |
692 | void emitExecute( int buttonstate, QListViewItem *item, const QPoint &pos, int c); | 703 | void emitExecute( int buttonstate, Q3ListViewItem *item, const QPoint &pos, int c); |
693 | 704 | ||
694 | /** | 705 | /** |
695 | * Reimplemented for internal reasons. | 706 | * Reimplemented for internal reasons. |
696 | * Further reimplementations should call this function or else | 707 | * Further reimplementations should call this function or else |
697 | * some features may not work correctly. | 708 | * some features may not work correctly. |
698 | * | 709 | * |
699 | * The API is unaffected. | 710 | * The API is unaffected. |
700 | */ | 711 | */ |
701 | virtual void focusInEvent(QFocusEvent* fe); | 712 | virtual void focusInEvent(QFocusEvent* fe); |
702 | 713 | ||
703 | /** | 714 | /** |
704 | * Reimplemented for internal reasons. | 715 | * Reimplemented for internal reasons. |
705 | * Further reimplementations should call this function or else | 716 | * Further reimplementations should call this function or else |
706 | * some features may not work correctly. | 717 | * some features may not work correctly. |
707 | * | 718 | * |
708 | * The API is unaffected. | 719 | * The API is unaffected. |
709 | */ | 720 | */ |
710 | virtual void focusOutEvent( QFocusEvent *fe ); | 721 | virtual void focusOutEvent( QFocusEvent *fe ); |
711 | 722 | ||
712 | /** | 723 | /** |
713 | * Reimplemented for internal reasons. | 724 | * Reimplemented for internal reasons. |
714 | * Further reimplementations should call this function or else | 725 | * Further reimplementations should call this function or else |
715 | * some features may not work correctly. | 726 | * some features may not work correctly. |
716 | * | 727 | * |
717 | * The API is unaffected. | 728 | * The API is unaffected. |
718 | */ | 729 | */ |
719 | virtual void leaveEvent( QEvent *e ); | 730 | virtual void leaveEvent( QEvent *e ); |
720 | 731 | ||
721 | /** | 732 | /** |
722 | * @return the tooltip for @p column of @p item. | 733 | * @return the tooltip for @p column of @p item. |
723 | */ | 734 | */ |
724 | virtual QString tooltip(QListViewItem* item, int column) const; | 735 | virtual QString tooltip(Q3ListViewItem* item, int column) const; |
725 | 736 | ||
726 | /** | 737 | /** |
727 | * @return whether the tooltip for @p column of @p item shall be shown at point @p pos. | 738 | * @return whether the tooltip for @p column of @p item shall be shown at point @p pos. |
728 | */ | 739 | */ |
729 | virtual bool showTooltip(QListViewItem *item, const QPoint &pos, int column) const; | 740 | virtual bool showTooltip(Q3ListViewItem *item, const QPoint &pos, int column) const; |
730 | 741 | ||
731 | /** | 742 | /** |
732 | * Reimplemented for internal reasons. | 743 | * Reimplemented for internal reasons. |
733 | * Further reimplementations should call this function or else | 744 | * Further reimplementations should call this function or else |
734 | * some features may not work correctly. | 745 | * some features may not work correctly. |
735 | * | 746 | * |
736 | * The API is unaffected. | 747 | * The API is unaffected. |
737 | */ | 748 | */ |
738 | virtual void contentsDragMoveEvent (QDragMoveEvent *event); | 749 | virtual void contentsDragMoveEvent (QDragMoveEvent *event); |
739 | 750 | ||
740 | /** | 751 | /** |
741 | * Reimplemented for internal reasons. | 752 | * Reimplemented for internal reasons. |
742 | * Further reimplementations should call this function or else | 753 | * Further reimplementations should call this function or else |
743 | * some features may not work correctly. | 754 | * some features may not work correctly. |
744 | * | 755 | * |
745 | * The API is unaffected. | 756 | * The API is unaffected. |
746 | */ | 757 | */ |
747 | virtual void contentsMousePressEvent( QMouseEvent *e ); | 758 | virtual void contentsMousePressEvent( QMouseEvent *e ); |
748 | 759 | ||
749 | /** | 760 | /** |
750 | * Reimplemented for internal reasons. | 761 | * Reimplemented for internal reasons. |
751 | * Further reimplementations should call this function or else | 762 | * Further reimplementations should call this function or else |
752 | * some features may not work correctly. | 763 | * some features may not work correctly. |
753 | * | 764 | * |
754 | * The API is unaffected. | 765 | * The API is unaffected. |
755 | */ | 766 | */ |
756 | virtual void contentsMouseMoveEvent( QMouseEvent *e ); | 767 | virtual void contentsMouseMoveEvent( QMouseEvent *e ); |
757 | 768 | ||
758 | /** | 769 | /** |
759 | * Reimplemented for internal reasons. | 770 | * Reimplemented for internal reasons. |
760 | * Further reimplementations should call this function or else | 771 | * Further reimplementations should call this function or else |
761 | * some features may not work correctly. | 772 | * some features may not work correctly. |
@@ -776,265 +787,265 @@ protected: | |||
776 | /** | 787 | /** |
777 | * Reimplemented for internal reasons. | 788 | * Reimplemented for internal reasons. |
778 | * Further reimplementations should call this function or else | 789 | * Further reimplementations should call this function or else |
779 | * some features may not work correctly. | 790 | * some features may not work correctly. |
780 | * | 791 | * |
781 | * The API is unaffected. | 792 | * The API is unaffected. |
782 | */ | 793 | */ |
783 | virtual void contentsMouseReleaseEvent (QMouseEvent*); | 794 | virtual void contentsMouseReleaseEvent (QMouseEvent*); |
784 | 795 | ||
785 | /** | 796 | /** |
786 | * Reimplemented for internal reasons. | 797 | * Reimplemented for internal reasons. |
787 | * Further reimplementations should call this function or else | 798 | * Further reimplementations should call this function or else |
788 | * some features may not work correctly. | 799 | * some features may not work correctly. |
789 | * | 800 | * |
790 | * The API is unaffected. | 801 | * The API is unaffected. |
791 | */ | 802 | */ |
792 | virtual void contentsDropEvent (QDropEvent*); | 803 | virtual void contentsDropEvent (QDropEvent*); |
793 | 804 | ||
794 | /** | 805 | /** |
795 | * Reimplemented for internal reasons. | 806 | * Reimplemented for internal reasons. |
796 | * Further reimplementations should call this function or else | 807 | * Further reimplementations should call this function or else |
797 | * some features may not work correctly. | 808 | * some features may not work correctly. |
798 | * | 809 | * |
799 | * The API is unaffected. | 810 | * The API is unaffected. |
800 | */ | 811 | */ |
801 | virtual void contentsDragEnterEvent (QDragEnterEvent *); | 812 | virtual void contentsDragEnterEvent (QDragEnterEvent *); |
802 | 813 | ||
803 | /** | 814 | /** |
804 | * @return a dragobject encoding the current selection. | 815 | * @return a dragobject encoding the current selection. |
805 | * | 816 | * |
806 | * @see setDragEnabled() | 817 | * @see setDragEnabled() |
807 | */ | 818 | */ |
808 | virtual QDragObject *dragObject(); | 819 | virtual Q3DragObject *dragObject(); |
809 | 820 | ||
810 | /** | 821 | /** |
811 | * @return true if the @p event provides some acceptable | 822 | * @return true if the @p event provides some acceptable |
812 | * format. | 823 | * format. |
813 | * A common mistake is to forget the "const" in your reimplementation | 824 | * A common mistake is to forget the "const" in your reimplementation |
814 | */ | 825 | */ |
815 | virtual bool acceptDrag (QDropEvent* event) const; | 826 | virtual bool acceptDrag (QDropEvent* event) const; |
816 | 827 | ||
817 | /** | 828 | /** |
818 | * Paint the drag line. If painter is null, don't try to :) | 829 | * Paint the drag line. If painter is null, don't try to :) |
819 | * | 830 | * |
820 | * If after == 0 then the marker should be drawn at the top. | 831 | * If after == 0 then the marker should be drawn at the top. |
821 | * | 832 | * |
822 | * @return the rectangle that you painted to. | 833 | * @return the rectangle that you painted to. |
823 | */ | 834 | */ |
824 | virtual QRect drawDropVisualizer (QPainter *p, QListViewItem *parent, QListViewItem *after); | 835 | virtual QRect drawDropVisualizer (QPainter *p, Q3ListViewItem *parent, Q3ListViewItem *after); |
825 | 836 | ||
826 | /** | 837 | /** |
827 | * Paint the drag rectangle. If painter is null, don't try to :) | 838 | * Paint the drag rectangle. If painter is null, don't try to :) |
828 | * | 839 | * |
829 | * | 840 | * |
830 | * @return the rectangle that you painted to. | 841 | * @return the rectangle that you painted to. |
831 | */ | 842 | */ |
832 | virtual QRect drawItemHighlighter(QPainter *painter, QListViewItem *item); | 843 | virtual QRect drawItemHighlighter(QPainter *painter, Q3ListViewItem *item); |
833 | 844 | ||
834 | /** | 845 | /** |
835 | * This method calls @ref dragObject() and starts the drag. | 846 | * This method calls @ref dragObject() and starts the drag. |
836 | * | 847 | * |
837 | * Reimplement it to do fancy stuff like setting a pixmap or | 848 | * Reimplement it to do fancy stuff like setting a pixmap or |
838 | * using a non-default DragMode | 849 | * using a non-default DragMode |
839 | */ | 850 | */ |
840 | virtual void startDrag(); | 851 | virtual void startDrag(); |
841 | 852 | ||
842 | /** | 853 | /** |
843 | * Reimplemented for internal reasons. | 854 | * Reimplemented for internal reasons. |
844 | * Further reimplementations should call this function or else | 855 | * Further reimplementations should call this function or else |
845 | * some features may not work correctly. | 856 | * some features may not work correctly. |
846 | * | 857 | * |
847 | * The API is unaffected. | 858 | * The API is unaffected. |
848 | */ | 859 | */ |
849 | virtual void keyPressEvent (QKeyEvent*); | 860 | virtual void keyPressEvent (QKeyEvent*); |
850 | 861 | ||
851 | /** | 862 | /** |
852 | * Reimplemented for internal reasons. | 863 | * Reimplemented for internal reasons. |
853 | * Further reimplementations should call this function or else | 864 | * Further reimplementations should call this function or else |
854 | * some features may not work correctly. | 865 | * some features may not work correctly. |
855 | * | 866 | * |
856 | * The API is unaffected. | 867 | * The API is unaffected. |
857 | */ | 868 | */ |
858 | virtual void viewportPaintEvent(QPaintEvent*); | 869 | virtual void viewportPaintEvent(QPaintEvent*); |
859 | 870 | ||
860 | /** | 871 | /** |
861 | * In FileManager selection mode: explicitely activate the mode | 872 | * In FileManager selection mode: explicitely activate the mode |
862 | * in which the current item is automatically selected. | 873 | * in which the current item is automatically selected. |
863 | */ | 874 | */ |
864 | void activateAutomaticSelection(); | 875 | void activateAutomaticSelection(); |
865 | /** | 876 | /** |
866 | * In FileManager selection mode: explicitely deactivate the mode | 877 | * In FileManager selection mode: explicitely deactivate the mode |
867 | * in which the current item is automatically selected. | 878 | * in which the current item is automatically selected. |
868 | */ | 879 | */ |
869 | void deactivateAutomaticSelection(); | 880 | void deactivateAutomaticSelection(); |
870 | /** | 881 | /** |
871 | * In FileManager selection mode: return whether it is currently in the mode | 882 | * In FileManager selection mode: return whether it is currently in the mode |
872 | * where the current item is selected automatically. | 883 | * where the current item is selected automatically. |
873 | * Returns false if items were selected explicitely, e.g. using the mouse. | 884 | * Returns false if items were selected explicitely, e.g. using the mouse. |
874 | */ | 885 | */ |
875 | bool automaticSelection() const; | 886 | bool automaticSelection() const; |
876 | 887 | ||
877 | /** | 888 | /** |
878 | * Reimplemented for setFullWidth() | 889 | * Reimplemented for setFullWidth() |
879 | */ | 890 | */ |
880 | virtual void viewportResizeEvent(QResizeEvent* e); | 891 | virtual void viewportResizeEvent(QResizeEvent* e); |
881 | 892 | ||
882 | protected slots: | 893 | protected slots: |
883 | /** | 894 | /** |
884 | * Update internal settings whenever the global ones change. | 895 | * Update internal settings whenever the global ones change. |
885 | * @internal | 896 | * @internal |
886 | */ | 897 | */ |
887 | void slotSettingsChanged(int); | 898 | void slotSettingsChanged(int); |
888 | 899 | ||
889 | void slotMouseButtonClicked( int btn, QListViewItem *item, const QPoint &pos, int c ); | 900 | void slotMouseButtonClicked( int btn, Q3ListViewItem *item, const QPoint &pos, int c ); |
890 | void doneEditing(QListViewItem *item, int row); | 901 | void doneEditing(Q3ListViewItem *item, int row); |
891 | 902 | ||
892 | /** | 903 | /** |
893 | * Repaint the rect where I was drawing the drop line. | 904 | * Repaint the rect where I was drawing the drop line. |
894 | */ | 905 | */ |
895 | void cleanDropVisualizer(); | 906 | void cleanDropVisualizer(); |
896 | 907 | ||
897 | /** | 908 | /** |
898 | * Repaint the rect where I was drawing the drop rectangle. | 909 | * Repaint the rect where I was drawing the drop rectangle. |
899 | */ | 910 | */ |
900 | void cleanItemHighlighter(); | 911 | void cleanItemHighlighter(); |
901 | 912 | ||
902 | /** | 913 | /** |
903 | * Emit the @ref contextMenu signal. This slot is for mouse actions. | 914 | * Emit the @ref contextMenu signal. This slot is for mouse actions. |
904 | */ | 915 | */ |
905 | void emitContextMenu (QListViewItem*, const QPoint&, int); | 916 | void emitContextMenu (Q3ListViewItem*, const QPoint&, int); |
906 | 917 | ||
907 | /** | 918 | /** |
908 | * Emit the @ref #contextMenu signal. This slot is for key presses. | 919 | * Emit the @ref #contextMenu signal. This slot is for key presses. |
909 | */ | 920 | */ |
910 | void emitContextMenu (KListView*, QListViewItem*); | 921 | void emitContextMenu (KListView*, Q3ListViewItem*); |
911 | 922 | ||
912 | /** | 923 | /** |
913 | * Accessory slot for AutoSelect | 924 | * Accessory slot for AutoSelect |
914 | * @internal | 925 | * @internal |
915 | */ | 926 | */ |
916 | void slotOnItem( QListViewItem *item ); | 927 | void slotOnItem( Q3ListViewItem *item ); |
917 | 928 | ||
918 | /** | 929 | /** |
919 | * Accessory slot for AutoSelect/ChangeCursorOverItem | 930 | * Accessory slot for AutoSelect/ChangeCursorOverItem |
920 | * @internal | 931 | * @internal |
921 | */ | 932 | */ |
922 | void slotOnViewport(); | 933 | void slotOnViewport(); |
923 | 934 | ||
924 | /** | 935 | /** |
925 | * Process AutoSelection. | 936 | * Process AutoSelection. |
926 | * @internal | 937 | * @internal |
927 | */ | 938 | */ |
928 | void slotAutoSelect(); | 939 | void slotAutoSelect(); |
929 | 940 | ||
930 | void slotDragExpand(); | 941 | void slotDragExpand(); |
931 | 942 | ||
932 | /** | 943 | /** |
933 | * Reacts to header changes in full width mode | 944 | * Reacts to header changes in full width mode |
934 | * @internal | 945 | * @internal |
935 | */ | 946 | */ |
936 | void slotHeaderChanged(); | 947 | void slotHeaderChanged(); |
937 | 948 | ||
938 | protected: | 949 | protected: |
939 | /** | 950 | /** |
940 | * Handle dropEvent when itemsMovable() is set to true. | 951 | * Handle dropEvent when itemsMovable() is set to true. |
941 | */ | 952 | */ |
942 | virtual void movableDropEvent (QListViewItem* parent, QListViewItem* afterme); | 953 | virtual void movableDropEvent (Q3ListViewItem* parent, Q3ListViewItem* afterme); |
943 | 954 | ||
944 | /** | 955 | /** |
945 | * Where is the nearest QListViewItem that I'm going to drop? | 956 | * Where is the nearest QListViewItem that I'm going to drop? |
946 | * | 957 | * |
947 | * FIXME KDE 4.0: Make this method const so it can be called from an | 958 | * FIXME KDE 4.0: Make this method const so it can be called from an |
948 | * acceptDrag method without ugly casts | 959 | * acceptDrag method without ugly casts |
949 | */ | 960 | */ |
950 | virtual void findDrop(const QPoint &pos, QListViewItem *&parent, QListViewItem *&after); | 961 | virtual void findDrop(const QPoint &pos, Q3ListViewItem *&parent, Q3ListViewItem *&after); |
951 | 962 | ||
952 | /** | 963 | /** |
953 | * A special keyPressEvent (for FileManager selection mode). | 964 | * A special keyPressEvent (for FileManager selection mode). |
954 | */ | 965 | */ |
955 | void fileManagerKeyPressEvent (QKeyEvent*); | 966 | void fileManagerKeyPressEvent (QKeyEvent*); |
956 | 967 | ||
957 | /** | 968 | /** |
958 | * Convert the depth of an item into its indentation in pixels | 969 | * Convert the depth of an item into its indentation in pixels |
959 | */ | 970 | */ |
960 | int depthToPixels( int depth ); | 971 | int depthToPixels( int depth ); |
961 | 972 | ||
962 | private: | 973 | private: |
963 | class Tooltip; | 974 | class Tooltip; |
964 | protected: | 975 | protected: |
965 | virtual void virtual_hook( int id, void* data ); | 976 | virtual void virtual_hook( int id, void* data ); |
966 | private: | 977 | private: |
967 | class KListViewPrivate; | 978 | class KListViewPrivate; |
968 | KListViewPrivate *d; | 979 | KListViewPrivate *d; |
969 | }; | 980 | }; |
970 | 981 | ||
971 | /** | 982 | /** |
972 | * A listview item with support for alternate background colours. It is | 983 | * A listview item with support for alternate background colours. It is |
973 | * a drop-in replacement for @ref QListViewItem | 984 | * a drop-in replacement for @ref QListViewItem |
974 | * | 985 | * |
975 | * @short listview item with alternate background colour support | 986 | * @short listview item with alternate background colour support |
976 | */ | 987 | */ |
977 | class KListViewItem : public QListViewItem | 988 | class KListViewItem : public Q3ListViewItem |
978 | { | 989 | { |
979 | public: | 990 | public: |
980 | /** | 991 | /** |
981 | * constructors. The semantics remain as in @ref QListViewItem. | 992 | * constructors. The semantics remain as in @ref QListViewItem. |
982 | * Although they accept a @ref QListViewItem as parent, please | 993 | * Although they accept a @ref QListViewItem as parent, please |
983 | * don't mix KListViewItem (or subclasses) with QListViewItem | 994 | * don't mix KListViewItem (or subclasses) with QListViewItem |
984 | * (or subclasses). | 995 | * (or subclasses). |
985 | */ | 996 | */ |
986 | KListViewItem(QListView *parent); | 997 | KListViewItem(Q3ListView *parent); |
987 | KListViewItem(QListViewItem *parent); | 998 | KListViewItem(Q3ListViewItem *parent); |
988 | KListViewItem(QListView *parent, QListViewItem *after); | 999 | KListViewItem(Q3ListView *parent, Q3ListViewItem *after); |
989 | KListViewItem(QListViewItem *parent, QListViewItem *after); | 1000 | KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after); |
990 | 1001 | ||
991 | KListViewItem(QListView *parent, | 1002 | KListViewItem(Q3ListView *parent, |
992 | QString, QString = QString::null, | 1003 | QString, QString = QString::null, |
993 | QString = QString::null, QString = QString::null, | 1004 | QString = QString::null, QString = QString::null, |
994 | QString = QString::null, QString = QString::null, | 1005 | QString = QString::null, QString = QString::null, |
995 | QString = QString::null, QString = QString::null); | 1006 | QString = QString::null, QString = QString::null); |
996 | 1007 | ||
997 | KListViewItem(QListViewItem *parent, | 1008 | KListViewItem(Q3ListViewItem *parent, |
998 | QString, QString = QString::null, | 1009 | QString, QString = QString::null, |
999 | QString = QString::null, QString = QString::null, | 1010 | QString = QString::null, QString = QString::null, |
1000 | QString = QString::null, QString = QString::null, | 1011 | QString = QString::null, QString = QString::null, |
1001 | QString = QString::null, QString = QString::null); | 1012 | QString = QString::null, QString = QString::null); |
1002 | 1013 | ||
1003 | KListViewItem(QListView *parent, QListViewItem *after, | 1014 | KListViewItem(Q3ListView *parent, Q3ListViewItem *after, |
1004 | QString, QString = QString::null, | 1015 | QString, QString = QString::null, |
1005 | QString = QString::null, QString = QString::null, | 1016 | QString = QString::null, QString = QString::null, |
1006 | QString = QString::null, QString = QString::null, | 1017 | QString = QString::null, QString = QString::null, |
1007 | QString = QString::null, QString = QString::null); | 1018 | QString = QString::null, QString = QString::null); |
1008 | 1019 | ||
1009 | KListViewItem(QListViewItem *parent, QListViewItem *after, | 1020 | KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after, |
1010 | QString, QString = QString::null, | 1021 | QString, QString = QString::null, |
1011 | QString = QString::null, QString = QString::null, | 1022 | QString = QString::null, QString = QString::null, |
1012 | QString = QString::null, QString = QString::null, | 1023 | QString = QString::null, QString = QString::null, |
1013 | QString = QString::null, QString = QString::null); | 1024 | QString = QString::null, QString = QString::null); |
1014 | 1025 | ||
1015 | virtual ~KListViewItem(); | 1026 | virtual ~KListViewItem(); |
1016 | 1027 | ||
1017 | /** | 1028 | /** |
1018 | * retuns true if this item is to be drawn with the alternate background | 1029 | * retuns true if this item is to be drawn with the alternate background |
1019 | */ | 1030 | */ |
1020 | bool isAlternate(); | 1031 | bool isAlternate(); |
1021 | /** | 1032 | /** |
1022 | * returns the background colour for this item | 1033 | * returns the background colour for this item |
1023 | */ | 1034 | */ |
1024 | const QColor &backgroundColor(); | 1035 | const QColor &backgroundColor(); |
1025 | 1036 | ||
1026 | virtual void paintCell(QPainter *p, const QColorGroup &cg, | 1037 | virtual void paintCell(QPainter *p, const QColorGroup &cg, |
1027 | int column, int width, int alignment); | 1038 | int column, int width, int alignment); |
1028 | 1039 | ||
1029 | private: | 1040 | private: |
1030 | void init(); | 1041 | void init(); |
1031 | 1042 | ||
1032 | private: | 1043 | private: |
1033 | uint m_odd : 1; | 1044 | uint m_odd : 1; |
1034 | uint m_known : 1; | 1045 | uint m_known : 1; |
1035 | uint m_unused : 30; | 1046 | uint m_unused : 30; |
1036 | }; | 1047 | }; |
1037 | 1048 | ||
1038 | #endif | 1049 | #endif |
1039 | 1050 | ||
1040 | // vim: ts=2 sw=2 et | 1051 | // vim: ts=2 sw=2 et |