File indexing completed on 2024-05-12 15:26:38
0001 /*************************************************************************** 0002 File : AbstractPart.h 0003 Project : LabPlot 0004 Description : Base class of Aspects with MDI windows as views. 0005 -------------------------------------------------------------------- 0006 Copyright : (C) 2012-2015 Alexander Semke (alexander.semke@web.de) 0007 0008 ***************************************************************************/ 0009 0010 /*************************************************************************** 0011 * * 0012 * This program is free software; you can redistribute it and/or modify * 0013 * it under the terms of the GNU General Public License as published by * 0014 * the Free Software Foundation; either version 2 of the License, or * 0015 * (at your option) any later version. * 0016 * * 0017 * This program is distributed in the hope that it will be useful, * 0018 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0020 * GNU General Public License for more details. * 0021 * * 0022 * You should have received a copy of the GNU General Public License * 0023 * along with this program; if not, write to the Free Software * 0024 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 0025 * Boston, MA 02110-1301 USA * 0026 * * 0027 ***************************************************************************/ 0028 #ifndef ABSTRACT_PART_H 0029 #define ABSTRACT_PART_H 0030 0031 #include "AbstractAspect.h" 0032 0033 class PartMdiView; 0034 class QMenu; 0035 0036 class AbstractPart : public AbstractAspect { 0037 Q_OBJECT 0038 0039 public: 0040 AbstractPart(const QString &name, AspectType type); 0041 ~AbstractPart() override; 0042 0043 virtual QWidget* view() const = 0; 0044 void deleteView() const; 0045 0046 PartMdiView* mdiSubWindow() const; 0047 bool hasMdiSubWindow() const; 0048 0049 QMenu* createContextMenu() override; 0050 virtual bool exportView() const = 0; 0051 virtual bool printView() = 0; 0052 virtual bool printPreview() const = 0; 0053 0054 bool isDraggable() const override; 0055 QVector<AspectType> dropableOn() const override; 0056 0057 //TODO: move these functions to a new class AbstractPartView 0058 virtual void registerShortcuts() {}; 0059 virtual void unregisterShortcuts() {}; 0060 0061 private: 0062 mutable PartMdiView* m_mdiWindow{nullptr}; 0063 0064 protected: 0065 mutable QWidget* m_partView{nullptr}; 0066 0067 signals: 0068 void showRequested(); 0069 void importFromFileRequested(); 0070 void importFromSQLDatabaseRequested(); 0071 void exportRequested(); 0072 void printRequested(); 0073 void printPreviewRequested(); 0074 }; 0075 0076 #endif // ifndef ABSTRACT_PART_H