author | mickeyl <mickeyl> | 2003-03-28 15:11:52 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-03-28 15:11:52 (UTC) |
commit | 11304d02942e9fa493e4e80943a828f9c65f6772 (patch) (unidiff) | |
tree | a0223c10c067e1afc70d15c2b82be3f3c15e41ae /libopie2/opieui/oversatileview.cpp | |
parent | b271d575fa05cf570a1a829136517761bd47e69b (diff) | |
download | opie-11304d02942e9fa493e4e80943a828f9c65f6772.zip opie-11304d02942e9fa493e4e80943a828f9c65f6772.tar.gz opie-11304d02942e9fa493e4e80943a828f9c65f6772.tar.bz2 |
skeleton and the start of libopie2, please read README, ROADMAP and STATUS and comment...
Diffstat (limited to 'libopie2/opieui/oversatileview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opieui/oversatileview.cpp | 1179 |
1 files changed, 1179 insertions, 0 deletions
diff --git a/libopie2/opieui/oversatileview.cpp b/libopie2/opieui/oversatileview.cpp new file mode 100644 index 0000000..32855be --- a/dev/null +++ b/libopie2/opieui/oversatileview.cpp | |||
@@ -0,0 +1,1179 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | ||
5 | .=l. | ||
6 | .>+-= | ||
7 | _;:, .> :=|. This program is free software; you can | ||
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This program is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
27 | Boston, MA 02111-1307, USA. | ||
28 | |||
29 | */ | ||
30 | |||
31 | /* QT */ | ||
32 | |||
33 | #include <qaction.h> | ||
34 | #include <qbrush.h> | ||
35 | #include <qfont.h> | ||
36 | #include <qiconset.h> | ||
37 | #include <qiconview.h> | ||
38 | #include <qlistview.h> | ||
39 | #include <qpalette.h> | ||
40 | #include <qpoint.h> | ||
41 | #include <qpopupmenu.h> | ||
42 | #include <qrect.h> | ||
43 | #include <qsize.h> | ||
44 | #include <qstring.h> | ||
45 | #include <qwidgetstack.h> | ||
46 | |||
47 | /* OPIE */ | ||
48 | |||
49 | #include <opie2/oversatileview.h> | ||
50 | #include <opie2/oversatileviewitem.h> | ||
51 | #include <opie2/olistview.h> | ||
52 | |||
53 | /* XPM */ | ||
54 | static const char * view_icon_xpm[] = { | ||
55 | "16 16 16 1", | ||
56 | " c None", | ||
57 | ".c #87BD88", | ||
58 | "+c #8BBE8B", | ||
59 | "@c #81BA81", | ||
60 | "#c #6DAF6D", | ||
61 | "$c #87BD87", | ||
62 | "%c #FCFDFC", | ||
63 | "&c #AED0AE", | ||
64 | "*c #4E9C4C", | ||
65 | "=c #91BD91", | ||
66 | "-c #72B172", | ||
67 | ";c #448643", | ||
68 | ">c #519F50", | ||
69 | ",c #499247", | ||
70 | "'c #356A35", | ||
71 | ")c #686868", | ||
72 | " ", | ||
73 | " .+@# .+@# ", | ||
74 | " $%&* $%&* ", | ||
75 | " @=-; @=-; ", | ||
76 | " #>,' #>,' ", | ||
77 | " ", | ||
78 | " )))))) )))))) ", | ||
79 | " ", | ||
80 | " ", | ||
81 | " .+@# .+@# ", | ||
82 | " $%&* $%&* ", | ||
83 | " @=-; @=-; ", | ||
84 | " #>,' #>,' ", | ||
85 | " ", | ||
86 | " )))))) )))))) ", | ||
87 | " "}; | ||
88 | |||
89 | /* XPM */ | ||
90 | static const char * view_tree_xpm[] = { | ||
91 | "16 16 17 1", | ||
92 | " c None", | ||
93 | ".c #3A3A3A", | ||
94 | "+c #87BD88", | ||
95 | "@c #8BBE8B", | ||
96 | "#c #81BA81", | ||
97 | "$c #6DAF6D", | ||
98 | "%c #87BD87", | ||
99 | "&c #FCFDFC", | ||
100 | "*c #AED0AE", | ||
101 | "=c #4E9C4C", | ||
102 | "-c #91BD91", | ||
103 | ";c #72B172", | ||
104 | ">c #448643", | ||
105 | ",c #686868", | ||
106 | "'c #519F50", | ||
107 | ")c #499247", | ||
108 | "!c #356A35", | ||
109 | " . ", | ||
110 | " . ", | ||
111 | " . +@#$ ", | ||
112 | " . %&*= ", | ||
113 | " .. #-;> ,, ,,,", | ||
114 | " . $')! ", | ||
115 | " . ", | ||
116 | " . ", | ||
117 | " . ", | ||
118 | " . +@#$ ", | ||
119 | " . %&*= ", | ||
120 | " .. #-;> ,, ,,,", | ||
121 | " $')! ", | ||
122 | " ", | ||
123 | " ", | ||
124 | " "}; | ||
125 | |||
126 | OVersatileView::OVersatileView( QWidget* parent, const char* name, int mode ) | ||
127 | :QWidgetStack( parent, name ), | ||
128 | _viewmode( mode ), _warningpolicy( None ), | ||
129 | _treeleaf(), _treeopened(), _treeclosed(), | ||
130 | _iconleaf(), _iconopened(), _iconclosed() | ||
131 | { | ||
132 | // | ||
133 | // Create child widgets and set some reasonable default styles | ||
134 | // | ||
135 | |||
136 | _listview = new OListView( this, "oversatileview embedded listview" ); | ||
137 | _iconview = new QIconView( this, "oversatileview embedded iconview" ); | ||
138 | |||
139 | _listview->setAllColumnsShowFocus( true ); | ||
140 | _listview->setRootIsDecorated( true ); | ||
141 | _listview->setShowSortIndicator( true ); | ||
142 | _iconview->setGridX( 90 ); | ||
143 | _iconview->setGridY( 42 ); | ||
144 | _iconview->setAutoArrange( true ); | ||
145 | |||
146 | #ifdef QWS // TODO: Let this depend on current geometry (rotation) | ||
147 | _iconview->setArrangement( QIconView::TopToBottom ); | ||
148 | #else | ||
149 | _iconview->setArrangement( QIconView::LeftToRight ); | ||
150 | #endif | ||
151 | |||
152 | _iconview->setResizeMode( QIconView::Adjust ); | ||
153 | |||
154 | // qt-embedded: map stylus right on hold to right button press | ||
155 | |||
156 | #ifdef QWS | ||
157 | ( (QPEApplication*) qApp)->setStylusOperation( _iconview->viewport(), QPEApplication::RightOnHold ); | ||
158 | ( (QPEApplication*) qApp)->setStylusOperation( _listview->viewport(), QPEApplication::RightOnHold ); | ||
159 | #endif | ||
160 | |||
161 | setViewMode( mode ); // TODO: Read last style from config | ||
162 | // setSynchronization( true ); // TODO: Implement this | ||
163 | |||
164 | // create context menu allowing to switch between the views | ||
165 | |||
166 | _contextmenu = new QPopupMenu( 0, "oversatileview contextmenu" ); | ||
167 | _contextmenu->setCaption( "Style" ); | ||
168 | _contextmenu->setCheckable( true ); | ||
169 | QActionGroup* ag = new QActionGroup( _contextmenu, "style option group" ); | ||
170 | QAction* a1 = new QAction( "View Items in Icon Style", QIconSet( QPixmap( view_icon_xpm ) ), | ||
171 | "View Icons", 0, ag, "viewicon action", true ); | ||
172 | QAction* a2 = new QAction( "View Items in Tree Style", QIconSet( QPixmap( view_tree_xpm ) ), | ||
173 | "View Tree", 0, ag, "viewtree action", true ); | ||
174 | ag->addTo( _contextmenu ); | ||
175 | if ( mode == Icons ) | ||
176 | a1->setOn( true ); | ||
177 | else if ( mode == Tree ) | ||
178 | a2->setOn( true ); | ||
179 | connect( a1, SIGNAL( activated() ), this, SLOT( setIconViewMode() ) ); | ||
180 | connect( a2, SIGNAL( activated() ), this, SLOT( setTreeViewMode() ) ); | ||
181 | |||
182 | #if (QT_VERSION >= 0x030000) | ||
183 | connect( _listview, SIGNAL( contextMenuRequested( QListViewItem*, const QPoint&, int ) ), this, SLOT( contextMenuRequested( QListViewItem*, const QPoint&, int ) ) ); | ||
184 | connect( _iconview, SIGNAL( contextMenuRequested( QIconViewItem*, const QPoint& ) ), this, SLOT( contextMenuRequested( QIconViewItem*, const QPoint& ) ) ); | ||
185 | #else | ||
186 | connect( _listview, SIGNAL( rightButtonPressed( QListViewItem*, const QPoint&, int ) ), this, SLOT( contextMenuRequested( QListViewItem*, const QPoint&, int ) ) ); | ||
187 | connect( _iconview, SIGNAL( rightButtonPressed( QIconViewItem*, const QPoint& ) ), this, SLOT( contextMenuRequested( QIconViewItem*, const QPoint& ) ) ); | ||
188 | #endif | ||
189 | |||
190 | // | ||
191 | // signal forwarders | ||
192 | // | ||
193 | // unfortunately we can't short-circuit all the QListView and QIconView signals | ||
194 | // to OVersatileView signals, because the signal/slot mechanism doesn't allow | ||
195 | // type-conversion :-( | ||
196 | |||
197 | // common signals for listview | ||
198 | |||
199 | connect( _listview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); | ||
200 | connect( _listview, SIGNAL( selectionChanged( QListViewItem * ) ), this, SLOT( selectionChanged( QListViewItem * ) ) ); | ||
201 | connect( _listview, SIGNAL( currentChanged( QListViewItem * ) ), this, SLOT( currentChanged( QListViewItem * ) ) ); | ||
202 | connect( _listview, SIGNAL( clicked( QListViewItem * ) ), this, SLOT( clicked( QListViewItem * ) ) ); | ||
203 | connect( _listview, SIGNAL( pressed( QListViewItem * ) ), this, SLOT( pressed( QListViewItem * ) ) ); | ||
204 | |||
205 | connect( _listview, SIGNAL( doubleClicked( QListViewItem * ) ), this, SLOT( doubleClicked( QListViewItem * ) ) ); | ||
206 | connect( _listview, SIGNAL( returnPressed( QListViewItem * ) ), this, SLOT( returnPressed( QListViewItem * ) ) ); | ||
207 | |||
208 | connect( _listview, SIGNAL( onItem( QListViewItem * ) ), this, SLOT( onItem( QListViewItem * ) ) ); | ||
209 | connect( _listview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) ); | ||
210 | |||
211 | // common signals for iconview | ||
212 | |||
213 | connect( _iconview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); | ||
214 | connect( _iconview, SIGNAL( selectionChanged( QIconViewItem * ) ), this, SLOT( selectionChanged( QIconViewItem * ) ) ); | ||
215 | connect( _iconview, SIGNAL( currentChanged( QIconViewItem * ) ), this, SLOT( currentChanged( QIconViewItem * ) ) ); | ||
216 | connect( _iconview, SIGNAL( clicked( QIconViewItem * ) ), this, SLOT( clicked( QIconViewItem * ) ) ); | ||
217 | connect( _iconview, SIGNAL( pressed( QIconViewItem * ) ), this, SLOT( pressed( QIconViewItem * ) ) ); | ||
218 | |||
219 | connect( _iconview, SIGNAL( doubleClicked( QIconViewItem * ) ), this, SLOT( doubleClicked( QIconViewItem * ) ) ); | ||
220 | connect( _iconview, SIGNAL( returnPressed( QIconViewItem * ) ), this, SLOT( returnPressed( QIconViewItem * ) ) ); | ||
221 | |||
222 | connect( _iconview, SIGNAL( onItem( QIconViewItem * ) ), this, SLOT( onItem( QIconViewItem * ) ) ); | ||
223 | connect( _iconview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) ); | ||
224 | |||
225 | // listview only signals | ||
226 | |||
227 | connect( _listview, SIGNAL( expanded( QListViewItem * ) ), this, SLOT( expanded( QListViewItem * ) ) ); | ||
228 | connect( _listview, SIGNAL( collapsed( QListViewItem * ) ), this, SLOT( collapsed( QListViewItem * ) ) ); | ||
229 | |||
230 | // iconview only signals | ||
231 | |||
232 | connect( _iconview, SIGNAL( moved() ), this, SIGNAL( moved() ) ); | ||
233 | } | ||
234 | |||
235 | OVersatileView::~OVersatileView() | ||
236 | { | ||
237 | } | ||
238 | |||
239 | QPopupMenu* OVersatileView::contextMenu() const | ||
240 | { | ||
241 | return _contextmenu; | ||
242 | } | ||
243 | |||
244 | void OVersatileView::contextMenuRequested( QListViewItem* item, const QPoint& pos, int col ) | ||
245 | { | ||
246 | // can't use QObject::inherits here, because ListViewItems, beit Q, O or K, | ||
247 | // do not inherit from QObject - assuming here the programmer is | ||
248 | // disciplined enough to only add OVersatileViewItems to an OVersatileView | ||
249 | popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, col ); | ||
250 | } | ||
251 | |||
252 | void OVersatileView::contextMenuRequested( QIconViewItem* item, const QPoint& pos ) | ||
253 | { | ||
254 | // see above | ||
255 | popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, -1 ); | ||
256 | } | ||
257 | |||
258 | void OVersatileView::popupContextMenu( OVersatileViewItem* item, const QPoint& pos, int col ) | ||
259 | { | ||
260 | if ( not item ) | ||
261 | _contextmenu->exec( pos ); | ||
262 | else | ||
263 | emit( contextMenuRequested( item, pos, col ) ); | ||
264 | } | ||
265 | |||
266 | void OVersatileView::setSynchronization( bool sync ) | ||
267 | { | ||
268 | _synchronization = sync; | ||
269 | } | ||
270 | |||
271 | bool OVersatileView::synchronization() | ||
272 | { | ||
273 | return _synchronization; | ||
274 | } | ||
275 | |||
276 | void OVersatileView::setDefaultPixmaps( int mode, QPixmap& leaf, QPixmap& opened, QPixmap& closed ) | ||
277 | { | ||
278 | if ( mode == Tree ) | ||
279 | { | ||
280 | _treeleaf = leaf; | ||
281 | _treeopened = opened; | ||
282 | _treeclosed = closed; | ||
283 | } | ||
284 | else if ( mode == Icons ) | ||
285 | { | ||
286 | _iconleaf = leaf; | ||
287 | _iconopened = opened; | ||
288 | _iconclosed = closed; | ||
289 | } | ||
290 | else | ||
291 | { | ||
292 | qDebug( "OVersatileView::setDefaultPixmaps(): invalid mode" ); | ||
293 | } | ||
294 | } | ||
295 | |||
296 | QIconView* OVersatileView::iconView() const | ||
297 | { | ||
298 | return _iconview; | ||
299 | } | ||
300 | |||
301 | OListView* OVersatileView::listView() const | ||
302 | { | ||
303 | return _listview; | ||
304 | } | ||
305 | |||
306 | void OVersatileView::setViewMode( int mode ) | ||
307 | { | ||
308 | if ( mode == Tree ) | ||
309 | { | ||
310 | _viewmode = mode; | ||
311 | raiseWidget( _listview ); | ||
312 | } | ||
313 | else if ( mode == Icons ) | ||
314 | { | ||
315 | _viewmode = mode; | ||
316 | raiseWidget( _iconview ); | ||
317 | } | ||
318 | else | ||
319 | { | ||
320 | qDebug( "OVersatileView::setViewMode(): invalid mode" ); | ||
321 | } | ||
322 | } | ||
323 | |||
324 | void OVersatileView::setIconViewMode() | ||
325 | { | ||
326 | setViewMode( Icons ); | ||
327 | } | ||
328 | |||
329 | void OVersatileView::setTreeViewMode() | ||
330 | { | ||
331 | setViewMode( Tree ); | ||
332 | } | ||
333 | |||
334 | bool OVersatileView::isValidViewMode( int mode ) const | ||
335 | { | ||
336 | switch ( _warningpolicy ) | ||
337 | { | ||
338 | case OVersatileView::None: | ||
339 | { | ||
340 | return true; | ||
341 | } | ||
342 | case OVersatileView::Warn: | ||
343 | { | ||
344 | if ( _viewmode != mode ) | ||
345 | { | ||
346 | qDebug( "OVersatileView::isValidViewMode(): Requested operation not valid in current mode." ); | ||
347 | return true; | ||
348 | } | ||
349 | } | ||
350 | case OVersatileView::WarnReturn: | ||
351 | { | ||
352 | if ( _viewmode != mode ) | ||
353 | { | ||
354 | qDebug( "OVersatileView::isValidViewMode(): Requested operation not valid in current mode." ); | ||
355 | return false; | ||
356 | } | ||
357 | } | ||
358 | default: | ||
359 | { | ||
360 | qWarning( "OVersatileView::isValidViewMode(): Inconsistent object state!" ); | ||
361 | return true; | ||
362 | } | ||
363 | } | ||
364 | } | ||
365 | void OVersatileView::setWarningPolicy( int policy ) const | ||
366 | { | ||
367 | _warningpolicy = policy; | ||
368 | } | ||
369 | bool OVersatileView::warningPolicy() const | ||
370 | { | ||
371 | return _warningpolicy; | ||
372 | } | ||
373 | //==============================================================================================// | ||
374 | // Stupid Signal forwarders... | ||
375 | // Folks, this is why I like python with its dynamic typing: | ||
376 | // I can code the following dozens of lines C++ in four Python lines... | ||
377 | //==============================================================================================// | ||
378 | |||
379 | void OVersatileView::selectionChanged( QListViewItem * item ) | ||
380 | { | ||
381 | emit( selectionChanged( static_cast<OVersatileViewItem*>( item ) ) ); | ||
382 | } | ||
383 | |||
384 | void OVersatileView::selectionChanged( QIconViewItem * item ) | ||
385 | { | ||
386 | emit( selectionChanged( static_cast<OVersatileViewItem*>( item ) ) ); | ||
387 | } | ||
388 | |||
389 | void OVersatileView::currentChanged( QListViewItem * item ) | ||
390 | { | ||
391 | emit( currentChanged( static_cast<OVersatileViewItem*>( item ) ) ); | ||
392 | } | ||
393 | |||
394 | void OVersatileView::currentChanged( QIconViewItem * item ) | ||
395 | { | ||
396 | emit( currentChanged( static_cast<OVersatileViewItem*>( item ) ) ); | ||
397 | } | ||
398 | |||
399 | void OVersatileView::clicked( QListViewItem * item ) | ||
400 | { | ||
401 | emit( clicked( static_cast<OVersatileViewItem*>( item ) ) ); | ||
402 | } | ||
403 | |||
404 | void OVersatileView::clicked( QIconViewItem * item ) | ||
405 | { | ||
406 | emit( clicked( static_cast<OVersatileViewItem*>( item ) ) ); | ||
407 | } | ||
408 | |||
409 | void OVersatileView::pressed( QListViewItem * item ) | ||
410 | { | ||
411 | emit( pressed( static_cast<OVersatileViewItem*>( item ) ) ); | ||
412 | } | ||
413 | |||
414 | void OVersatileView::pressed( QIconViewItem * item ) | ||
415 | { | ||
416 | emit( pressed( static_cast<OVersatileViewItem*>( item ) ) ); | ||
417 | } | ||
418 | |||
419 | void OVersatileView::doubleClicked( QListViewItem * item ) | ||
420 | { | ||
421 | emit( doubleClicked( static_cast<OVersatileViewItem*>( item ) ) ); | ||
422 | } | ||
423 | |||
424 | void OVersatileView::doubleClicked( QIconViewItem * item ) | ||
425 | { | ||
426 | emit( doubleClicked( static_cast<OVersatileViewItem*>( item ) ) ); | ||
427 | } | ||
428 | |||
429 | void OVersatileView::returnPressed( QListViewItem * item ) | ||
430 | { | ||
431 | emit( returnPressed( static_cast<OVersatileViewItem*>( item ) ) ); | ||
432 | } | ||
433 | |||
434 | void OVersatileView::returnPressed( QIconViewItem * item ) | ||
435 | { | ||
436 | emit( returnPressed( static_cast<OVersatileViewItem*>( item ) ) ); | ||
437 | } | ||
438 | |||
439 | void OVersatileView::onItem( QListViewItem * item ) | ||
440 | { | ||
441 | emit( onItem( static_cast<OVersatileViewItem*>( item ) ) ); | ||
442 | } | ||
443 | |||
444 | void OVersatileView::onItem( QIconViewItem * item ) | ||
445 | { | ||
446 | emit( onItem( static_cast<OVersatileViewItem*>( item ) ) ); | ||
447 | } | ||
448 | |||
449 | void OVersatileView::expanded( QListViewItem *item ) // QListView | ||
450 | { | ||
451 | //qDebug( "OVersatileView::expanded(): opening tree..." ); | ||
452 | if ( not _treeopened.isNull() ) | ||
453 | item->setPixmap( 0, _treeopened ); | ||
454 | emit( expanded( static_cast<OVersatileViewItem*>( item ) ) ); | ||
455 | } | ||
456 | void OVersatileView::collapsed( QListViewItem *item ) // QListView | ||
457 | { | ||
458 | if ( not _treeclosed.isNull() ) | ||
459 | item->setPixmap( 0, _treeclosed ); | ||
460 | emit( collapsed( static_cast<OVersatileViewItem*>( item ) ) ); | ||
461 | } | ||
462 | |||
463 | //=============================================================================================// | ||
464 | // OVersatileView Case I - API only existing in QListView or QIconView but not in both! | ||
465 | //==============================================================================================// | ||
466 | |||
467 | int OVersatileView::treeStepSize() const // QListView | ||
468 | { | ||
469 | if ( not isValidViewMode( Tree ) ) | ||
470 | { | ||
471 | return -1; | ||
472 | } | ||
473 | return _listview->treeStepSize(); | ||
474 | } | ||
475 | void OVersatileView::setTreeStepSize( int size ) // QListView | ||
476 | { | ||
477 | if ( not isValidViewMode( Tree ) ) | ||
478 | { | ||
479 | return; | ||
480 | } | ||
481 | _listview->setTreeStepSize( size ); | ||
482 | } | ||
483 | |||
484 | QHeader * OVersatileView::header() const // QListView | ||
485 | { | ||
486 | if ( not isValidViewMode( Tree ) ) | ||
487 | { | ||
488 | return 0; | ||
489 | } | ||
490 | return _listview->header(); | ||
491 | } | ||
492 | |||
493 | int OVersatileView::addColumn( const QString &label, int size ) // QListView | ||
494 | { | ||
495 | if ( not isValidViewMode( Tree ) ) | ||
496 | { | ||
497 | return -1; | ||
498 | } | ||
499 | return _listview->addColumn( label, size ); | ||
500 | } | ||
501 | |||
502 | int OVersatileView::addColumn( const QIconSet& iconset, const QString &label, int size ) // QListView | ||
503 | { | ||
504 | if ( not isValidViewMode( Tree ) ) | ||
505 | { | ||
506 | return -1; | ||
507 | } | ||
508 | return _listview->addColumn( iconset, label, size ); | ||
509 | } | ||
510 | |||
511 | void OVersatileView::removeColumn( int index ) // QListView | ||
512 | { | ||
513 | if ( not isValidViewMode( Tree ) ) | ||
514 | { | ||
515 | return; | ||
516 | } | ||
517 | _listview->removeColumn( index ); | ||
518 | } | ||
519 | void OVersatileView::setColumnText( int column, const QString &label ) // QListView | ||
520 | { | ||
521 | if ( not isValidViewMode( Tree ) ) | ||
522 | { | ||
523 | return; | ||
524 | } | ||
525 | _listview->setColumnText( column, label ); | ||
526 | } | ||
527 | void OVersatileView::setColumnText( int column, const QIconSet& iconset, const QString &label ) // QListView | ||
528 | { | ||
529 | if ( not isValidViewMode( Tree ) ) | ||
530 | { | ||
531 | return; | ||
532 | } | ||
533 | _listview->setColumnText( column, iconset, label ); | ||
534 | } | ||
535 | QString OVersatileView::columnText( int column ) const // QListView | ||
536 | { | ||
537 | if ( not isValidViewMode( Tree ) ) | ||
538 | { | ||
539 | return QString::null; | ||
540 | } | ||
541 | return _listview->columnText( column ); | ||
542 | } | ||
543 | void OVersatileView::setColumnWidth( int column, int width ) // QListView | ||
544 | { | ||
545 | if ( not isValidViewMode( Tree ) ) | ||
546 | { | ||
547 | return; | ||
548 | } | ||
549 | _listview->setColumnWidth( column, width ); | ||
550 | } | ||
551 | int OVersatileView::columnWidth( int column ) const // QListView | ||
552 | { | ||
553 | if ( not isValidViewMode( Tree ) ) | ||
554 | { | ||
555 | return -1; | ||
556 | } | ||
557 | return _listview->columnWidth( column ); | ||
558 | } | ||
559 | void OVersatileView::setColumnWidthMode( int column, WidthMode mode ) // QListView | ||
560 | { | ||
561 | if ( not isValidViewMode( Tree ) ) | ||
562 | { | ||
563 | return; | ||
564 | } | ||
565 | _listview->setColumnWidth( column, mode ); | ||
566 | } | ||
567 | int OVersatileView::columns() const // QListView | ||
568 | { | ||
569 | if ( not isValidViewMode( Tree ) ) | ||
570 | { | ||
571 | return -1; | ||
572 | } | ||
573 | return _listview->columns(); | ||
574 | } | ||
575 | |||
576 | void OVersatileView::setColumnAlignment( int column, int align ) // QListView | ||
577 | { | ||
578 | if ( not isValidViewMode( Tree ) ) | ||
579 | { | ||
580 | return; | ||
581 | } | ||
582 | _listview->setColumnAlignment( column, align ); | ||
583 | } | ||
584 | int OVersatileView::columnAlignment( int column ) const // QListView | ||
585 | { | ||
586 | if ( not isValidViewMode( Tree ) ) | ||
587 | { | ||
588 | return -1; | ||
589 | } | ||
590 | return _listview->columnAlignment( column ); | ||
591 | } | ||
592 | |||
593 | OVersatileViewItem * OVersatileView::itemAt( const QPoint & screenPos ) const // QListView | ||
594 | { | ||
595 | if ( not isValidViewMode( Tree ) ) | ||
596 | { | ||
597 | return 0; | ||
598 | } | ||
599 | return static_cast<OVersatileViewItem*>( _listview->itemAt( screenPos ) ); | ||
600 | } | ||
601 | QRect OVersatileView::itemRect( const OVersatileViewItem * item ) const // QListView | ||
602 | { | ||
603 | if ( not isValidViewMode( Tree ) ) | ||
604 | { | ||
605 | return QRect( -1, -1, -1, -1 ); | ||
606 | } | ||
607 | return _listview->itemRect( item ); | ||
608 | } | ||
609 | int OVersatileView::itemPos( const OVersatileViewItem * item ) // QListView | ||
610 | { | ||
611 | if ( not isValidViewMode( Tree ) ) | ||
612 | { | ||
613 | return -1; | ||
614 | } | ||
615 | return _listview->itemPos( item ); | ||
616 | } | ||
617 | |||
618 | bool OVersatileView::isSelected( const OVersatileViewItem * item ) const // QListView // also in QIconViewItem but !in QIconView *shrug* | ||
619 | { | ||
620 | if ( not isValidViewMode( Tree ) ) | ||
621 | { | ||
622 | return false; | ||
623 | } | ||
624 | return _listview->isSelected( item ); | ||
625 | } | ||
626 | |||
627 | void OVersatileView::setMultiSelection( bool enable ) | ||
628 | { | ||
629 | _listview->setMultiSelection( enable ); | ||
630 | } | ||
631 | bool OVersatileView::isMultiSelection() const | ||
632 | { | ||
633 | return _listview->isMultiSelection(); | ||
634 | } | ||
635 | |||
636 | OVersatileViewItem * OVersatileView::selectedItem() const // QListView | ||
637 | { | ||
638 | if ( not isValidViewMode( Tree ) ) | ||
639 | { | ||
640 | return 0; | ||
641 | } | ||
642 | return static_cast<OVersatileViewItem*>( _listview->selectedItem() ); | ||
643 | } | ||
644 | void OVersatileView::setOpen( OVersatileViewItem * item, bool open ) // QListView | ||
645 | { | ||
646 | if ( not isValidViewMode( Tree ) ) | ||
647 | { | ||
648 | return; | ||
649 | } | ||
650 | _listview->setOpen( item, open ); | ||
651 | } | ||
652 | bool OVersatileView::isOpen( const OVersatileViewItem * item ) const // QListView | ||
653 | { | ||
654 | if ( not isValidViewMode( Tree ) ) | ||
655 | { | ||
656 | return false; | ||
657 | } | ||
658 | return _listview->isOpen( item ); | ||
659 | } | ||
660 | |||
661 | OVersatileViewItem * OVersatileView::firstChild() const // QListView | ||
662 | { | ||
663 | if ( not isValidViewMode( Tree ) ) | ||
664 | { | ||
665 | return 0; | ||
666 | } | ||
667 | return static_cast<OVersatileViewItem*>( _listview->firstChild() ); | ||
668 | } | ||
669 | int OVersatileView::childCount() const // QListView | ||
670 | { | ||
671 | if ( not isValidViewMode( Tree ) ) | ||
672 | { | ||
673 | return -1; | ||
674 | } | ||
675 | return _listview->childCount(); | ||
676 | } | ||
677 | |||
678 | void OVersatileView::setAllColumnsShowFocus( bool focus ) // QListView | ||
679 | { | ||
680 | if ( not isValidViewMode( Tree ) ) | ||
681 | { | ||
682 | return; | ||
683 | } | ||
684 | _listview->setAllColumnsShowFocus( focus ); | ||
685 | } | ||
686 | bool OVersatileView::allColumnsShowFocus() const // QListView | ||
687 | { | ||
688 | if ( not isValidViewMode( Tree ) ) | ||
689 | { | ||
690 | return false; | ||
691 | } | ||
692 | return _listview->allColumnsShowFocus(); | ||
693 | } | ||
694 | |||
695 | void OVersatileView::setItemMargin( int margin ) // QListView | ||
696 | { | ||
697 | if ( not isValidViewMode( Tree ) ) | ||
698 | { | ||
699 | return; | ||
700 | } | ||
701 | _listview->setItemMargin( margin ); | ||
702 | } | ||
703 | int OVersatileView::itemMargin() const // QListView | ||
704 | { | ||
705 | if ( not isValidViewMode( Tree ) ) | ||
706 | { | ||
707 | return -1; | ||
708 | } | ||
709 | return _listview->itemMargin(); | ||
710 | } | ||
711 | |||
712 | void OVersatileView::setRootIsDecorated( bool decorate ) // QListView | ||
713 | { | ||
714 | if ( not isValidViewMode( Tree ) ) | ||
715 | { | ||
716 | return; | ||
717 | } | ||
718 | _listview->setRootIsDecorated( decorate ); | ||
719 | } | ||
720 | bool OVersatileView::rootIsDecorated() const // QListView | ||
721 | { | ||
722 | if ( not isValidViewMode( Tree ) ) | ||
723 | { | ||
724 | return false; | ||
725 | } | ||
726 | return _listview->rootIsDecorated(); | ||
727 | } | ||
728 | |||
729 | void OVersatileView::setShowSortIndicator( bool show ) // QListView | ||
730 | { | ||
731 | if ( not isValidViewMode( Tree ) ) | ||
732 | { | ||
733 | return; | ||
734 | } | ||
735 | _listview->setShowSortIndicator( show ); | ||
736 | } | ||
737 | bool OVersatileView::showSortIndicator() const // QListView | ||
738 | { | ||
739 | if ( not isValidViewMode( Tree ) ) | ||
740 | { | ||
741 | return false; | ||
742 | } | ||
743 | return _listview->showSortIndicator(); | ||
744 | } | ||
745 | |||
746 | void OVersatileView::triggerUpdate() // QListView | ||
747 | { | ||
748 | if ( not isValidViewMode( Tree ) ) | ||
749 | { | ||
750 | return; | ||
751 | } | ||
752 | _listview->triggerUpdate(); | ||
753 | } | ||
754 | |||
755 | // | ||
756 | // only in QIconView | ||
757 | // | ||
758 | |||
759 | uint OVersatileView::count() const // QIconView | ||
760 | { | ||
761 | if ( not isValidViewMode( Icons ) ) | ||
762 | { | ||
763 | return 0; | ||
764 | } | ||
765 | return _iconview->count(); | ||
766 | } | ||
767 | |||
768 | int OVersatileView::index( const OVersatileViewItem *item ) const // QIconView | ||
769 | { | ||
770 | if ( not isValidViewMode( Icons ) ) | ||
771 | { | ||
772 | return -1; | ||
773 | } | ||
774 | return _iconview->index( item ); | ||
775 | } | ||
776 | |||
777 | OVersatileViewItem* OVersatileView::firstItem() const // QIconView | ||
778 | { | ||
779 | if ( not isValidViewMode( Icons ) ) | ||
780 | { | ||
781 | return 0; | ||
782 | } | ||
783 | return static_cast<OVersatileViewItem*>( _iconview->firstItem() ); | ||
784 | } | ||
785 | OVersatileViewItem* OVersatileView::lastItem() const // QIconView | ||
786 | { | ||
787 | if ( not isValidViewMode( Icons ) ) | ||
788 | { | ||
789 | return 0; | ||
790 | } | ||
791 | return static_cast<OVersatileViewItem*>( _iconview->lastItem() ); | ||
792 | } | ||
793 | |||
794 | OVersatileViewItem* OVersatileView::findItem( const QPoint &pos ) const // QIconView | ||
795 | { | ||
796 | if ( not isValidViewMode( Icons ) ) | ||
797 | { | ||
798 | return 0; | ||
799 | } | ||
800 | return static_cast<OVersatileViewItem*>( _iconview->findItem( pos ) ); | ||
801 | } | ||
802 | OVersatileViewItem* OVersatileView::findItem( const QString &text ) const // QIconView | ||
803 | { | ||
804 | if ( not isValidViewMode( Icons ) ) | ||
805 | { | ||
806 | return 0; | ||
807 | } | ||
808 | return static_cast<OVersatileViewItem*>( _iconview->findItem( text ) ); | ||
809 | } | ||
810 | |||
811 | OVersatileViewItem* OVersatileView::findFirstVisibleItem( const QRect &r ) const // QIconView | ||
812 | { | ||
813 | if ( not isValidViewMode( Icons ) ) | ||
814 | { | ||
815 | return 0; | ||
816 | } | ||
817 | return static_cast<OVersatileViewItem*>( _iconview->findFirstVisibleItem( r ) ); | ||
818 | } | ||
819 | OVersatileViewItem* OVersatileView::findLastVisibleItem( const QRect &r ) const // QIconView | ||
820 | { | ||
821 | if ( not isValidViewMode( Icons ) ) | ||
822 | { | ||
823 | return 0; | ||
824 | } | ||
825 | return static_cast<OVersatileViewItem*>( _iconview->findLastVisibleItem( r ) ); | ||
826 | } | ||
827 | |||
828 | void OVersatileView::setGridX( int rx ) // QIconView | ||
829 | { | ||
830 | if ( not isValidViewMode( Icons ) ) | ||
831 | { | ||
832 | return; | ||
833 | } | ||
834 | _iconview->setGridX( rx ); | ||
835 | } | ||
836 | void OVersatileView::setGridY( int ry ) // QIconView | ||
837 | { | ||
838 | if ( not isValidViewMode( Icons ) ) | ||
839 | { | ||
840 | return; | ||
841 | } | ||
842 | _iconview->setGridY( ry ); | ||
843 | } | ||
844 | int OVersatileView::gridX() const // QIconView | ||
845 | { | ||
846 | if ( not isValidViewMode( Icons ) ) | ||
847 | { | ||
848 | return -1; | ||
849 | } | ||
850 | return _iconview->gridX(); | ||
851 | } | ||
852 | int OVersatileView::gridY() const // QIconView | ||
853 | { | ||
854 | if ( not isValidViewMode( Icons ) ) | ||
855 | { | ||
856 | return -1; | ||
857 | } | ||
858 | return _iconview->gridY(); | ||
859 | } | ||
860 | void OVersatileView::setSpacing( int sp ) // QIconView | ||
861 | { | ||
862 | if ( not isValidViewMode( Icons ) ) | ||
863 | { | ||
864 | return; | ||
865 | } | ||
866 | _iconview->setSpacing( sp ); | ||
867 | } | ||
868 | int OVersatileView::spacing() const // QIconView | ||
869 | { | ||
870 | if ( not isValidViewMode( Icons ) ) | ||
871 | { | ||
872 | return -1; | ||
873 | } | ||
874 | return _iconview->spacing(); | ||
875 | } | ||
876 | void OVersatileView::setItemTextPos( QIconView::ItemTextPos pos ) // QIconView | ||
877 | { | ||
878 | if ( not isValidViewMode( Icons ) ) | ||
879 | { | ||
880 | return; | ||
881 | } | ||
882 | _iconview->setItemTextPos( pos ); | ||
883 | } | ||
884 | QIconView::ItemTextPos OVersatileView::itemTextPos() const // QIconView | ||
885 | { | ||
886 | if ( not isValidViewMode( Icons ) ) | ||
887 | { | ||
888 | return (QIconView::ItemTextPos) -1; | ||
889 | } | ||
890 | return _iconview->itemTextPos(); | ||
891 | } | ||
892 | void OVersatileView::setItemTextBackground( const QBrush &b ) // QIconView | ||
893 | { | ||
894 | if ( not isValidViewMode( Icons ) ) | ||
895 | { | ||
896 | return; | ||
897 | } | ||
898 | _iconview->setItemTextBackground( b ); | ||
899 | } | ||
900 | QBrush OVersatileView::itemTextBackground() const // QIconView | ||
901 | { | ||
902 | if ( not isValidViewMode( Icons ) ) | ||
903 | { | ||
904 | return QBrush(); | ||
905 | } | ||
906 | return _iconview->itemTextBackground(); | ||
907 | } | ||
908 | void OVersatileView::setArrangement( QIconView::Arrangement am ) // QIconView | ||
909 | { | ||
910 | if ( not isValidViewMode( Icons ) ) | ||
911 | { | ||
912 | return; | ||
913 | } | ||
914 | _iconview->setArrangement( am ); | ||
915 | } | ||
916 | QIconView::Arrangement OVersatileView::arrangement() const // QIconView | ||
917 | { | ||
918 | if ( not isValidViewMode( Icons ) ) | ||
919 | { | ||
920 | return (QIconView::Arrangement) -1; | ||
921 | } | ||
922 | return _iconview->arrangement(); | ||
923 | } | ||
924 | void OVersatileView::setResizeMode( QIconView::ResizeMode am ) // QIconView | ||
925 | { | ||
926 | if ( not isValidViewMode( Icons ) ) | ||
927 | { | ||
928 | return; | ||
929 | } | ||
930 | _iconview->setResizeMode( am ); | ||
931 | } | ||
932 | QIconView::ResizeMode OVersatileView::resizeMode() const // QIconView | ||
933 | { | ||
934 | if ( not isValidViewMode( Icons ) ) | ||
935 | { | ||
936 | return (QIconView::ResizeMode) -1; | ||
937 | } | ||
938 | return _iconview->resizeMode(); | ||
939 | } | ||
940 | void OVersatileView::setMaxItemWidth( int w ) // QIconView | ||
941 | { | ||
942 | if ( not isValidViewMode( Icons ) ) | ||
943 | { | ||
944 | return; | ||
945 | } | ||
946 | _iconview->setMaxItemWidth( w ); | ||
947 | } | ||
948 | int OVersatileView::maxItemWidth() const // QIconView | ||
949 | { | ||
950 | if ( not isValidViewMode( Icons ) ) | ||
951 | { | ||
952 | return -1; | ||
953 | } | ||
954 | return _iconview->maxItemWidth(); | ||
955 | } | ||
956 | void OVersatileView::setMaxItemTextLength( int w ) // QIconView | ||
957 | { | ||
958 | if ( not isValidViewMode( Icons ) ) | ||
959 | { | ||
960 | return; | ||
961 | } | ||
962 | _iconview->setMaxItemTextLength( w ); | ||
963 | } | ||
964 | int OVersatileView::maxItemTextLength() const // QIconView | ||
965 | { | ||
966 | if ( not isValidViewMode( Icons ) ) | ||
967 | { | ||
968 | return -1; | ||
969 | } | ||
970 | return _iconview->maxItemTextLength(); | ||
971 | } | ||
972 | void OVersatileView::setAutoArrange( bool b ) // QIconView | ||
973 | { | ||
974 | if ( not isValidViewMode( Icons ) ) | ||
975 | { | ||
976 | return; | ||
977 | } | ||
978 | _iconview->setAutoArrange( b ); | ||
979 | } | ||
980 | bool OVersatileView::autoArrange() const // QIconView | ||
981 | { | ||
982 | if ( not isValidViewMode( Icons ) ) | ||
983 | { | ||
984 | return false; | ||
985 | } | ||
986 | return _iconview->autoArrange(); | ||
987 | } | ||
988 | void OVersatileView::setShowToolTips( bool b ) // QIconView | ||
989 | { | ||
990 | if ( not isValidViewMode( Icons ) ) | ||
991 | { | ||
992 | return; | ||
993 | } | ||
994 | _iconview->setShowToolTips( b ); | ||
995 | } | ||
996 | bool OVersatileView::showToolTips() const // QIconView | ||
997 | { | ||
998 | if ( not isValidViewMode( Icons ) ) | ||
999 | { | ||
1000 | return false; | ||
1001 | } | ||
1002 | return _iconview->showToolTips(); | ||
1003 | } | ||
1004 | |||
1005 | bool OVersatileView::sorting() const // QIconView | ||
1006 | { | ||
1007 | if ( not isValidViewMode( Icons ) ) | ||
1008 | { | ||
1009 | return false; | ||
1010 | } | ||
1011 | return _iconview->sorting(); | ||
1012 | } | ||
1013 | bool OVersatileView::sortDirection() const // QIconView | ||
1014 | { | ||
1015 | if ( not isValidViewMode( Icons ) ) | ||
1016 | { | ||
1017 | return false; | ||
1018 | } | ||
1019 | return _iconview->sortDirection(); | ||
1020 | } | ||
1021 | |||
1022 | void OVersatileView::setItemsMovable( bool b ) // QIconView | ||
1023 | { | ||
1024 | if ( not isValidViewMode( Icons ) ) | ||
1025 | { | ||
1026 | return; | ||
1027 | } | ||
1028 | _iconview->setItemsMovable( b ); | ||
1029 | } | ||
1030 | bool OVersatileView::itemsMovable() const // QIconView | ||
1031 | { | ||
1032 | if ( not isValidViewMode( Icons ) ) | ||
1033 | { | ||
1034 | return false; | ||
1035 | } | ||
1036 | return _iconview->itemsMovable(); | ||
1037 | } | ||
1038 | void OVersatileView::setWordWrapIconText( bool b ) // QIconView | ||
1039 | { | ||
1040 | if ( not isValidViewMode( Icons ) ) | ||
1041 | { | ||
1042 | return; | ||
1043 | } | ||
1044 | _iconview->setWordWrapIconText( b ); | ||
1045 | } | ||
1046 | bool OVersatileView::wordWrapIconText() const // QIconView | ||
1047 | { | ||
1048 | if ( not isValidViewMode( Icons ) ) | ||
1049 | { | ||
1050 | return false; | ||
1051 | } | ||
1052 | return _iconview->wordWrapIconText(); | ||
1053 | } | ||
1054 | |||
1055 | void OVersatileView::arrangeItemsInGrid( const QSize &grid, bool update ) // QIconView | ||
1056 | { | ||
1057 | if ( not isValidViewMode( Icons ) ) | ||
1058 | { | ||
1059 | return; | ||
1060 | } | ||
1061 | _iconview->arrangeItemsInGrid( grid, update ); | ||
1062 | } | ||
1063 | void OVersatileView::arrangeItemsInGrid( bool update ) // QIconView | ||
1064 | { | ||
1065 | if ( not isValidViewMode( Icons ) ) | ||
1066 | { | ||
1067 | return; | ||
1068 | } | ||
1069 | _iconview->arrangeItemsInGrid( update ); | ||
1070 | } | ||
1071 | void OVersatileView::updateContents() // QIconView | ||
1072 | { | ||
1073 | if ( not isValidViewMode( Icons ) ) | ||
1074 | { | ||
1075 | return; | ||
1076 | } | ||
1077 | _iconview->updateContents(); | ||
1078 | } | ||
1079 | |||
1080 | //==============================================================================================// | ||
1081 | // OVersatileView Case II - QListView / QIconView common API | ||
1082 | //==============================================================================================// | ||
1083 | |||
1084 | void OVersatileView::clear() | ||
1085 | { | ||
1086 | _iconview->clear(); | ||
1087 | _listview->clear(); | ||
1088 | } | ||
1089 | |||
1090 | void OVersatileView::setFont( const QFont & font ) | ||
1091 | { | ||
1092 | _iconview->setFont( font ); | ||
1093 | _listview->setFont( font ); | ||
1094 | } | ||
1095 | void OVersatileView::setPalette( const QPalette & palette ) | ||
1096 | { | ||
1097 | _iconview->setPalette( palette ); | ||
1098 | _listview->setPalette( palette ); | ||
1099 | } | ||
1100 | |||
1101 | void OVersatileView::takeItem( OVersatileViewItem * item ) | ||
1102 | { | ||
1103 | _iconview->takeItem( item ); | ||
1104 | _listview->takeItem( item ); | ||
1105 | } | ||
1106 | |||
1107 | void OVersatileView::setSelectionMode( SelectionMode mode ) | ||
1108 | { | ||
1109 | _iconview->setSelectionMode( (QIconView::SelectionMode) mode ); | ||
1110 | _listview->setSelectionMode( (QListView::SelectionMode) mode ); | ||
1111 | } | ||
1112 | OVersatileView::SelectionMode OVersatileView::selectionMode() const | ||
1113 | { | ||
1114 | return (OVersatileView::SelectionMode) _iconview->selectionMode(); | ||
1115 | } | ||
1116 | |||
1117 | void OVersatileView::selectAll( bool select ) | ||
1118 | { | ||
1119 | _iconview->selectAll( select ); | ||
1120 | } | ||
1121 | void OVersatileView::clearSelection() | ||
1122 | { | ||
1123 | _iconview->clearSelection(); | ||
1124 | _listview->clearSelection(); | ||
1125 | } | ||
1126 | void OVersatileView::invertSelection() | ||
1127 | { | ||
1128 | _iconview->invertSelection(); | ||
1129 | _listview->invertSelection(); | ||
1130 | } | ||
1131 | |||
1132 | void OVersatileView::ensureItemVisible( const OVersatileViewItem * item ) | ||
1133 | { | ||
1134 | _iconview->ensureItemVisible( const_cast<OVersatileViewItem*>( item ) ); | ||
1135 | _listview->ensureItemVisible( item ); | ||
1136 | } | ||
1137 | void OVersatileView::repaintItem( const OVersatileViewItem * item ) const | ||
1138 | { | ||
1139 | _iconview->repaintItem( const_cast<OVersatileViewItem*>( item ) ); | ||
1140 | _listview->repaintItem( item ); | ||
1141 | } | ||
1142 | |||
1143 | void OVersatileView::setCurrentItem( OVersatileViewItem * item ) | ||
1144 | { | ||
1145 | _iconview->setCurrentItem( item ); | ||
1146 | _listview->setCurrentItem( item ); | ||
1147 | } | ||
1148 | OVersatileViewItem * OVersatileView::currentItem() const | ||
1149 | { | ||
1150 | return static_cast<OVersatileViewItem*>( _listview->currentItem() ); | ||
1151 | } | ||
1152 | |||
1153 | // bool eventFilter( QObject * o, QEvent * ) // use QWidgetStack implementation | ||
1154 | |||
1155 | // QSize minimumSizeHint() const // use QWidgetStack implementation | ||
1156 | // QSizePolicy sizePolicy() const // use QWidgetStack implementation | ||
1157 | // QSize sizeHint() const // use QWidgetStack implementation | ||
1158 | |||
1159 | //==============================================================================================// | ||
1160 | // OVersatileView Case III - APIs which differ slightly | ||
1161 | //==============================================================================================// | ||
1162 | |||
1163 | /* | ||
1164 | |||
1165 | void OVersatileView::insertItem( OVersatileViewItem * ) // QListView | ||
1166 | void OVersatileView::insertItem( OVersatileViewItem *item, OVersatileViewItem *after = 0L ) // QIconView | ||
1167 | |||
1168 | void OVersatileView::setSelected( OVersatileViewItem *, bool ) // QListView | ||
1169 | void OVersatileView::setSelected( OVersatileViewItem *item, bool s, bool cb = FALSE ) // QIconView | ||
1170 | |||
1171 | void OVersatileView::setSorting( int column, bool increasing = TRUE ) // QListView | ||
1172 | void OVersatileView::setSorting( bool sort, bool ascending = TRUE ) // QIconView | ||
1173 | |||
1174 | void OVersatileView::sort() // #### make in next major release // QListView | ||
1175 | void OVersatileView::sort( bool ascending = TRUE ) // QIconView | ||
1176 | |||
1177 | */ | ||
1178 | |||
1179 | |||