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 #ifndef KCHARTABSTRACTAXIS_P_H
21 #define KCHARTABSTRACTAXIS_P_H
22 
23 //
24 //  W A R N I N G
25 //  -------------
26 //
27 // This file is not part of the KD Chart API.  It exists purely as an
28 // implementation detail.  This header file may change from version to
29 // version without notice, or even be removed.
30 //
31 // We mean it.
32 //
33 
34 #include <QQueue>
35 #include <QTimer>
36 
37 #include "KChartAbstractAxis.h"
38 #include "KChartAbstractArea_p.h"
39 #include "KChartAbstractDiagram.h"
40 #include "KChartMath_p.h"
41 #include <KChartTextAttributes.h>
42 #include <KChartRulerAttributes.h>
43 #include <KChartDiagramObserver.h>
44 
45 
46 namespace KChart {
47 
48 /**
49  * \internal
50  */
51 class Q_DECL_HIDDEN AbstractAxis::Private : public AbstractArea::Private
52 {
53     friend class AbstractAxis;
54 
55 public:
56     Private( AbstractDiagram* diagram, AbstractAxis* axis );
57     ~Private();
58 
59     bool setDiagram( AbstractDiagram* diagram, bool delayedInit = false );
60     void unsetDiagram( AbstractDiagram* diagram );
diagram()61     AbstractDiagram* diagram() const
62     {
63         return mDiagram;
64     }
65     bool hasDiagram( AbstractDiagram* diagram ) const;
66 
67     void updateLayouts();
68 
69     DiagramObserver* observer;
70 
71     TextAttributes textAttributes;
72     RulerAttributes rulerAttributes;
73     QStringList hardLabels;
74     QStringList hardShortLabels;
75     QQueue<AbstractDiagram*> secondaryDiagrams;
76 
77 protected:
78     AbstractDiagram* mDiagram;
79     AbstractAxis*    mAxis;
80 };
81 
82 
AbstractAxis(Private * p,AbstractDiagram * diagram)83 inline AbstractAxis::AbstractAxis( Private * p, AbstractDiagram* diagram )
84     :  AbstractArea( p )
85 {
86     Q_UNUSED( diagram );
87     init();
88     QTimer::singleShot(0, this, SLOT(delayedInit()));
89 }
90 
d_func()91 inline AbstractAxis::Private * AbstractAxis::d_func()
92 { return static_cast<Private*>( AbstractArea::d_func() ); }
d_func()93 inline const AbstractAxis::Private * AbstractAxis::d_func() const
94 { return static_cast<const Private*>( AbstractArea::d_func() ); }
95 
96 }
97 #endif /* KCHARTABSTRACTAXIS_P_H */
98 
99