File indexing completed on 2024-05-12 04:20:36
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 KCHART_TEXT_AREA_H 0010 #define KCHART_TEXT_AREA_H 0011 0012 #include <QObject> 0013 0014 #include "KChartGlobal.h" 0015 #include "KChartAbstractAreaBase.h" 0016 #include "KChartLayoutItems.h" 0017 0018 namespace KChart { 0019 0020 0021 /** 0022 * @class TextArea KChartTextArea.h 0023 * @brief A text area in the chart with a background, a frame, etc. 0024 * 0025 * TextArea is the base class for all text containing non-widget chart elements 0026 * that have a set of background attributes and frame attributes, such as 0027 * headers or footers. 0028 * 0029 * @note This class inherits AbstractAreaBase, TextLayoutItem, and QObject. 0030 * The reason for this triple inheritance is that neither AbstractAreaBase nor 0031 * TextLayoutItem inherit QObject. 0032 */ 0033 class KCHART_EXPORT TextArea : public QObject, public AbstractAreaBase, public TextLayoutItem 0034 { 0035 Q_OBJECT 0036 0037 Q_DISABLE_COPY( TextArea ) 0038 KCHART_DECLARE_PRIVATE_DERIVED( TextArea ) 0039 0040 0041 public: 0042 ~TextArea() override; 0043 0044 // virtual TextArea * clone() const = 0; 0045 /** 0046 * @brief Draws the background and frame, then calls paint(). 0047 * 0048 * In most cases there is no need to overwrite this method in a derived 0049 * class, but you would overwrite TextLayoutItem::paint() instead. 0050 */ 0051 virtual void paintIntoRect( QPainter& painter, const QRect& rect ); 0052 0053 /** 0054 * Call paintAll, if you want the background and the frame to be drawn 0055 * before the normal paint() is invoked automatically. 0056 */ 0057 void paintAll( QPainter& painter ) override; 0058 0059 protected: 0060 TextArea(); 0061 QRect areaGeometry() const override; 0062 void positionHasChanged() override; 0063 0064 Q_SIGNALS: 0065 void positionChanged( KChart::TextArea * ); 0066 0067 //KCHART_DECLARE_PRIVATE_DERIVED(TextArea) 0068 }; // End of class TextArea 0069 0070 } 0071 #endif // KCHART_TEXT_AREA_H