okular/ui/thumbnaillist.h

104 lines
3.6 KiB
C
Raw Normal View History

/***************************************************************************
2013-03-14 22:09:07 +00:00
* Copyright (C) 2004 by Albert Astals Cid <aacid@kde.org> *
* *
* 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 _OKULAR_THUMBNAILLIST_H_
#define _OKULAR_THUMBNAILLIST_H_
2016-07-21 19:53:54 +00:00
#include <QScrollArea>
#include <QToolBar>
#include <QVBoxLayout>
#include "core/observer.h"
2016-07-21 19:53:54 +00:00
class ThumbnailListPrivate;
namespace Okular {
class Document;
}
/**
* @short A scrollview that displays page pixmap previews (aka thumbnails).
*
* ...
*/
class ThumbnailList : public QScrollArea, public Okular::DocumentObserver
{
Q_OBJECT
public:
ThumbnailList(QWidget *parent, Okular::Document *document);
~ThumbnailList();
// inherited: create thumbnails ( inherited as a DocumentObserver )
2017-03-02 19:39:24 +00:00
void notifySetup( const QVector< Okular::Page * > & pages, int setupFlags ) override;
// inherited: hilihght current thumbnail ( inherited as DocumentObserver )
2017-03-02 19:39:24 +00:00
void notifyCurrentPageChanged( int previous, int current ) override;
// inherited: redraw thumbnail ( inherited as DocumentObserver )
2017-03-02 19:39:24 +00:00
void notifyPageChanged( int pageNumber, int changedFlags ) override;
2018-11-14 19:12:15 +00:00
// inherited: request all visible pixmap (due to a global change or so..)
2017-03-02 19:39:24 +00:00
void notifyContentsCleared( int changedFlags ) override;
// inherited: the visible areas of the page have changed
2017-03-02 19:39:24 +00:00
void notifyVisibleRectsChanged() override;
// inherited: tell if pixmap is hidden and can be unloaded
2017-03-02 19:39:24 +00:00
bool canUnloadPixmap( int pageNumber ) const override;
// redraw visible widgets (useful for refreshing contents...)
void updateWidgets();
public Q_SLOTS:
// these are connected to ThumbnailController buttons
void slotFilterBookmarks( bool filterOn );
protected:
// scroll up/down the view
2017-03-02 19:39:24 +00:00
void keyPressEvent( QKeyEvent * e ) override;
// catch the viewport event and filter them if necessary
2017-03-02 19:39:24 +00:00
bool viewportEvent( QEvent * ) override;
Q_SIGNALS:
void rightClick( const Okular::Page *, const QPoint & );
private:
friend class ThumbnailListPrivate;
ThumbnailListPrivate *d;
Q_PRIVATE_SLOT( d, void slotRequestVisiblePixmaps( int newContentsY = -1 ) )
Q_PRIVATE_SLOT( d, void slotDelayTimeout() )
};
/**
* @short A vertical boxed container with zero size hint (for insertion on left toolbox)
*/
2015-03-17 22:15:20 +00:00
class ThumbnailsBox : public QWidget
{
2016-10-29 14:32:24 +00:00
Q_OBJECT
public:
2019-02-27 06:50:47 +00:00
explicit ThumbnailsBox( QWidget * parent ) : QWidget( parent ) { QVBoxLayout *vbox = new QVBoxLayout(this); vbox->setContentsMargins(0, 0, 0, 0); vbox->setSpacing(0);}
2017-03-02 19:39:24 +00:00
QSize sizeHint() const override { return QSize(); }
};
/**
* @short A toolbar that sets ThumbnailList properties when clicking on items
*
* This class is the small toolbar that resides in the bottom of the
* ThumbnailsBox container (below ThumbnailList and the SearchLine) and
* emits signals whenever a button is pressed. A click action results
* in invoking some method (or slot) in ThumbnailList.
*/
class ThumbnailController : public QToolBar
{
2016-10-29 14:32:24 +00:00
Q_OBJECT
public:
ThumbnailController( QWidget * parent, ThumbnailList * thumbnailList );
};
#endif