1 /***************************************************************************
2 * Copyright (C) 2004 by Albert Astals Cid <tsdgeos@terra.es> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 ***************************************************************************/
10 #ifndef _OKULAR_THUMBNAILLIST_H_
11 #define _OKULAR_THUMBNAILLIST_H_
13 #include <qscrollarea.h>
18 #include "core/observer.h"
21 class ThumbnailListPrivate
;
28 * @short A scrollview that displays pages pixmaps previews (aka thumbnails).
32 class ThumbnailList
: public QScrollArea
, public Okular::DocumentObserver
36 ThumbnailList(QWidget
*parent
, Okular::Document
*document
);
39 // inherited: return thumbnails observer id
40 uint
observerId() const { return THUMBNAILS_ID
; }
41 // inherited: create thumbnails ( inherited as a DocumentObserver )
42 void notifySetup( const QVector
< Okular::Page
* > & pages
, int setupFlags
);
43 // inherited: hilihght current thumbnail ( inherited as DocumentObserver )
44 void notifyViewportChanged( bool smoothMove
);
45 // inherited: redraw thumbnail ( inherited as DocumentObserver )
46 void notifyPageChanged( int pageNumber
, int changedFlags
);
47 // inherited: request all visible pixmap (due to a global shange or so..)
48 void notifyContentsCleared( int changedFlags
);
49 // inherited: the visible areas of the page have changed
50 void notifyVisibleRectsChanged();
51 // inherited: tell if pixmap is hidden and can be unloaded
52 bool canUnloadPixmap( int pageNumber
) const;
54 // redraw visible widgets (useful for refreshing contents...)
58 // these are connected to ThumbnailController buttons
59 void slotFilterBookmarks( bool filterOn
);
62 // scroll up/down the view
63 void keyPressEvent( QKeyEvent
* e
);
65 // catch the viewport event and filter them if necessary
66 bool viewportEvent( QEvent
* );
68 // file drop related events (an url may be dropped even here)
69 void dragEnterEvent( QDragEnterEvent
* );
70 void dropEvent( QDropEvent
* );
73 void urlDropped( const KUrl
& );
74 void rightClick( const Okular::Page
*, const QPoint
& );
77 friend class ThumbnailListPrivate
;
78 ThumbnailListPrivate
*d
;
80 Q_PRIVATE_SLOT( d
, void slotRequestVisiblePixmaps( int newContentsY
= -1 ) )
81 Q_PRIVATE_SLOT( d
, void slotDelayTimeout() )
85 * @short A vertical boxed container with zero size hint (for insertion on left toolbox)
87 class ThumbnailsBox
: public KVBox
90 ThumbnailsBox( QWidget
* parent
) : KVBox( parent
) {}
91 QSize
sizeHint() const { return QSize(); }
95 * @short A toolbar thar set ThumbnailList properties when clicking on items
97 * This class is the small tolbar that resides in the bottom of the
98 * ThumbnailsBox container (below ThumbnailList and the SearchLine) and
99 * emits signals whenever a button is pressed. A click action results
100 * in invoking some method (or slot) in ThumbnailList.
102 class ThumbnailController
: public QToolBar
105 ThumbnailController( QWidget
* parent
, ThumbnailList
* thumbnailList
);