Warning, file /graphics/tikzkit/src/ui/tools/EllipseTool.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* This file is part of the TikZKit project. 0002 * 0003 * Copyright (C) 2014 Dominik Haumann <dhaumann@kde.org> 0004 * 0005 * This library is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU Library General Public License as published 0007 * by the Free Software Foundation, either version 2 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This library 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 Library General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU Library General Public License 0016 * along with this library; see the file COPYING.LIB. If not, see 0017 * <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #ifndef TIKZ_UI_ELLIPSE_TOOL_H 0021 #define TIKZ_UI_ELLIPSE_TOOL_H 0022 0023 #include "AbstractTool.h" 0024 #include "Handle.h" 0025 0026 #include <QVector> 0027 #include <memory> 0028 0029 0030 namespace tikz { 0031 namespace core { 0032 class Transaction; 0033 } 0034 namespace ui { 0035 0036 class PathItem; 0037 class EllipsePathItem; 0038 0039 class AnchorManager; 0040 class Handle; 0041 0042 /** 0043 * The EllipseTool allows to modify a tikz::ui::Path that represents an ellipse. 0044 * The supported operations are: move, resize, rotate. 0045 */ 0046 class EllipseTool : public AbstractTool 0047 { 0048 Q_OBJECT 0049 0050 public: 0051 /** 0052 * Constructor with graphics scene @p scene. 0053 */ 0054 EllipseTool(tikz::ui::PathItem * path, QGraphicsScene * scene); 0055 0056 /** 0057 * Virtual destructor. 0058 */ 0059 virtual ~EllipseTool(); 0060 0061 // 0062 // sub classes: reimplement as needed 0063 // 0064 public: 0065 /** 0066 * This function is called whenever the mouse moves in the graphics 0067 * scene. 0068 */ 0069 void mouseMoveEvent(QGraphicsSceneMouseEvent * event) override; 0070 0071 /** 0072 * This function is called whenever a mouse button is pressed in the 0073 * graphics scene. 0074 */ 0075 void mousePressEvent(QGraphicsSceneMouseEvent * event) override; 0076 0077 /** 0078 * This function is called whenever a mouse button is released in the 0079 * graphics scene. 0080 */ 0081 void mouseReleaseEvent(QGraphicsSceneMouseEvent * event) override; 0082 0083 // 0084 // internal to EllipseTool 0085 // 0086 protected Q_SLOTS: 0087 /** 0088 * Make sure the handles are positioned at the correct location 0089 */ 0090 void updateHandlePositions(); 0091 0092 /** 0093 * Create path handles for the path. 0094 */ 0095 void createPathHandles(); 0096 0097 /** 0098 * This slot is called whenever a handle moved. 0099 * The path is then either moved, resized or rotated according to 0100 * the sender @p handle. 0101 * @param handle the handle that moved 0102 * @param scenePos the mouse move position in scene coordinates 0103 * @param view the view that generated this event 0104 */ 0105 void handleMoved(tikz::ui::Handle * handle, const QPointF & scenePos, QGraphicsView * view); 0106 0107 /** 0108 * This slot is called whenever a handle was pressed with the mouse. 0109 */ 0110 void handleMousePressed(tikz::ui::Handle * handle, const QPointF & scenePos, QGraphicsView * view); 0111 0112 /** 0113 * This slot is called whenever a handle was released with the mouse. 0114 */ 0115 void handleMouseReleased(tikz::ui::Handle * handle, const QPointF & scenePos, QGraphicsView * view); 0116 0117 protected: 0118 /** 0119 * Get the handle position for a specific handle in scene coordinates. 0120 */ 0121 QPointF handlePos(Handle::Position pos); 0122 0123 0124 private: 0125 tikz::ui::EllipsePathItem * m_path; 0126 QVector<Handle *> m_handles; 0127 AnchorManager * m_anchorManager; 0128 std::unique_ptr<tikz::core::Transaction> m_transaction; 0129 }; 0130 0131 } 0132 } 0133 0134 #endif // TIKZ_UI_ELLIPSE_TOOL_H 0135 0136 // kate: indent-width 4; replace-tabs on;