karbon

vcanvas.h
1/* This file is part of the KDE project
2 Copyright (C) 2001, 2002, 2003 The Karbon Developers
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef __VCANVAS_H__
21#define __VCANVAS_H__
22
23
24#include <tqscrollview.h>
25#include <koffice_export.h>
26class KarbonPart;
27class KarbonView;
28class KoRect;
29class KoPoint;
30class VPainter;
31
32// The canvas is a TQScrollView.
33
34class KARBONCOMMON_EXPORT VCanvas : public TQScrollView
35{
36 TQ_OBJECT
37
38public:
39 VCanvas( TQWidget *parent, KarbonView* view, KarbonPart* part );
40 virtual ~VCanvas();
41
42 void repaintAll( const KoRect & );
43 void repaintAll( bool drawVObjects = true );
44
45 TQPixmap *pixmap() { return m_pixmap; }
46
50 void setPos( const KoPoint& p );
51
52 KoPoint toViewport( const KoPoint & ) const;
53 KoPoint toContents( const KoPoint & ) const;
54 KoRect boundingBox() const;
55
62 void setViewport( double centerX, double centerY );
63
68 void setViewportRect( const KoRect &rect );
69
70 int pageOffsetX() const;
71 int pageOffsetY() const;
72
73 KoPoint snapToGrid( const KoPoint & );
74
75protected:
76 virtual void dragEnterEvent( TQDragEnterEvent * );
77 virtual void dropEvent( TQDropEvent * );
78 virtual void focusInEvent( TQFocusEvent * );
79 virtual void viewportPaintEvent( TQPaintEvent* );
80 virtual void drawContents( TQPainter* painter, int clipx, int clipy,
81 int clipw, int cliph );
82 void drawDocument( TQPainter* painter, const KoRect& rect, bool drawVObjects = true );
83
84 virtual void resizeEvent( TQResizeEvent* event );
85
86 virtual bool eventFilter( TQObject* object, TQEvent* event );
87
88 void setYMirroring( VPainter * );
89
90private slots:
91 void slotContentsMoving( int , int );
92
93signals:
94 void viewportChanged();
95
96private:
97 TQPixmap *m_pixmap;
98 KarbonPart* m_part;
99 KarbonView* m_view;
100};
101
102#endif
Keeps track of visual per document properties.
Definition karbon_part.h:46