File indexing completed on 2024-05-12 15:27:35

0001 /***************************************************************************
0002     File                 : WorksheetElementContainer.h
0003     Project              : LabPlot
0004     Description          : Worksheet element container - parent of multiple elements.
0005     --------------------------------------------------------------------
0006     Copyright            : (C) 2009 Tilman Benkert (thzs@gmx.net)
0007     Copyright            : (C) 2012-2017 Alexander Semke (alexander.semke@web.de)
0008 
0009  ***************************************************************************/
0010 
0011 /***************************************************************************
0012  *                                                                         *
0013  *  This program is free software; you can redistribute it and/or modify   *
0014  *  it under the terms of the GNU General Public License as published by   *
0015  *  the Free Software Foundation; either version 2 of the License, or      *
0016  *  (at your option) any later version.                                    *
0017  *                                                                         *
0018  *  This program is distributed in the hope that it will be useful,        *
0019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
0020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
0021  *  GNU General Public License for more details.                           *
0022  *                                                                         *
0023  *   You should have received a copy of the GNU General Public License     *
0024  *   along with this program; if not, write to the Free Software           *
0025  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
0026  *   Boston, MA  02110-1301  USA                                           *
0027  *                                                                         *
0028  ***************************************************************************/
0029 
0030 #ifndef WORKSHEETELEMENTCONTAINER_H
0031 #define WORKSHEETELEMENTCONTAINER_H
0032 
0033 #include "backend/worksheet/WorksheetElement.h"
0034 
0035 class WorksheetElementContainerPrivate;
0036 
0037 class WorksheetElementContainer : public WorksheetElement {
0038     Q_OBJECT
0039 
0040 public:
0041     WorksheetElementContainer(const QString&, AspectType);
0042     ~WorksheetElementContainer() override;
0043 
0044     QGraphicsItem* graphicsItem() const override;
0045 
0046     void setVisible(bool) override;
0047     bool isVisible() const override;
0048     bool isFullyVisible() const override;
0049     void setPrinting(bool) override;
0050 
0051     QRectF rect() const;
0052     virtual void setRect(const QRectF&) = 0;
0053     virtual void prepareGeometryChange();
0054     void handleResize(double horizontalRatio, double verticalRatio, bool pageResize = false) override;
0055 
0056     typedef WorksheetElementContainerPrivate Private;
0057 
0058 public slots:
0059     void retransform() override;
0060     void childHovered();
0061     void childUnhovered();
0062 
0063 protected:
0064     WorksheetElementContainerPrivate* const d_ptr;
0065     WorksheetElementContainer(const QString&, WorksheetElementContainerPrivate*, AspectType);
0066 
0067 protected slots:
0068     virtual void handleAspectAdded(const AbstractAspect*);
0069 
0070 private:
0071     Q_DECLARE_PRIVATE(WorksheetElementContainer)
0072 
0073 signals:
0074     friend class WorksheetElementContainerSetVisibleCmd;
0075     void visibleChanged(bool);
0076 };
0077 
0078 #endif