KisHandleStyle.h 3.01 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
/*
 *  Copyright (c) 2017 Dmitry Kazakov <dimula73@gmail.com>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#ifndef KISHANDLESTYLE_H
#define KISHANDLESTYLE_H

#include <QVector>
#include <QPen>
#include <QBrush>

#include "kritaglobal_export.h"


/**
 * A special class that defines a set of predefined styles for painting handles.
 * Please use static methods for requesting standard krita styles.
 */
class KRITAGLOBAL_EXPORT KisHandleStyle
{
public:

    /**
     * Default style that does *no* change to the painter. That is, the painter
     * will paint with its current pen and brush.
     */
    static KisHandleStyle& inheritStyle();

    /**
     * Main style. Used for showing a single selection or a boundary box of
     * multiple selected objects.
     */
    static KisHandleStyle& primarySelection();

    /**
     * Secondary style. Used for highlighting objects inside a mupltiple
     * selection.
     */
    static KisHandleStyle& secondarySelection();

    /**
     * Style for painting gradient handles
     */
    static KisHandleStyle& gradientHandles();

    /**
     * Style for painting linear gradient arrows
     */
    static KisHandleStyle& gradientArrows();

    /**
     * Same as primary style, but the handles are filled with red color to show
     * that the user is hovering them.
     */
    static KisHandleStyle& highlightedPrimaryHandles();

71 72 73 74 75 76
    /**
     * Same as primary style, but the handles are filled with red color to show
     * that the user is hovering them and the outline is solid
     */
    static KisHandleStyle& highlightedPrimaryHandlesWithSolidOutline();

77 78 79 80 81 82
    /**
     * Used for nodes, which control points are highlighted (the node itself
     * is not highlighted)
     */
    static KisHandleStyle& partiallyHighlightedPrimaryHandles();

83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
    /**
     * Same as primary style, but the handles are filled with green color to show
     * that they are selected.
     */
    static KisHandleStyle& selectedPrimaryHandles();

    struct IterationStyle {
        IterationStyle() : isValid(false) {}
        IterationStyle(const QPen &pen, const QBrush &brush)
            : isValid(true),
              stylePair(pen, brush)
        {
        }

        bool isValid;
        QPair<QPen, QBrush> stylePair;
    };

    QVector<IterationStyle> handleIterations;
    QVector<IterationStyle> lineIterations;
};

#endif // KISHANDLESTYLE_H