File indexing completed on 2024-05-05 17:09:07
0001 /* 0002 * This file is part of the KDE project 0003 * Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl> 0004 * 0005 * This program is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation; either version 2 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program; if not, write to the Free Software 0017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef CQCANVASBASE_H 0021 #define CQCANVASBASE_H 0022 0023 #include <QDeclarativeItem> 0024 0025 class KoZoomController; 0026 class CQCanvasController; 0027 class CQCanvasBase : public QDeclarativeItem 0028 { 0029 Q_OBJECT 0030 Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged) 0031 Q_PROPERTY(qreal shapeTransparency READ shapeTransparency WRITE setShapeTransparency NOTIFY shapeTransparencyChanged) 0032 0033 public: 0034 explicit CQCanvasBase(QDeclarativeItem* parent); 0035 virtual ~CQCanvasBase(); 0036 0037 CQCanvasController *canvasController() const; 0038 KoZoomController *zoomController() const; 0039 QString source() const; 0040 0041 virtual qreal shapeTransparency() const; 0042 virtual void setShapeTransparency(qreal newTransparency); 0043 public Q_SLOTS: 0044 virtual void setSource(const QString &source); 0045 virtual void render(QPainter* painter, const QRectF& target) = 0; 0046 0047 Q_SIGNALS: 0048 void sourceChanged(); 0049 void shapeTransparencyChanged(); 0050 void canvasControllerChanged(); 0051 void positionShouldChange(const QPoint& pos); 0052 0053 void loadingBegun(); 0054 void loadingFinished(); 0055 0056 protected: 0057 virtual void setCanvasController(CQCanvasController *controller); 0058 virtual void setZoomController(KoZoomController *controller); 0059 0060 virtual void openFile(const QString &file) = 0; 0061 0062 private: 0063 class Private; 0064 Private * const d; 0065 }; 0066 0067 Q_DECLARE_METATYPE(CQCanvasBase*); 0068 0069 #endif // CQCANVASBASE_H