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