File indexing completed on 2024-05-12 15:57:02

0001 /*
0002  *  SPDX-FileCopyrightText: 2017 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KISHANDLESTYLE_H
0008 #define KISHANDLESTYLE_H
0009 
0010 #include <QVector>
0011 #include <QPen>
0012 #include <QBrush>
0013 
0014 #include "kritaglobal_export.h"
0015 
0016 
0017 /**
0018  * A special class that defines a set of predefined styles for painting handles.
0019  * Please use static methods for requesting standard krita styles.
0020  */
0021 class KRITAGLOBAL_EXPORT KisHandleStyle
0022 {
0023 public:
0024 
0025     /**
0026      * Default style that does *no* change to the painter. That is, the painter
0027      * will paint with its current pen and brush.
0028      */
0029     static KisHandleStyle& inheritStyle();
0030 
0031     /**
0032      * Main style. Used for showing a single selection or a boundary box of
0033      * multiple selected objects.
0034      */
0035     static KisHandleStyle& primarySelection();
0036 
0037     /**
0038      * Secondary style. Used for highlighting objects inside a mupltiple
0039      * selection.
0040      */
0041     static KisHandleStyle& secondarySelection();
0042 
0043     /**
0044      * Style for painting gradient handles
0045      */
0046     static KisHandleStyle& gradientHandles();
0047 
0048     /**
0049      * Style for painting linear gradient arrows
0050      */
0051     static KisHandleStyle& gradientArrows();
0052 
0053     /**
0054      * Same as primary style, but the handles are filled with red color to show
0055      * that the user is hovering them.
0056      */
0057     static KisHandleStyle& highlightedPrimaryHandles();
0058 
0059     /**
0060      * Same as primary style, but the handles are filled with red color to show
0061      * that the user is hovering them and the outline is solid
0062      */
0063     static KisHandleStyle& highlightedPrimaryHandlesWithSolidOutline();
0064 
0065     /**
0066      * Used for nodes, which control points are highlighted (the node itself
0067      * is not highlighted)
0068      */
0069     static KisHandleStyle& partiallyHighlightedPrimaryHandles();
0070 
0071     /**
0072      * Same as primary style, but the handles are filled with green color to show
0073      * that they are selected.
0074      */
0075     static KisHandleStyle& selectedPrimaryHandles();
0076 
0077     struct IterationStyle {
0078         IterationStyle() : isValid(false) {}
0079         IterationStyle(const QPen &pen, const QBrush &brush)
0080             : isValid(true),
0081               stylePair(pen, brush)
0082         {
0083         }
0084 
0085         bool isValid;
0086         QPair<QPen, QBrush> stylePair;
0087     };
0088 
0089     QVector<IterationStyle> handleIterations;
0090     QVector<IterationStyle> lineIterations;
0091 };
0092 
0093 #endif // KISHANDLESTYLE_H