libs/flake
KoPathToolSelection.h
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 * Copyright (C) 2006,2008 Jan Hambrecht <jaham@gmx.net> 00003 * Copyright (C) 2006,2007 Thorsten Zachmann <zachmann@kde.org> 00004 * Copyright (C) 2007 Thomas Zander <zander@kde.org> 00005 * Copyright (C) 2007 Boudewijn Rempt <boud@valdyas.org> 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Library General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Library General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Library General Public License 00018 * along with this library; see the file COPYING.LIB. If not, write to 00019 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 * Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef KOPATHTOOLSELECTION_H 00024 #define KOPATHTOOLSELECTION_H 00025 00026 #include <KoToolSelection.h> 00027 #include <KoPathShape.h> 00028 00029 class KoPathTool; 00030 class KoPathPoint; 00031 class KoPathPointData; 00032 class KoViewConverter; 00033 class QPainter; 00034 00041 class FLAKE_TEST_EXPORT KoPathToolSelection : public KoToolSelection 00042 { 00043 Q_OBJECT 00044 00045 public: 00046 explicit KoPathToolSelection(KoPathTool * tool); 00047 00048 ~KoPathToolSelection(); 00049 00051 void paint(QPainter &painter, const KoViewConverter &converter); 00052 00059 void add(KoPathPoint * point, bool clear); 00060 00066 void remove(KoPathPoint * point); 00067 00071 void clear(); 00072 00079 void selectPoints(const QRectF &rect, bool clearSelection); 00080 00086 int objectCount() const; 00087 00093 int size() const; 00094 00100 bool contains(KoPathPoint * point); 00101 00107 const QSet<KoPathPoint *> & selectedPoints() const; 00108 00114 QList<KoPathPointData> selectedPointsData() const; 00115 00121 QList<KoPathPointData> selectedSegmentsData() const; 00122 00124 QList<KoPathShape*> selectedShapes() const; 00125 00127 void setSelectedShapes(const QList<KoPathShape*> shapes); 00128 00132 void repaint(); 00133 00143 void update(); 00144 00146 virtual bool hasSelection(); 00147 00148 signals: 00149 void selectionChanged(); 00150 00151 private: 00152 typedef QMap<KoPathShape *, QSet<KoPathPoint *> > PathShapePointMap; 00153 00154 QSet<KoPathPoint *> m_selectedPoints; 00155 PathShapePointMap m_shapePointMap; 00156 KoPathTool * m_tool; 00157 QList<KoPathShape*> m_selectedShapes; 00158 }; 00159 00160 #endif // PATHTOOLSELECTION_H
