1 /*
2  *  Copyright (c) 2017 Dmitry Kazakov <dimula73@gmail.com>
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #ifndef KISHANDLESTYLE_H
20 #define KISHANDLESTYLE_H
21 
22 #include <QVector>
23 #include <QPen>
24 #include <QBrush>
25 
26 #include "kritaglobal_export.h"
27 
28 
29 /**
30  * A special class that defines a set of predefined styles for painting handles.
31  * Please use static methods for requesting standard krita styles.
32  */
33 class KRITAGLOBAL_EXPORT KisHandleStyle
34 {
35 public:
36 
37     /**
38      * Default style that does *no* change to the painter. That is, the painter
39      * will paint with its current pen and brush.
40      */
41     static KisHandleStyle& inheritStyle();
42 
43     /**
44      * Main style. Used for showing a single selection or a boundary box of
45      * multiple selected objects.
46      */
47     static KisHandleStyle& primarySelection();
48 
49     /**
50      * Secondary style. Used for highlighting objects inside a mupltiple
51      * selection.
52      */
53     static KisHandleStyle& secondarySelection();
54 
55     /**
56      * Style for painting gradient handles
57      */
58     static KisHandleStyle& gradientHandles();
59 
60     /**
61      * Style for painting linear gradient arrows
62      */
63     static KisHandleStyle& gradientArrows();
64 
65     /**
66      * Same as primary style, but the handles are filled with red color to show
67      * that the user is hovering them.
68      */
69     static KisHandleStyle& highlightedPrimaryHandles();
70 
71     /**
72      * Same as primary style, but the handles are filled with red color to show
73      * that the user is hovering them and the outline is solid
74      */
75     static KisHandleStyle& highlightedPrimaryHandlesWithSolidOutline();
76 
77     /**
78      * Used for nodes, which control points are highlighted (the node itself
79      * is not highlighted)
80      */
81     static KisHandleStyle& partiallyHighlightedPrimaryHandles();
82 
83     /**
84      * Same as primary style, but the handles are filled with green color to show
85      * that they are selected.
86      */
87     static KisHandleStyle& selectedPrimaryHandles();
88 
89     struct IterationStyle {
IterationStyleIterationStyle90         IterationStyle() : isValid(false) {}
IterationStyleIterationStyle91         IterationStyle(const QPen &pen, const QBrush &brush)
92             : isValid(true),
93               stylePair(pen, brush)
94         {
95         }
96 
97         bool isValid;
98         QPair<QPen, QBrush> stylePair;
99     };
100 
101     QVector<IterationStyle> handleIterations;
102     QVector<IterationStyle> lineIterations;
103 };
104 
105 #endif // KISHANDLESTYLE_H
106