File indexing completed on 2024-05-19 04:36:33
0001 /* This file is part of the TikZKit project. 0002 * 0003 * Copyright (C) 2013-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_STEALTH_ARROW_H 0021 #define TIKZ_UI_STEALTH_ARROW_H 0022 0023 #include "AbstractArrow.h" 0024 0025 class StealthArrowPrivate; 0026 0027 class StealthArrow : public AbstractArrow 0028 { 0029 public: 0030 StealthArrow(tikz::core::Style* style); 0031 virtual ~StealthArrow(); 0032 0033 // 0034 // Arrow properties 0035 // 0036 public: 0037 /** 0038 * Returns the type of this arrow. 0039 */ 0040 tikz::Arrow type() const override; 0041 0042 /** 0043 * Gui visible name, such as "to" or "stealth". 0044 * The string should be translated. 0045 */ 0046 QString name() const override; 0047 0048 /** 0049 * The 'left extend' value defines the extent of the arrow to the left, 0050 * beginning at the arrow tip. This value is only only important when 0051 * when an arrow is being reversed or composed with other arrow tips. 0052 */ 0053 qreal leftExtend() const override; 0054 0055 /** 0056 * The line is shortened by the amount of 'right extend' on the right. 0057 * This is often equal to half of the line width. 0058 */ 0059 qreal rightExtend() const override; 0060 0061 /** 0062 * Draw the arrow. 0063 */ 0064 void draw(QPainter* painter) const override; 0065 0066 /** 0067 * Returns the painter path of this arrow. 0068 * This path is lated used for bounding box creation and mouse interaction. 0069 */ 0070 QPainterPath path() const override; 0071 0072 /** 0073 * Returns the contour painter path of this arrow by drawing the 0074 * arrow's path with a pen of width @p width. 0075 */ 0076 QPainterPath contour(qreal width) const override; 0077 0078 private: 0079 StealthArrowPrivate * const d; 0080 }; 0081 0082 class ReversedStealthArrow : public StealthArrow 0083 { 0084 public: 0085 ReversedStealthArrow(tikz::core::Style * style); 0086 0087 public: 0088 tikz::Arrow type() const override; 0089 QString name() const override; 0090 0091 qreal leftExtend() const override; 0092 qreal rightExtend() const override; 0093 0094 // not needed to reimplement draw() 0095 //virtual void draw(QPainter* painter) const; 0096 QPainterPath path() const override; 0097 }; 0098 0099 #endif // TIKZ_UI_STEALTH_ARROW_H 0100 0101 // kate: indent-width 4; replace-tabs on;