summaryrefslogtreecommitdiffstats
path: root/kviewshell/renderedDocumentPagePixmap.h
blob: 112650ba899ba4ba65babca47ba8f9a5198f0725 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// -*- C++ -*-
//
// Class: RenderedDocumentPagePixmap
//
// Widget for displaying TeX DVI files.
// Part of KDVI- A previewer for TeX DVI files.
//
// (C) 2004-2005 Stefan Kebekus. Distributed under the GPL.


#ifndef _rendereddocumentpagepixmap_h_
#define _rendereddocumentpagepixmap_h_

#include "renderedDocumentPage.h"

#include <qpainter.h>
#include <qpixmap.h>


// This class contains everything documentRenderer needs to know 
// about a certain page.
class RenderedDocumentPagePixmap: public RenderedDocumentPage, public QPixmap
{
  Q_OBJECT

public:
  RenderedDocumentPagePixmap();

  virtual ~RenderedDocumentPagePixmap();

  /** Returns a pointer to the paintDevice (in most implementation
      either a QPixmap, or a QPrinter). The pointer returned is valid
      as long as *this RenderedDocumentPage exists. This method is
      used by the renderer to draw on the page. */
  virtual QPainter *getPainter();

  /** This implementation delete the QPainter *pt (and thereby initiates the drawing) */
  virtual void returnPainter(QPainter *pt) {delete pt;}

  QPixmap accessiblePixmap();

  void resize(const QSize& size);
  void resize(int width, int height);

  virtual QSize size() { return QPixmap::size(); }
  virtual int width() { return QPixmap::width(); }
  virtual int height() { return QPixmap::height(); }

  /** Returns the amount of memory used by this pixmap */
  unsigned int memory();

private:
  QPixmap* _accessiblePixmap;
  /** true if _accessiblePixmap needs updateing */
  bool dirty;
};


#endif