1 /*
2  * Copyright (C) 2001-2015 Klaralvdalens Datakonsult AB.  All rights reserved.
3  *
4  * This file is part of the KD Chart library.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 #include "KChartPaintContext.h"
21 #include "KChartAbstractCoordinatePlane.h"
22 
23 #include "KChartMath_p.h"
24 
25 #include <QRectF>
26 #include <QPainter>
27 
28 using namespace KChart;
29 
30 #define d (d_func())
31 
32 class Q_DECL_HIDDEN PaintContext::Private {
33 
34 public:
35     QPainter* painter;
36     QRectF rect;
37     AbstractCoordinatePlane* plane;
38 
Private()39     Private()
40         : painter( nullptr )
41         , plane ( nullptr )
42     {}
43 };
44 
PaintContext()45 PaintContext::PaintContext()
46     : _d ( new Private() )
47 {
48 }
49 
~PaintContext()50 PaintContext::~PaintContext()
51 {
52     delete _d;
53 }
54 
rectangle() const55 const QRectF PaintContext::rectangle() const
56 {
57     return d->rect;
58 }
59 
setRectangle(const QRectF & rect)60 void PaintContext::setRectangle ( const QRectF& rect )
61 {
62     d->rect = rect;
63 }
64 
painter() const65 QPainter* PaintContext::painter() const
66 {
67     return d->painter;
68 }
69 
setPainter(QPainter * painter)70 void PaintContext::setPainter( QPainter* painter )
71 {
72     d->painter = painter;
73 }
74 
coordinatePlane() const75 AbstractCoordinatePlane* PaintContext::coordinatePlane() const
76 {
77     return d->plane;
78 }
79 
setCoordinatePlane(AbstractCoordinatePlane * plane)80 void PaintContext::setCoordinatePlane( AbstractCoordinatePlane* plane)
81 {
82     d->plane = plane;
83 }
84