KDChartTernaryAxis.h

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