File indexing completed on 2024-05-12 04:20:28

0001 /*
0002  * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
0003  *
0004  * This file is part of the KD Chart library.
0005  *
0006  * SPDX-License-Identifier: GPL-2.0-or-later
0007  */
0008 
0009 #ifndef KCHARTABSTRACTAXIS_P_H
0010 #define KCHARTABSTRACTAXIS_P_H
0011 
0012 //
0013 //  W A R N I N G
0014 //  -------------
0015 //
0016 // This file is not part of the KD Chart API.  It exists purely as an
0017 // implementation detail.  This header file may change from version to
0018 // version without notice, or even be removed.
0019 //
0020 // We mean it.
0021 //
0022 
0023 #include <QQueue>
0024 #include <QTimer>
0025 
0026 #include "KChartAbstractAxis.h"
0027 #include "KChartAbstractArea_p.h"
0028 #include "KChartAbstractDiagram.h"
0029 #include "KChartMath_p.h"
0030 #include <KChartTextAttributes.h>
0031 #include <KChartRulerAttributes.h>
0032 #include <KChartDiagramObserver.h>
0033 
0034 
0035 namespace KChart {
0036 
0037 /**
0038  * \internal
0039  */
0040 class Q_DECL_HIDDEN AbstractAxis::Private : public AbstractArea::Private
0041 {
0042     friend class AbstractAxis;
0043 
0044 public:
0045     Private( AbstractDiagram* diagram, AbstractAxis* axis );
0046     ~Private() override;
0047 
0048     bool setDiagram( AbstractDiagram* diagram, bool delayedInit = false );
0049     void unsetDiagram( AbstractDiagram* diagram );
0050     AbstractDiagram* diagram() const
0051     {
0052         return mDiagram;
0053     }
0054     bool hasDiagram( AbstractDiagram* diagram ) const;
0055 
0056     void updateLayouts();
0057 
0058     DiagramObserver* observer;
0059 
0060     TextAttributes textAttributes;
0061     RulerAttributes rulerAttributes;
0062     QStringList hardLabels;
0063     QStringList hardShortLabels;
0064     QQueue<AbstractDiagram*> secondaryDiagrams;
0065 
0066 protected:
0067     AbstractDiagram* mDiagram;
0068     AbstractAxis*    mAxis;
0069 };
0070 
0071 
0072 inline AbstractAxis::AbstractAxis( Private * p, AbstractDiagram* diagram )
0073     :  AbstractArea( p )
0074 {
0075     Q_UNUSED( diagram );
0076     init();
0077     QTimer::singleShot(0, this, SLOT(delayedInit()));
0078 }
0079 
0080 inline AbstractAxis::Private * AbstractAxis::d_func()
0081 { return static_cast<Private*>( AbstractArea::d_func() ); }
0082 inline const AbstractAxis::Private * AbstractAxis::d_func() const
0083 { return static_cast<const Private*>( AbstractArea::d_func() ); }
0084 
0085 }
0086 #endif /* KCHARTABSTRACTAXIS_P_H */
0087