File indexing completed on 2024-05-19 04:36:34
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_TO_ARROW_H 0021 #define TIKZ_UI_TO_ARROW_H 0022 0023 #include "AbstractArrow.h" 0024 0025 class ToArrowPrivate; 0026 0027 class ToArrow : public AbstractArrow 0028 { 0029 public: 0030 ToArrow(tikz::core::Style* style); 0031 virtual ~ToArrow(); 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 ToArrowPrivate * const d; 0080 }; 0081 0082 class ReversedToArrowPrivate; 0083 0084 class ReversedToArrow : public AbstractArrow 0085 { 0086 public: 0087 ReversedToArrow(tikz::core::Style* style); 0088 ~ReversedToArrow() override; 0089 0090 // 0091 // Arrow properties 0092 // 0093 public: 0094 /** 0095 * Returns the type of this arrow. 0096 */ 0097 tikz::Arrow type() const override; 0098 QString name() const override; 0099 0100 qreal leftExtend() const override; 0101 qreal rightExtend() const override; 0102 0103 void draw(QPainter* painter) const override; 0104 QPainterPath path() const override; 0105 QPainterPath contour(qreal width) const override; 0106 0107 private: 0108 ReversedToArrowPrivate * const d; 0109 }; 0110 0111 #endif // TIKZ_UI_TO_ARROW_H 0112 0113 // kate: indent-width 4; replace-tabs on;