libs/flake
KoPathToolHandle.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 KOPATHTOOLHANDLE_H 00024 #define KOPATHTOOLHANDLE_H 00025 00026 #include <KoPathPoint.h> 00027 #include "KoInteractionStrategy.h" 00028 00029 class KoPathTool; 00030 class KoParameterShape; 00031 class KoViewConverter; 00032 class KoPointerEvent; 00033 class QPainter; 00034 00035 class KoPathToolHandle 00036 { 00037 public: 00038 KoPathToolHandle(KoPathTool *tool); 00039 virtual ~KoPathToolHandle(); 00040 virtual void paint(QPainter &painter, const KoViewConverter &converter) = 0; 00041 virtual void repaint() const = 0; 00042 virtual KoInteractionStrategy * handleMousePress(KoPointerEvent *event) = 0; 00043 // test if handle is still valid 00044 virtual bool check() = 0; 00045 00046 protected: 00047 KoPathTool *m_tool; 00048 }; 00049 00050 class PointHandle : public KoPathToolHandle 00051 { 00052 public: 00053 PointHandle(KoPathTool *tool, KoPathPoint *activePoint, KoPathPoint::KoPointType activePointType); 00054 void paint(QPainter &painter, const KoViewConverter &converter); 00055 void repaint() const; 00056 KoInteractionStrategy * handleMousePress(KoPointerEvent *event); 00057 bool check(); 00058 KoPathPoint * activePoint() const; 00059 KoPathPoint::KoPointType activePointType() const; 00060 private: 00061 KoPathPoint *m_activePoint; 00062 KoPathPoint::KoPointType m_activePointType; 00063 }; 00064 00065 class ParameterHandle : public KoPathToolHandle 00066 { 00067 public: 00068 ParameterHandle(KoPathTool *tool, KoParameterShape *parameterShape, int handleId); 00069 void paint(QPainter &painter, const KoViewConverter &converter); 00070 void repaint() const; 00071 KoInteractionStrategy * handleMousePress(KoPointerEvent *event); 00072 bool check(); 00073 protected: 00074 KoParameterShape *m_parameterShape; 00075 int m_handleId; 00076 }; 00077 00078 class ConnectionHandle : public ParameterHandle 00079 { 00080 public: 00081 ConnectionHandle(KoPathTool *tool, KoParameterShape *parameterShape, int handleId); 00082 00083 // XXX: Later: create a paint even to distinguish a connection 00084 // handle from another handle type 00085 KoInteractionStrategy * handleMousePress(KoPointerEvent *event); 00086 }; 00087 00088 #endif // KOPATHTOOLHANDLE_H
