File indexing completed on 2024-12-22 04:16:38
0001 /* 0002 * kis_tool_select_polygonal.h - part of Krayon^WKrita 0003 * 0004 * SPDX-FileCopyrightText: 2000 John Califf <jcaliff@compuzone.net> 0005 * SPDX-FileCopyrightText: 2002 Patrick Julien <freak@codepimps.org> 0006 * SPDX-FileCopyrightText: 2004 Boudewijn Rempt <boud@valdyas.org> 0007 * SPDX-FileCopyrightText: 2015 Michael Abrahams <miabraha@gmail.com> 0008 * 0009 * SPDX-License-Identifier: GPL-2.0-or-later 0010 */ 0011 0012 #ifndef KIS_TOOL_SELECT_POLYGONAL_H_ 0013 #define KIS_TOOL_SELECT_POLYGONAL_H_ 0014 0015 #include "KisSelectionToolFactoryBase.h" 0016 #include "kis_tool_polyline_base.h" 0017 #include <kis_tool_select_base.h> 0018 #include "kis_selection_tool_config_widget_helper.h" 0019 #include <kis_icon.h> 0020 0021 class __KisToolSelectPolygonalLocal : public KisToolPolylineBase 0022 { 0023 Q_OBJECT 0024 public: 0025 __KisToolSelectPolygonalLocal(KoCanvasBase *canvas); 0026 }; 0027 0028 class KisToolSelectPolygonal : public KisToolSelectBase<__KisToolSelectPolygonalLocal> 0029 { 0030 Q_OBJECT 0031 public: 0032 KisToolSelectPolygonal(KoCanvasBase* canvas); 0033 void resetCursorStyle() override; 0034 private: 0035 void finishPolyline(const QVector<QPointF> &points) override; 0036 void beginShape() override; 0037 void endShape() override; 0038 }; 0039 0040 0041 0042 class KisToolSelectPolygonalFactory : public KisSelectionToolFactoryBase 0043 { 0044 public: 0045 KisToolSelectPolygonalFactory() 0046 : KisSelectionToolFactoryBase("KisToolSelectPolygonal") 0047 { 0048 setToolTip(i18n("Polygonal Selection Tool")); 0049 setSection(ToolBoxSection::Select); 0050 setIconName(koIconNameCStr("tool_polygonal_selection")); 0051 setPriority(2); 0052 setActivationShapeId(KRITA_TOOL_ACTIVATION_ID); 0053 } 0054 0055 ~KisToolSelectPolygonalFactory() override {} 0056 0057 KoToolBase * createTool(KoCanvasBase *canvas) override { 0058 return new KisToolSelectPolygonal(canvas); 0059 } 0060 0061 QList<QAction *> createActionsImpl() override 0062 { 0063 KisActionRegistry *actionRegistry = KisActionRegistry::instance(); 0064 QList<QAction *> actions = KisSelectionToolFactoryBase::createActionsImpl(); 0065 0066 actions << actionRegistry->makeQAction("undo_polygon_selection", this); 0067 actions << actionRegistry->makeQAction("selection_tool_mode_add", this); 0068 0069 return actions; 0070 } 0071 0072 0073 }; 0074 0075 #endif //__selecttoolpolygonal_h__ 0076