]> SALOME platform Git repositories - modules/gui.git/blob - src/Style/Style_Salome.h
Salome HOME
75659e9ac5901b90eae46a4320cf6fe2f9106cad
[modules/gui.git] / src / Style / Style_Salome.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_Salome.h
23 // Author : Natalia Ermolaeva, Open CASCADE S.A.S.
24 //
25 #ifndef STYLE_SALOME_H
26 #define STYLE_SALOME_H
27
28 #include "Style.h"
29
30 #include <QWindowsStyle>
31
32 class Style_Model;
33
34 class QApplication;
35 class QWidget;
36 class QPainter;
37 class QtxResourceMgr;
38
39 class STYLE_SALOME_EXPORT Style_Salome : public QWindowsStyle
40 {
41   Q_OBJECT
42
43 private:
44   Style_Salome();
45
46 public:
47   virtual ~Style_Salome();
48
49   static void         initialize( QtxResourceMgr* = 0, const QString& = QString() );
50   static void         apply();
51   static void         restore();
52
53   static bool         isActive();
54
55   static Style_Model* model();
56
57   static void         update();
58
59   virtual void        polish( QApplication* );
60   virtual void        polish( QWidget* );
61   virtual void        unpolish( QWidget* );
62   virtual void        drawComplexControl( ComplexControl, const QStyleOptionComplex*,
63                                           QPainter*, const QWidget* = 0 ) const;
64   
65   virtual void        drawControl( ControlElement, const QStyleOption*, QPainter*, const QWidget* ) const;
66   virtual void        drawPrimitive( PrimitiveElement, const QStyleOption*,
67                                      QPainter*, const QWidget* = 0 ) const;
68   virtual int         pixelMetric( PixelMetric, const QStyleOption* = 0,
69                                    const QWidget* = 0 ) const;
70   virtual QSize       sizeFromContents ( ContentsType, const QStyleOption*,
71                                          const QSize&, const QWidget* = 0 ) const;
72   virtual QPixmap     standardPixmap( StandardPixmap, const QStyleOption*,
73                                       const QWidget* = 0) const;
74   virtual int         styleHint( StyleHint, const QStyleOption* = 0,
75                                  const QWidget* = 0, QStyleHintReturn* = 0 ) const;
76   virtual QRect       subControlRect( ComplexControl, const QStyleOptionComplex*,
77                                       SubControl, const QWidget* = 0 ) const;
78   virtual QRect       subElementRect( SubElement, const QStyleOption*, const QWidget* = 0 ) const;
79
80 protected slots:
81   QIcon               standardIconImplementation( StandardPixmap, const QStyleOption* = 0,
82                                                   const QWidget* = 0 ) const;
83 private:
84   void                updatePaletteColors();
85   void                updateAllWidgets( QApplication* );
86   bool                hasHover() const;
87   void                drawHoverRect( QPainter*, const QRect&, const QColor&, const double,
88                                      const int, const bool ) const;
89   void                drawHandle( QPainter*, const QRect&, bool, bool = true ) const;
90   void                drawBackground( QPainter*, const QRect&, const QColor&, const bool,
91                                       const bool = false, const bool = true ) const;
92   void                drawBorder( QPainter*, const QRect&, bool ) const;
93
94   QString             titleText( const QString&, const int, const int, QFont& ) const;
95
96 private:
97   static Style_Model* myModel;
98 };
99
100 #endif // STYLE_SALOME_H