Salome HOME
updated copyright message
[modules/gui.git] / src / Style / Style_Tools.h
1 // Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // File   : Style_Tools.h
21 // Author : Natalia Ermolaeva, Open CASCADE S.A.S.
22 //
23 #ifndef STYLE_TOOLS_H
24 #define STYLE_TOOLS_H
25
26 #include "Style.h"
27
28 #include <QPainterPath>
29 #include <QRect>
30 #include <QColor>
31 #include <QStyle>
32
33 //
34 // This class is private for Style package.
35 // Normally it should not be exported.
36 //
37 class STYLE_SALOME_EXPORT Style_Tools
38 {
39 public:
40   //! Rounding operation type
41   typedef enum {
42     None        = 0x00000000,       //!< No rounding required
43     All         = 0x00000001,       //!< All corners
44     Right       = 0x00000002,       //!< Right corners
45     Left        = 0x00000004,       //!< Left corners
46     TopLeft     = 0x00000008,       //!< Top-left corner
47     TopRight    = 0x00000010,       //!< Top-right corner
48     BottomLeft  = 0x00000020,       //!< Bottom-left corner
49     BottomRight = 0x00000040        //!< Bottom-right corner
50   } RoundType;
51
52   //! Shadow type
53   typedef enum {
54     WholePath,        //!< Whole path
55     BottomPath,       //!< Bottom path
56     TopPath           //!< Top path
57   } ShadowType;
58
59   //! Slider type
60   typedef enum {
61     SlUp,             //!< Up-to-down gradient
62     SlDown,           //!< Down-to-up gradient
63     SlLeft,           //!< Left-to-right gradient
64     SlRight,          //!< Right-to-left gradient
65     SlNone            //!< No gradient
66   } SliderType;
67
68   static QPainterPath painterPath( const QRect& );
69   static QPainterPath substractPath( const QPainterPath&, const QPainterPath& );
70
71   static QPainterPath roundRect( const QRect&, const double, int = 0, int = 0 );
72
73   static void         roundRect( QPainter*, const QRect&, const double, const int,
74                                  const QColor&, const QColor&, bool = true, bool = true );
75
76   static void         shadowRect( QPainter*, const QRect&, const double,
77                                   const double, const int, int,
78                                   const QColor&, const QColor&, const QColor&,
79                                   const QColor&, const bool, const bool,
80                                   const bool = false, const bool = true );
81   static void         shadowCheck( QPainter*, const QRect&, const double, const int,
82                                    const QColor&, const QColor&,
83                                    const QColor&, const QColor& );
84   static void         arrowRect( QPainter*, const QRect&, const QColor&,
85                                  const QColor&, const QColor& );
86   static void         fillRect( QPainter*, const QRect&, const QColor&,
87                                 const QColor&, const int = 255 );
88   static void         drawArrow( QStyle::PrimitiveElement, QPainter*, const QRect&,
89                                  const QColor&, const QColor& );
90   static void         drawSign( QStyle::PrimitiveElement, QPainter*, const QRect&,
91                                 const QColor&, const QColor& );
92   static QPainterPath tabRect( QPainter*, const QRect&, const int, const double,
93                                const double, const QColor&, const QColor&,
94                                const QColor&, const QColor&,
95                                const bool, const bool, const bool,
96                                const bool = false, const bool = true );
97   static void         drawFocus( QPainter*, const QRect&, const double, const int,
98                                  const QColor& );
99   static void         drawFocus( QPainter*, const QPainterPath&, const QColor&,
100                                  const bool = true );
101   static void         drawSlider( QPainter*, const QRect&, const double,
102                                   SliderType, const QColor&, const QColor&,
103                                   const QColor&, const QColor& );
104   static void         highlightRect( QPainter*, const QRect&, const double, const int,
105                                      const double, const QColor&, const QColor&,
106                                      const QColor& );
107   static int          getMinDelta( const QRect&, const QSize&, const int );
108   static int          getMaxRect( const QRect&, const int );
109 };
110
111 #endif // STYLE_TOOLS_H