Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Style_Salome.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, 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_Salome.h
21 // Author : Natalia Ermolaeva, Open CASCADE S.A.S.
22 //
23 #ifndef STYLE_SALOME_H
24 #define STYLE_SALOME_H
25 
26 #include <QtGlobal>
27 #include "Style.h"
28 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
29 #include <QWindowsStyle>
30 #define BaseStyle QWindowsStyle
31 #else
32 #include <QCommonStyle>
33 #define BaseStyle QCommonStyle
34 #endif
35 class Style_Model;
36 
37 class QApplication;
38 class QWidget;
39 class QPainter;
40 class QtxResourceMgr;
41 
43 {
44  Q_OBJECT
45 
46 private:
47  Style_Salome();
48 
49 public:
50  virtual ~Style_Salome();
51 
52  static void initialize( QtxResourceMgr* = 0, const QString& = QString() );
53  static void apply();
54  static void restore();
55 
56  static bool isActive();
57 
58  static Style_Model* model();
59 
60  static void update();
61 
62  virtual void polish( QApplication* );
63  virtual void polish( QWidget* );
64  virtual void unpolish( QWidget* );
65  virtual void drawComplexControl( ComplexControl, const QStyleOptionComplex*,
66  QPainter*, const QWidget* = 0 ) const;
67 
68  virtual void drawControl( ControlElement, const QStyleOption*, QPainter*, const QWidget* ) const;
69  virtual void drawPrimitive( PrimitiveElement, const QStyleOption*,
70  QPainter*, const QWidget* = 0 ) const;
71  virtual int pixelMetric( PixelMetric, const QStyleOption* = 0,
72  const QWidget* = 0 ) const;
73  virtual QSize sizeFromContents ( ContentsType, const QStyleOption*,
74  const QSize&, const QWidget* = 0 ) const;
75  virtual QPixmap standardPixmap( StandardPixmap, const QStyleOption*,
76  const QWidget* = 0) const;
77  virtual int styleHint( StyleHint, const QStyleOption* = 0,
78  const QWidget* = 0, QStyleHintReturn* = 0 ) const;
79  virtual QRect subControlRect( ComplexControl, const QStyleOptionComplex*,
80  SubControl, const QWidget* = 0 ) const;
81  virtual QRect subElementRect( SubElement, const QStyleOption*, const QWidget* = 0 ) const;
82 
83 protected slots:
84  QIcon standardIconImplementation( StandardPixmap, const QStyleOption* = 0,
85  const QWidget* = 0 ) const;
86 private:
87  void updatePaletteColors();
88  void updateAllWidgets( QApplication* );
89  bool hasHover() const;
90  void drawHoverRect( QPainter*, const QRect&, const QColor&, const double,
91  const int, const bool ) const;
92  void drawHandle( QPainter*, const QRect&, bool, bool = true ) const;
93  void drawBackground( QPainter*, const QRect&, const QColor&, const bool,
94  const bool = false, const bool = true ) const;
95  void drawBorder( QPainter*, const QRect&, bool ) const;
96 
97  QString titleText( const QString&, const int, const int, QFont& ) const;
98 
99 private:
101 };
102 
103 #endif // STYLE_SALOME_H