okular/ui/pageviewutils.h
Enrico Ros fbc7d45083 Adding support for annotations in framework. Only need to add and
implement annotations now (and create the save/load procedure).

Annotations: converging to a stable Annotation definition. Changed a bit
  the paint functions. Added a first 'template' annotation, a simple
  pen-like segments recorder for framework testing purposes only. This
  has events filters in place and the rough paint function implemented.

PageView: removed the MouseEdit mode and using that button for toggling
  the editToolBox instead. Added Annotation support. When the Annotation
  is created, all pageView events flow through that new object. Repaint
  of damaged/old areas is done internally and is based on the geometry
  of the annotation we're creating. When an Annotation is complete, it
  is reparented to the Page that adds it to its internal list.
  From that point on the annotation will be rendered by pagePainter
  using the pixmap-based paint function provided by the annotation
  itself.

PagePainter: draws annotations stored in pages when rendering (using the
  'rought paint function' till the good pixmap based one will be in
  place.

Page: added preliminary support for adding Annotation(s) to the page
  and deleting them all.

Document: added the pass-through call to add an Annotation to the Page
  and notify observers.

PageViewToolbox: can be draged and attached to any side. Position is
  remembered between runs (choose your side and that the toolbox will
  always be there). Available on Right and Bottom sides too. Emits -1
  when the current tool is deselected.

Misc: added Annotations to both the 'observers changed flags' and the
  'pagepainter' ones and updated ui classes accordingly.

svn path=/branches/kpdf_annotations/kdegraphics/kpdf/; revision=390638
2005-02-18 18:24:45 +00:00

74 lines
2.2 KiB
C++

/***************************************************************************
* Copyright (C) 2004-2005 by Enrico Ros <eros.kde@email.it> *
* *
* 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 _PAGEVIEW_UTILS_H_
#define _PAGEVIEW_UTILS_H_
#include <qwidget.h>
#include <qpixmap.h>
#include <qrect.h>
class QTimer;
class KPDFPage;
/**
* @short PageViewItem represents graphically a kpdfpage into the PageView.
*
* It has methods for settings Item's geometry and other visual properties such
* as the individual zoom factor.
*/
class PageViewItem
{
public:
PageViewItem( const KPDFPage * page );
const KPDFPage * page() const;
int pageNumber() const;
const QRect& geometry() const;
int width() const;
int height() const;
double zoomFactor() const;
void setGeometry( int x, int y, int width, int height );
void setWHZ( int w, int h, double zoom );
void moveTo( int x, int y );
private:
const KPDFPage * m_page;
double m_zoomFactor;
QRect m_geometry;
};
/**
* @short A widget that displays messages in the top-left corner.
*
* This is a widget with thin border and rounded corners that displays a given
* text along as an icon. It's meant to be used for displaying messages to the
* user by placing this above other widgets.
*/
class PageViewMessage : public QWidget
{
public:
PageViewMessage( QWidget * parent );
enum Icon { None, Info, Warning, Error, Find, Annotation };
void display( const QString & message, Icon icon = Info, int durationMs = 4000 );
protected:
void paintEvent( QPaintEvent * e );
void mousePressEvent( QMouseEvent * e );
private:
QPixmap m_pixmap;
QTimer * m_timer;
};
#endif