Back to index

salome-gui  6.5.0
Style_Salome.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 // File   : Style_Salome.h
00021 // Author : Natalia Ermolaeva, Open CASCADE S.A.S.
00022 //
00023 #ifndef STYLE_SALOME_H
00024 #define STYLE_SALOME_H
00025 
00026 #include "Style.h"
00027 
00028 #include <QWindowsStyle>
00029 
00030 class Style_Model;
00031 
00032 class QApplication;
00033 class QWidget;
00034 class QPainter;
00035 class QtxResourceMgr;
00036 
00037 class STYLE_SALOME_EXPORT Style_Salome : public QWindowsStyle
00038 {
00039   Q_OBJECT
00040 
00041 private:
00042   Style_Salome();
00043 
00044 public:
00045   virtual ~Style_Salome();
00046 
00047   static void         initialize( QtxResourceMgr* = 0, const QString& = QString() );
00048   static void         apply();
00049   static void         restore();
00050 
00051   static bool         isActive();
00052 
00053   static Style_Model* model();
00054 
00055   static void         update();
00056 
00057   virtual void        polish( QApplication* );
00058   virtual void        polish( QWidget* );
00059   virtual void        unpolish( QWidget* );
00060   virtual void        drawComplexControl( ComplexControl, const QStyleOptionComplex*,
00061                                           QPainter*, const QWidget* = 0 ) const;
00062   
00063   virtual void        drawControl( ControlElement, const QStyleOption*, QPainter*, const QWidget* ) const;
00064   virtual void        drawPrimitive( PrimitiveElement, const QStyleOption*,
00065                                      QPainter*, const QWidget* = 0 ) const;
00066   virtual int         pixelMetric( PixelMetric, const QStyleOption* = 0,
00067                                    const QWidget* = 0 ) const;
00068   virtual QSize       sizeFromContents ( ContentsType, const QStyleOption*,
00069                                          const QSize&, const QWidget* = 0 ) const;
00070   virtual QPixmap     standardPixmap( StandardPixmap, const QStyleOption*,
00071                                       const QWidget* = 0) const;
00072   virtual int         styleHint( StyleHint, const QStyleOption* = 0,
00073                                  const QWidget* = 0, QStyleHintReturn* = 0 ) const;
00074   virtual QRect       subControlRect( ComplexControl, const QStyleOptionComplex*,
00075                                       SubControl, const QWidget* = 0 ) const;
00076   virtual QRect       subElementRect( SubElement, const QStyleOption*, const QWidget* = 0 ) const;
00077 
00078 protected slots:
00079   QIcon               standardIconImplementation( StandardPixmap, const QStyleOption* = 0,
00080                                                   const QWidget* = 0 ) const;
00081 private:
00082   void                updatePaletteColors();
00083   void                updateAllWidgets( QApplication* );
00084   bool                hasHover() const;
00085   void                drawHoverRect( QPainter*, const QRect&, const QColor&, const double,
00086                                      const int, const bool ) const;
00087   void                drawHandle( QPainter*, const QRect&, bool, bool = true ) const;
00088   void                drawBackground( QPainter*, const QRect&, const QColor&, const bool,
00089                                       const bool = false, const bool = true ) const;
00090   void                drawBorder( QPainter*, const QRect&, bool ) const;
00091 
00092   QString             titleText( const QString&, const int, const int, QFont& ) const;
00093 
00094 private:
00095   static Style_Model* myModel;
00096 };
00097 
00098 #endif // STYLE_SALOME_H