# KDChartTernaryAxis.h

Go to the documentation of this file.

    00001 /* -*- Mode: C++ -*-
    00002    KDChart - a multi-platform charting engine
    00003    */
    00004
    00005 /****************************************************************************
    00006  ** Copyright (C) 2005-2007 Klarälvdalens Datakonsult AB.  All rights reserved.
    00007  **
    00008  ** This file is part of the KD Chart library.
    00009  **
    00010  ** This file may be distributed and/or modified under the terms of the
    00011  ** GNU General Public License version 2 as published by the Free Software
    00012  ** Foundation and appearing in the file LICENSE.GPL included in the
    00013  ** packaging of this file.
    00014  **
    00015  ** Licensees holding valid commercial KD Chart licenses may use this file in
    00016  ** accordance with the KD Chart Commercial License Agreement provided with
    00017  ** the Software.
    00018  **
    00019  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
    00020  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
    00021  **
    00022  ** See http://www.kdab.net/kdchart for
    00023  **   information about KD Chart Commercial License Agreements.
    00024  **
    00025  ** Contact info@kdab.net if any conditions of this
    00026  ** licensing are not clear to you.
    00027  **
    00028  **********************************************************************/
    00029
    00030 #ifndef KDCHARTTERNARYAXIS_H
    00031 #define KDCHARTTERNARYAXIS_H
    00032
    00033
    00034 #include <KDChartAbstractAxis>
    00035 #include <KDChartPosition>
    00036 #include <KDChartTextAttributes>
    00037
    00038 class PrerenderedLabel;
    00039
    00040 namespace KDChart {
    00041
    00042     class AbstractTernaryDiagram;
    00043
    00047     class KDCHART_EXPORT TernaryAxis : public AbstractAxis
    00048     {
    00049         Q_OBJECT
    00050
    00051         Q_DISABLE_COPY( TernaryAxis )
    00052         KDCHART_DECLARE_PRIVATE_DERIVED_PARENT( TernaryAxis, AbstractDiagram* )
    00053
    00054     public:
    00055         explicit TernaryAxis ( AbstractTernaryDiagram* diagram = 0 );
    00056         ~TernaryAxis();
    00057
    00058         virtual void  paintAll( QPainter &);
    00059         virtual void  paint (QPainter *);
    00060         virtual void  paintCtx (PaintContext *);
    00061
    00062         virtual QRect  geometry () const;
    00063         virtual void  setGeometry (const QRect &rect);
    00064
    00065         virtual bool  isEmpty () const;
    00066         virtual QSize  minimumSize () const;
    00067         virtual QSize  maximumSize () const;
    00068         virtual QSize  sizeHint () const;
    00069         virtual Qt::Orientations  expandingDirections () const  ;
    00070
    00071         virtual const Position  position () const;
    00072         virtual void  setPosition (Position p);
    00073
    00074         void setTitleText( const QString& text );
    00075         QString titleText() const;
    00076         void setTitleTextAttributes( const TextAttributes &a );
    00077         TextAttributes titleTextAttributes() const;
    00078         void resetTitleTextAttributes();
    00079         bool hasDefaultTitleTextAttributes() const;
    00080
    00081         QPair<QSizeF, QSizeF> requiredMargins() const;
    00082
    00083     private:
    00084         void updatePrerenderedLabels();
    00085         // TODO, move class variables to private class
    00086         QRect m_geometry;
    00087         Position m_position;
    00088
    00089         QString m_title;
    00090         TextAttributes m_titleAttributes;
    00091
    00092         // FIXME (Mirko): Move axis labels from grid to here, do not
    00093         // expose them, just paint them. Use title text for text. Make
    00094         // a function to allow the coordinate plane to calculate the
    00095         // necessary margins, like this:
    00096         PrerenderedLabel* m_label;
    00097         PrerenderedLabel* m_fifty;
    00098     };
    00099
    00100     typedef QList<TernaryAxis*> TernaryAxisList;
    00101 }
    00102
    00103 #endif