okular/kpdf/thumbnaillist.h
Enrico Ros 7befe4e9f6 Fix switching Paper color on the fly. Fix clearing viewport when can't open
a document. Fix countour drawing on links and images. Synced TODO.

svn path=/branches/kpdf_experiments/kdegraphics/kpdf/; revision=362414
2004-11-12 10:58:33 +00:00

91 lines
2.8 KiB
C++

/***************************************************************************
* Copyright (C) 2004 by Albert Astals Cid <tsdgeos@terra.es> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#ifndef THUMBNAILLIST_H
#define THUMBNAILLIST_H
#include <qscrollview.h>
#include <qvaluevector.h>
#include <qvbox.h>
#include "document.h"
class QTimer;
class KActionCollection;
class ThumbnailWidget;
/**
* @short A scrollview that displays pages pixmaps previews (aka thumbnails).
*
* ...
*/
class ThumbnailList : public QScrollView, public KPDFDocumentObserver
{
Q_OBJECT
public:
ThumbnailList(QWidget *parent, KPDFDocument *document);
// return thumbnails observer id
uint observerId() const { return THUMBNAILS_ID; }
// redraw thumbnail ( inherited as DocumentObserver )
void notifyPixmapChanged( int pageNumber );
// request all visible pixmap (due to a global shange or so..)
void notifyPixmapsCleared();
// create thumbnails ( inherited as a DocumentObserver )
void pageSetup( const QValueVector<KPDFPage*> & pages, bool documentChanged );
// hilihght current thumbnail ( inherited as DocumentObserver )
void pageSetCurrent( int pageNumber, const QRect & viewport );
// redraw visible widgets (useful for refreshing contents...)
void updateWidgets();
protected:
// scroll up/down the view
void keyPressEvent( QKeyEvent * e );
// select a thumbnail by clicking on it
void contentsMousePressEvent( QMouseEvent * );
// resize thumbnails to fit the width
void viewportResizeEvent( QResizeEvent * );
// file drop related events (an url may be dropped even here)
void dragEnterEvent( QDragEnterEvent* );
void dropEvent( QDropEvent* );
signals:
void urlDropped( const KURL& );
public slots:
// make requests for generating pixmaps for visible thumbnails
void slotRequestPixmaps( int newContentsX = -1, int newContentsY = -1 );
private:
void requestPixmaps( int delayMs = 0 );
KPDFDocument *m_document;
ThumbnailWidget *m_selected;
QTimer *m_delayTimer;
QValueVector<ThumbnailWidget *> m_thumbnails;
int m_vectorIndex;
};
/**
* @short A vertical boxed container with zero size hint (for insertion on left toolbox)
*/
class ThumbnailsBox : public QVBox
{
public:
ThumbnailsBox( QWidget * parent ) : QVBox( parent ) {};
QSize sizeHint() const { return QSize(); }
};
#endif