]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Salome style added
authorstv <stv@opencascade.com>
Fri, 3 Jun 2005 11:39:56 +0000 (11:39 +0000)
committerstv <stv@opencascade.com>
Fri, 3 Jun 2005 11:39:56 +0000 (11:39 +0000)
src/Makefile.in
src/Style/Makefile.in [new file with mode: 0644]
src/Style/SalomeStyle.cxx [new file with mode: 0644]
src/Style/SalomeStyle.h [new file with mode: 0644]

index 390f8773defaeccc1ba96e8bf59851f3c94c8d12..d957681b2115488b48369046388dc0ea90e6f220 100755 (executable)
@@ -34,6 +34,6 @@ VPATH=.:@srcdir@
 
 SUBDIRS = Qtx SUIT STD CAF CAM SUITApp VTKViewer OCCViewer GLViewer \
           LogWindow Event Loader OBJECT Prs PyInterp PythonConsole ObjBrowser \
-          RegistryDisplay Plot2d TOOLSGUI SOCC SVTK SPlot2d Session SalomeApp SALOME_SWIG SALOME_PY SUPERVGraph SALOME_PYQT
+          RegistryDisplay Plot2d TOOLSGUI SOCC SVTK SPlot2d Session SalomeApp SALOME_SWIG SALOME_PY SUPERVGraph SALOME_PYQT Style
 
 @MODULE@
diff --git a/src/Style/Makefile.in b/src/Style/Makefile.in
new file mode 100644 (file)
index 0000000..c947ad3
--- /dev/null
@@ -0,0 +1,36 @@
+#  File   : Makefile.in
+#  Author : Vladimir Klyachin (OCN)
+#  Module : SalomeApp
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@srcdir@/resources
+
+
+@COMMENCE@
+
+# header files 
+EXPORT_HEADERS=
+
+# .po files to transform in .qm
+PO_FILES =
+
+# Libraries targets
+LIB = libSalomeStyle.la
+
+LIB_SRC= SalomeStyle.cxx
+
+LIB_MOC =
+
+LIB_CLIENT_IDL =
+
+RESOURCES_FILES =
+
+CPPFLAGS+=$(QT_INCLUDES)
+
+LDFLAGS+=$(QT_MT_LIBS)
+LIBS+=
+
+@CONCLUDE@
+
diff --git a/src/Style/SalomeStyle.cxx b/src/Style/SalomeStyle.cxx
new file mode 100644 (file)
index 0000000..d98a0f1
--- /dev/null
@@ -0,0 +1,1159 @@
+#include "SalomeStyle.h"\r
+\r
+#include <qimage.h>\r
+#include <qcursor.h>\r
+#include <qtabbar.h>\r
+#include <qpalette.h>\r
+#include <qtoolbar.h>\r
+#include <qspinbox.h>\r
+#include <qpainter.h>\r
+#include <qlineedit.h>\r
+#include <qlistview.h>\r
+#include <qdrawutil.h>\r
+#include <qpopupmenu.h>\r
+#include <qpushbutton.h>\r
+#include <qobjectlist.h>\r
+#include <qtoolbutton.h>\r
+#include <qapplication.h>\r
+\r
+static const char* const hole_xpm[] = {\r
+"3 3 3 1",\r
+". c None",\r
+"a c #999999",\r
+"b c #FFFFFF",\r
+"aa.",\r
+"aab",\r
+".bb"\r
+};\r
+\r
+static const char* const cross_xpm[] = {\r
+"12 12 4 1",\r
+". c None",\r
+"a c #000000",\r
+"b c #FFFFFF",\r
+"c c #666666",\r
+"............",\r
+"............",\r
+"............",\r
+".aaaa..aaaa.",\r
+"..abbaabba..",\r
+"...abbbba...",\r
+"....abba....",\r
+"...abbbba...",\r
+"..abbaabba..",\r
+".aaaa..aaaa.",\r
+"............",\r
+"............"\r
+};\r
+\r
+static const char* const maximize_xpm[] = {\r
+"12 12 4 1",\r
+". c None",\r
+"a c #000000",\r
+"b c #FFFFFF",\r
+"c c #666666",\r
+"............",\r
+".aaaaaaaaaa.",\r
+".acccccccca.",\r
+".acccccccca.",\r
+".abbbbbbbba.",\r
+".abbbbbbbba.",\r
+".abbbbbbbba.",\r
+".abbbbbbbba.",\r
+".abbbbbbbba.",\r
+".abbbbbbbba.",\r
+".aaaaaaaaaa.",\r
+"............"\r
+};\r
+\r
+static const char* const normal_xpm[] = {\r
+"12 12 4 1",\r
+". c None",\r
+"a c #000000",\r
+"b c #FFFFFF",\r
+"c c #666666",\r
+"............",\r
+"...aaaaaaaa.",\r
+"...acccccca.",\r
+"...abbbbbba.",\r
+"...aaaaaaba.",\r
+".aaaaaaaaba.",\r
+".accccccaba.",\r
+".abbbbbbaaa.",\r
+".abbbbbba...",\r
+".abbbbbba...",\r
+".aaaaaaaa...",\r
+"............"\r
+};\r
+\r
+static const char* const minimize_xpm[] = {\r
+"12 12 4 1",\r
+". c None",\r
+"a c #000000",\r
+"b c #FFFFFF",\r
+"c c #666666",\r
+"............",\r
+"............",\r
+"............",\r
+"............",\r
+"............",\r
+"............",\r
+"............",\r
+"............",\r
+"aaaaaaaaaaaa",\r
+"abbbbbbbbbba",\r
+"aaaaaaaaaaaa",\r
+"............"\r
+};\r
+\r
+/*!\r
+    Class: SalomeStyle [Public]\r
+    Descr: Style for SALOME platform\r
+*/\r
+\r
+SalomeStyle::SalomeStyle()\r
+: myTitleParent( 0 )\r
+{\r
+  qApp->installEventFilter( this ); \r
+}\r
+\r
+SalomeStyle::~SalomeStyle()\r
+{\r
+}\r
+\r
+void SalomeStyle::polish( QWidget* w )\r
+{\r
+  if ( !w )\r
+    return;\r
+/*\r
+  if ( w->inherits( "QLineEdit" ) )\r
+  {\r
+    QLineEdit* fr = (QLineEdit*)w;\r
+    if ( w->parentWidget() && w->parentWidget()->inherits( "QSpinWidget" ) )\r
+      fr->setFrameStyle( QFrame::Plain );\r
+    else\r
+    {\r
+      fr->setFrameStyle( QFrame::Plain | QFrame::Box );\r
+      fr->setLineWidth( 1 );\r
+      fr->setMidLineWidth( 0 );\r
+    }\r
+  }\r
+  else\r
+*/\r
+  if ( w->inherits( "QToolBar" ) )\r
+  {\r
+    QToolBar* tb = (QToolBar*)w;\r
+    tb->setFrameStyle( QFrame::ToolBarPanel | QFrame::Plain );\r
+    tb->setLineWidth( 1 );\r
+    tb->setMidLineWidth( 1 );\r
+  }\r
+  else\r
+  if ( w->inherits( "QDockWindow" ) )\r
+  {\r
+    QDockWindow* dw = (QDockWindow*)w;\r
+    dw->setFrameStyle( QFrame::ToolBarPanel | QFrame::Raised );\r
+  }\r
+/*\r
+  else if ( w->inherits( "QListView" ) )\r
+  {\r
+    QListView* lv = (QListView*)w;\r
+    lv->setFrameStyle( QFrame::Box | QFrame::Plain );\r
+  }\r
+*/\r
+  else\r
+    PARENT_STYLE::polish( w );\r
+}\r
+\r
+bool SalomeStyle::eventFilter( QObject* o, QEvent* e )\r
+{\r
+  if ( e->type() == QEvent::FocusIn || e->type() == QEvent::FocusOut )\r
+  {\r
+    QDockWindow* wnd = NULL;\r
+    while( o && !wnd )\r
+      if( o->inherits( "QDockWindow" ) )\r
+        wnd = ( QDockWindow* )o;\r
+      else\r
+        o = o->parent();\r
+\r
+    if ( wnd )\r
+    {\r
+      const QObjectList* objList = o->children();\r
+      for( QObjectListIterator anIt( *objList ); anIt.current(); ++anIt )\r
+        if( anIt.current()->inherits( "QDockWindowHandle" ) )\r
+        {\r
+          QWidget* ww = ( QWidget* )anIt.current();\r
+          ww->repaint( ww->rect() );\r
+          const QObjectList* wc = ww->children();\r
+          for( QObjectListIterator anIt2( *wc ); anIt2.current(); ++anIt2 )\r
+            if( anIt2.current()->inherits( "QToolButton" ) )\r
+            {\r
+              QWidget* tb = ( QWidget* )anIt2.current();\r
+              tb->repaint( tb->rect() );\r
+            }\r
+        }      \r
+    }\r
+  }\r
+\r
+  if ( o && o->inherits( "QPushButton" ) && ( e->type() == QEvent::Enter || e->type() == QEvent::Leave ) )\r
+    ((QWidget*)o)->update();\r
+\r
+  return false;\r
+}\r
+\r
+double linear( double x )\r
+{\r
+  return x;\r
+}\r
+\r
+void SalomeStyle::mix( const double t, const QColor& c1, const QColor& c2, QColor& res )\r
+{\r
+  if( t<0.0 || t>1.0 )\r
+    return;\r
+\r
+  int r = int( c1.red() * (1-t) + c2.red() * t ),\r
+      g = int( c1.green() * (1-t) + c2.green() * t ),\r
+      b = int( c1.blue() * (1-t) + c2.blue() * t );\r
+  res.setRgb( r, g, b );\r
+}\r
+\r
+void SalomeStyle::mix( const double t, QRgb& rgb1, const QRgb& rgb2 )\r
+{\r
+  if( t<0.0 || t>1.0 )\r
+    return;\r
+\r
+  int c[2][4] = { qRed( rgb1 ), qGreen( rgb1 ), qBlue( rgb1 ), qAlpha( rgb1 ),\r
+                  qRed( rgb2 ), qGreen( rgb2 ), qBlue( rgb2 ), qAlpha( rgb2 ) };\r
+  for( int i=0; i<4; i++ )\r
+    c[0][i] = c[0][i] * (1-t) + c[1][i] * t;\r
+\r
+  rgb1 = qRgba( c[0][0], c[0][1], c[0][2], qAlpha( rgb1 ) );\r
+}\r
+\r
+void SalomeStyle::mix( const double t, QPixmap& pix, const QColor& col )\r
+{\r
+  if( t<0.0 || t>1.0 )\r
+    return;\r
+\r
+  QImage anImage = pix.convertToImage();\r
+  if( anImage.isNull() )\r
+    return;\r
+\r
+  if( anImage.depth()!=32 )\r
+    anImage = anImage.convertDepth( 32 );\r
+\r
+  int w = anImage.width(),\r
+      h = anImage.height();\r
+\r
+  QRgb colrgb = col.rgb(), cur;\r
+  for( int y=0; y<h; y++ )\r
+  {\r
+    uchar* line = anImage.scanLine( y );\r
+    QRgb*  colorline = ( QRgb* ) line;\r
+    for( int x=0; x<w; x++ )\r
+    {\r
+      cur = colorline[ x ];\r
+      mix( t, cur, colrgb );\r
+      colorline[ x ] = cur;\r
+    }\r
+  }\r
+  pix = anImage;\r
+}\r
+\r
+void SalomeStyle::toGrayscale( QPixmap& pix, double k )\r
+{\r
+  QImage anImage = pix.convertToImage();\r
+  if( anImage.isNull() )\r
+    return;\r
+\r
+  if( anImage.depth()!=32 )\r
+    anImage = anImage.convertDepth( 32 );\r
+\r
+  int w = anImage.width(),\r
+      h = anImage.height();\r
+\r
+  for( int y=0; y<h; y++ )\r
+  {\r
+    uchar* line = anImage.scanLine( y );\r
+    QRgb*  colorline = ( QRgb* ) line;\r
+    for( int x=0; x<w; x++ )\r
+    {\r
+      int gray = k*qGray( colorline[ x ] );\r
+      if( gray>255 )\r
+        gray = 255;\r
+      else if( gray<0 )\r
+        gray = 0;\r
+      colorline[ x ] = qRgba( gray, gray, gray, qAlpha( colorline[x] ) );\r
+    }\r
+  }\r
+  pix = anImage;\r
+}\r
+\r
+void SalomeStyle::drawGradient( QPainter* p, const QRect& r,\r
+                                    const QColor& c1, const QColor& c2,\r
+                                    const Direction d, gradient_func f ) const \r
+{\r
+  p->save();\r
+  p->translate( r.x(), r.y() );\r
+\r
+  QColor mid;\r
+  if( d==LeftToRight || d==RightToLeft )\r
+    for( int xmax = r.width(), x = d==LeftToRight ? 0 : xmax;\r
+         d==LeftToRight ? x<=xmax : x>=0;\r
+         d==LeftToRight ? x++ : x-- )\r
+    {\r
+      double t = double( x ) / double( xmax );\r
+      mix( d==LeftToRight ? f(t) : 1-f(t), c1, c2, mid );\r
+      p->setPen( mid );\r
+      p->drawLine( x, 0, x, r.height() );\r
+    }\r
+  else\r
+    for( int ymax = r.height(), y = d==UpToDown ? 0 : ymax;\r
+         d==UpToDown ? y<=ymax : y>=0;\r
+         d==UpToDown ? y++ : y-- )\r
+    {\r
+      double t = double( y ) / double( ymax );\r
+      mix( d==UpToDown ? f(t) : 1-f(t), c1, c2, mid );\r
+      p->setPen( mid );\r
+      p->drawLine( 0, y, r.width(), y );\r
+    }\r
+\r
+  p->restore();\r
+}\r
+\r
+void SalomeStyle::drawPrimitive( PrimitiveElement pe, QPainter* p, const QRect& r,\r
+                                                        const QColorGroup& cg, SFlags flags, const QStyleOption& opt ) const\r
+{\r
+  switch ( pe )\r
+  {\r
+  case PE_ButtonTool:\r
+    if ( !myTitleParent )\r
+      PARENT_STYLE::drawPrimitive( pe, p, r, cg, flags, opt );\r
+    break;\r
+\r
+  case PE_DockWindowResizeHandle:\r
+    p->fillRect( r.x(), r.y(), r.width(), r.height(), cg.dark() );\r
+    if ( flags & Style_Horizontal )\r
+      p->fillRect( r.x(), r.y() + 1, r.width(), r.height() - 2, cg.midlight() );\r
+    else\r
+      p->fillRect( r.x() + 1, r.y(), r.width() - 2, r.height(), cg.midlight() );\r
+    break;\r
+\r
+  case PE_DockWindowHandle:\r
+    {\r
+      QPaintDevice* pd = p->device();\r
+      if ( !pd )\r
+        break;\r
+\r
+      QWidget* w = (QWidget*)pd;\r
+\r
+      if ( !w || !w->inherits( "QDockWindowHandle" ) )\r
+        break;\r
+\r
+      QDockWindow* wnd = ( QDockWindow* ) w->parent();\r
+      if ( !wnd )\r
+        return;\r
+\r
+      QObject* activeWidget = qApp->focusWidget();\r
+      QDockWindow* activeWnd = 0;\r
+      while ( !activeWnd && activeWidget )\r
+      {\r
+        if ( activeWidget->inherits( "QDockWindow" ) )\r
+          activeWnd = (QDockWindow*)activeWidget;\r
+        else\r
+          activeWidget = activeWidget->parent();\r
+      }\r
+\r
+           bool act = wnd == activeWnd, horiz = flags & Style_Horizontal;\r
+\r
+      QPixmap hole( (const char**)hole_xpm );\r
+\r
+      if ( wnd->inherits( "QToolBar" ) )\r
+      {\r
+        drawGradient( p, r, cg.light(), cg.background(), horiz ? UpToDown : LeftToRight, linear );\r
+\r
+        int c = 4, i; double d = ( horiz ? r.height() : r.width() ) / (c+1);\r
+        QBrush fill = cg.brush( QColorGroup::Dark );\r
+        p->setPen( Qt::red );\r
+        for ( i = 0; i < c; i++ )\r
+        {\r
+          if ( horiz )\r
+            p->drawPixmap( r.x()+r.width()/2-1, r.y()+(i+1)*d-1, hole );\r
+          else\r
+            p->drawPixmap( r.x()+(i+1)*d-1, r.y()+r.height()/2-1, hole );\r
+        }\r
+\r
+        int dd = (int(d)/2) + (int(d)%2);\r
+        for ( i = 0; i < c - 1; i++ )\r
+        {\r
+          if ( horiz )\r
+            p->drawPixmap( r.x()+r.width()/2+2, r.y()+dd+(i+1)*d-1, hole );\r
+          else\r
+            p->drawPixmap( r.x()+dd+(i+1)*d-1, r.y()+r.height()/2+2, hole );\r
+        }\r
+      }\r
+      else\r
+      {\r
+        int d = 1;\r
+        QRect rr( r.x()+d, r.y()+d, r.width()-2*d, r.height()-2*d );\r
+\r
+        QColor col; \r
+        if ( act )\r
+          mix( 0.5, cg.highlight(), Qt::white, col );\r
+        else\r
+          col = cg.background();\r
+\r
+        drawGradient( p, rr, act ? cg.highlight() : cg.dark(), col,\r
+                      horiz ? LeftToRight : UpToDown, linear );\r
+      }\r
+      break;\r
+    }\r
+\r
+  case PE_DockWindowSeparator:\r
+    {\r
+      bool horiz = ( flags & Style_Horizontal );\r
+      QWidget* w = ( QWidget* )p->device();\r
+      if( w->inherits( "QToolBarSeparator" ) )\r
+      {\r
+        drawGradient( p, r, cg.light(), cg.background(), horiz ? UpToDown : LeftToRight, linear );\r
+        int w = r.width(), h = r.height();\r
+        int part = 8;\r
+\r
+        p->setPen( cg.dark() );\r
+        if( horiz )\r
+          p->drawLine( r.x() + w/2, r.y() + h/part, r.x() + w/2, r.y() + (part-1)*h/part );\r
+        else\r
+          p->drawLine( r.x() + w/part, r.y() + h/2, r.x() + (part-1)*w/part, r.y() + h/2 );\r
+\r
+        p->setPen( cg.light() );\r
+        if( horiz )\r
+          p->drawLine( r.x() + w/2 + 1, r.y() + h/part + 1, r.x() + w/2 + 1, r.y() + (part-1)*h/part + 1 );\r
+        else\r
+          p->drawLine( r.x() + w/part + 1, r.y() + h/2 + 1, r.x() + (part-1)*w/part + 1, r.y() + h/2 + 1 );\r
+      }\r
+      else\r
+        PARENT_STYLE::drawPrimitive( pe, p, r, cg, flags, opt );\r
+      break;\r
+    }\r
+    \r
+  case PE_PanelDockWindow:\r
+    {\r
+      QWidget* w = ( QWidget* )p->device();\r
+\r
+      int offset = pixelMetric( PM_DockWindowHandleExtent, w );\r
+      if ( w->inherits( "QToolBar" ) )\r
+      {\r
+        bool vert = ( ( QToolBar* )w )->orientation() == Qt::Vertical;\r
+        if ( vert )\r
+          drawGradient( p, QRect( r.x(), r.y()+offset, r.x()+r.width(), r.y()+offset ),\r
+                        cg.light(), cg.background(), LeftToRight, linear );\r
+        else\r
+          drawGradient( p, QRect( r.x()+offset, r.y(), r.x()+offset, r.y()+r.height() ),\r
+                        cg.light(), cg.background(), UpToDown, linear );\r
+\r
+        p->setPen( QPen( cg.light(), 1 ) );\r
+        p->drawRect( r );\r
+      }\r
+      else\r
+      {\r
+        p->setPen( QPen( cg.dark(), 1 ) );\r
+        p->setBrush( cg.light() );\r
+        p->drawRect( r );\r
+      }\r
+\r
+      break;\r
+    }\r
+\r
+  case PE_PanelPopup:\r
+    p->setPen( QPen( cg.dark(), 1 ) );\r
+    p->setBrush( cg.light() );\r
+    p->drawRect( r );\r
+    break;\r
+\r
+  case PE_HeaderSection:\r
+    {\r
+      QColor col; mix( 0.2, cg.light(), Qt::black, col );\r
+      drawGradient( p, r, cg.light(), col, DownToUp, linear );\r
+      drawGradient( p, QRect( r.x(), r.y(), 1, r.height() ), cg.light(), cg.dark(), DownToUp, linear );\r
+      p->setPen( cg.dark() );\r
+      p->drawLine( r.x(), r.y()+r.height()-1, r.x()+r.width(), r.y()+r.height()-1 );\r
+      break;\r
+    }\r
+\r
+  case PE_Splitter:\r
+    p->fillRect( r.x() + 1, r.y() + 1, r.width() - 2, r.height() - 2, cg.dark() );\r
+    p->fillRect( r.x() + 2, r.y() + 2, r.width() - 4, r.height() - 4, cg.midlight() );\r
+         break;\r
+\r
+  case PE_ButtonBevel:\r
+    PARENT_STYLE::drawPrimitive( PE_ButtonDropDown, p, r, cg, flags, opt );\r
+    break;\r
+\r
+  case PE_ButtonCommand:\r
+    {\r
+      QColorGroup cGrp( cg );\r
+      if ( flags & Style_MouseOver )\r
+        cGrp.setColor( QColorGroup::Button, cGrp.midlight() );\r
+\r
+      if ( flags & Style_MouseOver )\r
+        PARENT_STYLE::drawPrimitive( PE_ButtonDropDown, p, r, cGrp, flags, opt );\r
+      else\r
+        PARENT_STYLE::drawPrimitive( flags & Style_Raised ? PE_ButtonDropDown : pe, p, r, cGrp, flags, opt );\r
+    }\r
+    break;\r
+\r
+  default:\r
+    PARENT_STYLE::drawPrimitive( pe, p, r, cg, flags, opt );\r
+    break;\r
+  }\r
+}\r
+\r
+void SalomeStyle::drawControl( ControlElement element, QPainter* p, const QWidget* widget, const QRect& r,\r
+                               const QColorGroup& cg, SFlags flags, const QStyleOption& opt ) const \r
+{\r
+  switch( element )\r
+  {\r
+    case CE_PopupMenuItem:\r
+    {\r
+         if(! widget || opt.isDefault())\r
+           break;\r
+\r
+      const QPopupMenu *popupmenu = (const QPopupMenu *) widget;\r
+      QMenuItem *mi = opt.menuItem();\r
+      if( !mi )\r
+           break;\r
+\r
+         int tab = opt.tabWidth();\r
+         int maxpmw = opt.maxIconWidth();\r
+         bool dis = !( flags & Style_Enabled );\r
+         bool checkable = popupmenu->isCheckable();\r
+         bool act = flags & Style_Active;\r
+      bool use2000style = true;\r
+         int x, y, w, h;\r
+\r
+      int windowsItemFrame = 2,\r
+          windowsItemHMargin = 5,\r
+          windowsItemVMargin = 1,\r
+          windowsRightBorder = 2,\r
+          windowsArrowHMargin = 2;\r
+\r
+         r.rect(&x, &y, &w, &h);\r
+\r
+         if ( checkable )\r
+      {\r
+           // space for the checkmarks\r
+        if (use2000style)\r
+                 maxpmw = QMAX( maxpmw, 20 );\r
+               else\r
+                 maxpmw = QMAX( maxpmw, 12 );\r
+         }\r
+\r
+         int checkcol = maxpmw;\r
+\r
+         if ( mi && mi->isSeparator() )\r
+      {\r
+               p->setPen( cg.dark() );\r
+               p->drawLine( x+3*checkcol/2, y, x+w, y );\r
+               //p->setPen( cg.light() );\r
+               //p->drawLine( x, y+1, x+w, y+1 );\r
+               return;\r
+         }\r
+\r
+      QBrush fill = ( act && !dis ?\r
+                cg.brush( QColorGroup::Highlight ) :\r
+                        cg.brush( QColorGroup::Light ) );\r
+         p->fillRect( x, y, w, h, fill );\r
+\r
+         if( !mi )\r
+               return;\r
+\r
+         int xpos = x;\r
+         QRect vrect = visualRect( QRect( xpos, y, checkcol, h ), r );\r
+         int xvis = vrect.x();\r
+\r
+         if( mi->isChecked() )\r
+      {\r
+           if( act && !dis )\r
+                 qDrawShadePanel( p, xvis, y, checkcol, h,\r
+                           cg, TRUE, 1, &cg.brush( QColorGroup::Button ) );\r
+               else\r
+        {\r
+                 QBrush fill( cg.light(), Dense4Pattern );\r
+                 // set the brush origin for the hash pattern to the x/y coordinate\r
+                 // of the menu item's checkmark... this way, the check marks have\r
+                 // a consistent look\r
+                 QPoint origin = p->brushOrigin();\r
+                 p->setBrushOrigin( xvis, y );\r
+                 qDrawShadePanel( p, xvis, y, checkcol, h, cg, TRUE, 1, &fill );\r
+          // restore the previous brush origin\r
+                 p->setBrushOrigin( origin );\r
+               }\r
+         }\r
+      else if( !act )\r
+               p->fillRect(x+checkcol, y, w-checkcol , h, cg.brush( QColorGroup::Light ));\r
+\r
+      if( !( act && !dis ) && !mi->isChecked() )\r
+      {\r
+        QColor col; mix( 0.5, cg.mid(), Qt::white, col );\r
+        drawGradient( p, QRect( xvis, y, checkcol, h+1 ), cg.light(), col, LeftToRight, linear );\r
+      }\r
+\r
+      if( mi->iconSet() )\r
+      { // draw iconset\r
+               QIconSet::Mode mode = dis ? QIconSet::Active : QIconSet::Normal;\r
+               if(act && !dis )\r
+                 mode = QIconSet::Active;\r
+               QPixmap pixmap;\r
+               if( checkable && mi->isChecked() )\r
+                 pixmap = mi->iconSet()->pixmap( QIconSet::Small, mode, QIconSet::On );\r
+               else\r
+                 pixmap = mi->iconSet()->pixmap( QIconSet::Small, mode );\r
+               int pixw = pixmap.width();\r
+               int pixh = pixmap.height();\r
+\r
+        if( dis )\r
+          toGrayscale( pixmap, 1.1 );\r
+\r
+               //if( act && !dis && !mi->isChecked() )\r
+               //  qDrawShadePanel( p, xvis, y, checkcol, h, cg, FALSE, 1, &cg.brush( QColorGroup::Button ) );\r
+\r
+               QRect pmr( 0, 0, pixw, pixh );\r
+               pmr.moveCenter( vrect.center() );\r
+               p->setPen( cg.text() );\r
+               p->drawPixmap( pmr.topLeft(), pixmap );\r
+\r
+               QBrush fill = ( act ? cg.brush( QColorGroup::Highlight ) : cg.brush( QColorGroup::Light ));\r
+               int xp = xpos + checkcol + 1;\r
+        if( !dis )\r
+                 p->fillRect( visualRect( QRect( xp, y, w - checkcol - 1, h ), r ), fill);\r
+         }\r
+      else if( checkable )\r
+      {  // just "checking"...\r
+               if( mi->isChecked() )\r
+        {\r
+                 int xp = xpos + windowsItemFrame;\r
+\r
+                 SFlags cflags = Style_Default;\r
+                 if( !dis )\r
+                   cflags |= Style_Enabled;\r
+                 if( act )\r
+                       cflags |= Style_On;\r
+\r
+                 drawPrimitive( PE_CheckMark, p,\r
+                                        visualRect( QRect( xp, y + windowsItemFrame,\r
+                                            checkcol - 2*windowsItemFrame,\r
+                                            h - 2*windowsItemFrame), r ), cg, cflags, opt );\r
+               }\r
+         }\r
+\r
+         p->setPen( act ? cg.highlightedText() : cg.buttonText() );\r
+\r
+         QColor discol;\r
+         if( dis )\r
+      {\r
+               discol = cg.text();\r
+               p->setPen( discol );\r
+         }\r
+\r
+         int xm = windowsItemFrame + checkcol + windowsItemHMargin;\r
+         xpos += xm;\r
+\r
+         vrect = visualRect( QRect( xpos, y+windowsItemVMargin, w-xm-tab+1, h-2*windowsItemVMargin ), r );\r
+         xvis = vrect.x();\r
+         if( mi->custom() )\r
+      {\r
+               p->save();\r
+               if ( dis && !act )\r
+        {\r
+                 p->setPen( cg.light() );\r
+                 mi->custom()->paint( p, cg, act, !dis,\r
+                                                  xvis+1, y+windowsItemVMargin+1,\r
+                               w-xm-tab+1, h-2*windowsItemVMargin );\r
+                 p->setPen( discol );\r
+               }\r
+               mi->custom()->paint( p, cg, act, !dis, xvis, y+windowsItemVMargin,\r
+                             w-xm-tab+1, h-2*windowsItemVMargin );\r
+               p->restore();\r
+         }\r
+         QString s = mi->text();\r
+         if( !s.isNull() )\r
+      { // draw text\r
+               int t = s.find( '\t' );\r
+               int text_flags = AlignVCenter | ShowPrefix | DontClip | SingleLine;\r
+               if( !styleHint( SH_UnderlineAccelerator, widget ) )\r
+                 text_flags |= NoAccel;\r
+               text_flags |= (QApplication::reverseLayout() ? AlignRight : AlignLeft );\r
+               if( t >= 0 )\r
+        { // draw tab text\r
+                 int xp = x + w - tab - windowsItemHMargin - windowsItemFrame + 1;\r
+                 if( use2000style )\r
+                   xp -= 20;\r
+                 else\r
+                       xp -= windowsRightBorder;\r
+                 int xoff = visualRect( QRect( xp, y+windowsItemVMargin, tab, h-2*windowsItemVMargin ), r ).x();\r
+                 if( dis && !act )\r
+          {\r
+                       p->setPen( cg.light() );\r
+                       p->drawText( xoff+1, y+windowsItemVMargin+1, tab, h-2*windowsItemVMargin, text_flags, s.mid( t+1 ));\r
+                       p->setPen( discol );\r
+                 }\r
+                 p->drawText( xoff, y+windowsItemVMargin, tab, h-2*windowsItemVMargin, text_flags, s.mid( t+1 ) );\r
+                 s = s.left( t );\r
+               }\r
+               if( dis && !act )\r
+        {\r
+                 p->setPen( cg.light() );\r
+                 p->drawText( xvis+1, y+windowsItemVMargin+1, w-xm-tab+1, h-2*windowsItemVMargin, text_flags, s, t );\r
+                 p->setPen( discol );\r
+               }\r
+               p->drawText( xvis, y+windowsItemVMargin, w-xm-tab+1, h-2*windowsItemVMargin, text_flags, s, t );\r
+         }\r
+      else if( mi->pixmap() )\r
+      { // draw pixmap\r
+               QPixmap *pixmap = mi->pixmap();\r
+               if( pixmap->depth() == 1 )\r
+                 p->setBackgroundMode( OpaqueMode );\r
+               p->drawPixmap( xvis, y+windowsItemFrame, *pixmap );\r
+               if( pixmap->depth() == 1 )\r
+                 p->setBackgroundMode( TransparentMode );\r
+         }\r
+         if( mi->popup() )\r
+      { // draw sub menu arrow\r
+               int dim = (h-2*windowsItemFrame) / 2;\r
+               PrimitiveElement arrow;\r
+               arrow = ( QApplication::reverseLayout() ? PE_ArrowLeft : PE_ArrowRight );\r
+               xpos = x+w - windowsArrowHMargin - windowsItemFrame - dim;\r
+               vrect = visualRect( QRect(xpos, y + h / 2 - dim / 2, dim, dim), r );\r
+               if( act )\r
+        {\r
+                 QColorGroup g2 = cg;\r
+                 g2.setColor( QColorGroup::ButtonText, g2.highlightedText() );\r
+                 drawPrimitive( arrow, p, vrect, g2, dis ? Style_Default : Style_Enabled, opt );\r
+               }\r
+        else\r
+        {\r
+                 drawPrimitive( arrow, p, vrect, cg, dis ? Style_Default : Style_Enabled, opt );\r
+               }\r
+         }\r
+\r
+      if( act && !dis )\r
+      {\r
+        p->setPen( cg.dark() );\r
+        p->drawRect( r );\r
+      }\r
+         break;\r
+    }\r
+\r
+    case CE_MenuBarItem:\r
+       {\r
+      bool active = flags & Style_Active;\r
+         bool down = flags & Style_Down;\r
+         QRect pr = r;\r
+\r
+      p->save();\r
+      if( active && down )\r
+      {\r
+        //QColor col; mix( 0.5, cg.mid(), Qt::white, col );\r
+        //drawGradient( p, r, col, cg.light(), UpToDown, linear );\r
+        p->setPen( cg.light() );\r
+        p->setBrush( cg.light() );\r
+        p->drawRect( r );\r
+        \r
+        p->setPen( cg.dark() );\r
+        int w = r.width()-1, h = r.height();\r
+        p->drawLine( r.x(), r.y(), r.x()+w, r.y() );\r
+        p->drawLine( r.x(), r.y(), r.x(), r.y()+h );\r
+        p->drawLine( r.x()+w, r.y(), r.x()+w, r.y()+h );\r
+\r
+        p->translate( 1, 1 );\r
+      }\r
+      else\r
+        drawGradient( p, r, cg.light(), cg.background(), active ? DownToUp : UpToDown, linear );\r
+\r
+         QCommonStyle::drawControl(element, p, widget, pr, cg, flags, opt);\r
+      p->restore();\r
+         break;\r
+       }\r
+\r
+    case CE_MenuBarEmptyArea:\r
+    {\r
+      drawGradient( p, r, cg.light(), cg.background(), UpToDown, linear );\r
+         break;\r
+    }\r
+\r
+    case CE_ToolButtonLabel:\r
+       {\r
+      const QToolButton *toolbutton = (const QToolButton *) widget;\r
+      QObject* parent = toolbutton->parent();\r
+\r
+      QToolBar* tb = NULL;\r
+      while( parent )\r
+        if( parent->inherits( "QToolBar" ) )\r
+        {\r
+          tb = ( QToolBar* )parent;\r
+          break;\r
+        }\r
+        else\r
+          parent = parent->parent();\r
+      parent = toolbutton->parent();\r
+\r
+      int horiz = -1;\r
+      if( tb )\r
+      {\r
+        if( tb->orientation()==Qt::Horizontal )\r
+          horiz = 1;\r
+        else\r
+          horiz = 0;\r
+        drawGradient( p, r, cg.light(), cg.background(), horiz ? UpToDown : LeftToRight, linear );\r
+      }\r
+      else if( parent->inherits( "QDockWindowHandle" ) )\r
+      {\r
+        QWidget* w = ( QWidget* ) parent;\r
+        QDockWindow* wnd = ( QDockWindow* )w->parent();\r
+        if( !wnd->orientation()==Qt::Horizontal )\r
+          horiz=1;\r
+        else\r
+          horiz=0;\r
+\r
+        QPoint pp( r.x(), r.y() ),\r
+               qq = toolbutton->mapToParent( pp );\r
+        \r
+        bitBlt( p->device(), r.x(), r.y(), w, horiz ? qq.x()-r.width() : qq.x(),\r
+                horiz ? qq.y() : qq.y()+r.height(),\r
+                r.width(), r.height(), Qt::CopyROP, true );\r
+      }\r
+\r
+      bool highlight = ( flags & Style_MouseOver ),\r
+           down = ( flags & ( Style_Down | Style_On ) ),\r
+           en = toolbutton->isEnabled();\r
+\r
+      if( down )\r
+        if( horiz>=0 )\r
+        {\r
+          drawGradient( p, r, cg.light(), cg.background(), horiz==1 ? DownToUp : RightToLeft, linear );\r
+          p->setPen( cg.background() );\r
+          p->drawRect( r );\r
+        }\r
+        else\r
+        {\r
+          p->setPen( cg.dark() );\r
+          p->setBrush( cg.light() );\r
+          p->drawRect( r );\r
+        }\r
+      if( highlight )\r
+      {\r
+        p->setPen( cg.dark() );\r
+        QColor col; mix( 0.05, cg.background(), Qt::black, col );\r
+        p->setBrush( col );\r
+        p->drawRect( r );\r
+      }\r
+\r
+\r
+         QRect rect = r;\r
+         Qt::ArrowType arrowType = opt.isDefault() ? Qt::DownArrow : opt.arrowType();\r
+\r
+         int shiftX = 0, shiftY = 0;\r
+         if( flags & ( Style_Down | Style_On ) )\r
+      {\r
+               shiftX = pixelMetric(PM_ButtonShiftHorizontal, widget);\r
+               shiftY = pixelMetric(PM_ButtonShiftVertical, widget);\r
+         }\r
+\r
+         if (!opt.isDefault())\r
+      {\r
+               PrimitiveElement pe;\r
+               switch (arrowType)\r
+        {\r
+                 case Qt::LeftArrow:  pe = PE_ArrowLeft;  break;\r
+                 case Qt::RightArrow: pe = PE_ArrowRight; break;\r
+                 case Qt::UpArrow:    pe = PE_ArrowUp;    break;\r
+                 default:\r
+                 case Qt::DownArrow:  pe = PE_ArrowDown;  break;\r
+        }\r
+\r
+        rect.moveBy(shiftX, shiftY);\r
+           drawPrimitive(pe, p, rect, cg, flags, opt);\r
+         }\r
+      else\r
+      {\r
+               QColor btext = toolbutton->paletteForegroundColor();\r
+\r
+               if (toolbutton->iconSet().isNull() &&\r
+                   ! toolbutton->text().isNull() &&\r
+                   ! toolbutton->usesTextLabel())\r
+        {\r
+                   int alignment = AlignCenter | ShowPrefix;\r
+                   if (!styleHint(SH_UnderlineAccelerator, widget, QStyleOption::Default, 0))\r
+                         alignment |= NoAccel;\r
+\r
+                   rect.moveBy(shiftX, shiftY);\r
+                   drawItem( p, rect, alignment, cg, flags & Style_Enabled, 0, toolbutton->text(),\r
+                                 toolbutton->text().length(), &btext);\r
+        }\r
+        else\r
+        {\r
+             QPixmap pm;\r
+                 QIconSet::Size size =\r
+                 toolbutton->usesBigPixmap() ? QIconSet::Large : QIconSet::Small;\r
+                 QIconSet::State state = toolbutton->isOn() ? QIconSet::On : QIconSet::Off;\r
+                 QIconSet::Mode mode;\r
+                 if( !toolbutton->isEnabled() )\r
+               mode = QIconSet::Active; //QIconSet::Disabled;\r
+                 else if( flags & (Style_Down | Style_On ) || ( flags & Style_Raised ) && (flags & Style_AutoRaise))\r
+                   mode = QIconSet::Active;\r
+                 else\r
+                   mode = QIconSet::Normal;\r
+                 pm = toolbutton->iconSet().pixmap( size, mode, state );\r
+\r
+                 if( toolbutton->usesTextLabel() )\r
+          {\r
+                   p->setFont( toolbutton->font() );\r
+                   QRect pr = rect, tr = rect;\r
+                   int alignment = ShowPrefix;\r
+                   if (!styleHint(SH_UnderlineAccelerator, widget, QStyleOption::Default, 0))\r
+                         alignment |= NoAccel;\r
+\r
+                   if( toolbutton->textPosition() == QToolButton::Under )\r
+            {\r
+                         int fh = p->fontMetrics().height();\r
+                         pr.addCoords( 0, 1, 0, -fh-3 );\r
+                         tr.addCoords( 0, pr.bottom(), 0, -3 );\r
+                         pr.moveBy(shiftX, shiftY);\r
+                         drawItem( p, pr, AlignCenter, cg, TRUE, &pm, QString::null );\r
+                         alignment |= AlignCenter;\r
+            }\r
+            else\r
+            {\r
+                         pr.setWidth( pm.width() + 8 );\r
+                         tr.addCoords( pr.right(), 0, 0, 0 );\r
+                         pr.moveBy(shiftX, shiftY);\r
\r
+                         drawItem( p, pr, AlignCenter, cg, TRUE, &pm, QString::null );\r
+                         alignment |= AlignLeft | AlignVCenter;\r
+            }\r
+\r
+               tr.moveBy(shiftX, shiftY);\r
+                   drawItem( p, tr, alignment, cg, flags & Style_Enabled, 0, toolbutton->textLabel(),\r
+                                     toolbutton->textLabel().length(), &btext);\r
+          }\r
+          else\r
+          {\r
+            /*if( en && !highlight )\r
+              mix( 0.6, pm, cg.background() );\r
+            else*/ if( !en )\r
+            {\r
+              toGrayscale( pm, 1.1 );\r
+              mix( 0.8, pm, cg.background() );\r
+            }\r
+\r
+                   rect.moveBy(shiftX, shiftY);\r
+                   drawItem( p, rect, AlignCenter, cg, true, &pm, QString::null );\r
+          }\r
+        }\r
+      }\r
+    }\r
+    break;\r
+\r
+    case CE_TabBarTab:\r
+         {\r
+      QPen oldPen = p->pen();\r
+\r
+           QRect r2( r );\r
+           bool selected = flags & Style_Selected;\r
+\r
+      p->setPen( cg.midlight() );\r
+      p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() );\r
+\r
+      if ( !selected )\r
+        r2.setRect( r2.left(), r2.top() + 1, r2.width(), r2.height() - 1 );\r
+      else\r
+        r2.setRect( r2.left(), r2.top(), r2.width() - 2, r2.height() - 1 );\r
+\r
+      p->setPen( cg.foreground() );\r
+      QBrush brsh = cg.brush( selected ? QColorGroup::Base : QColorGroup::Background );\r
+      p->fillRect( r2.left(), r2.top(), r2.width(), r2.height() - 1, brsh );\r
+      p->drawRect( r2.left(), r2.top(), r2.width(), r2.height() - 1 );\r
+\r
+      if ( selected )\r
+      {\r
+        p->setPen( cg.shadow() );\r
+        p->drawLine( r2.left() + 1, r2.bottom(), r2.right() + 1, r2.bottom() );\r
+        p->drawLine( r2.right() + 1, r2.top() + 1, r2.right() + 1, r2.bottom() );\r
+      }\r
+\r
+           break;\r
+    }\r
+\r
+    case CE_PushButton:\r
+         {\r
+      if ( flags & Style_Enabled && !( flags & Style_Down || flags & Style_On ) )\r
+      {\r
+             const QPushButton* button = (const QPushButton*)widget;\r
+        QRect br = QRect( button->mapToGlobal( button->rect().topLeft() ), button->rect().size() );\r
+        if ( br.contains( QCursor::pos() )  )\r
+          flags |= Style_MouseOver;\r
+      }\r
+\r
+      PARENT_STYLE::drawControl( element, p, widget, r, cg, flags, opt );\r
+           break;\r
+         }\r
+\r
+    default:\r
+      PARENT_STYLE::drawControl( element, p, widget, r, cg, flags, opt );\r
+      break;\r
+  }\r
+}\r
+\r
+QRect SalomeStyle::subRect( SubRect subrect, const QWidget* w ) const\r
+{\r
+  QRect r = PARENT_STYLE::subRect( subrect, w );\r
+  if ( subrect==SR_DockWindowHandleRect && w->inherits( "QDockWindowHandle" ) )\r
+  {\r
+    QDockWindow* wnd = ( QDockWindow* ) w->parent();\r
+    if( wnd->orientation()==Qt::Vertical )\r
+      r.setWidth( w->width() );\r
+    else\r
+    {\r
+      r.setY( r.y()+r.height()-w->height() );\r
+      r.setHeight( w->height() );\r
+    }\r
+  }\r
+\r
+  return r;\r
+}\r
+\r
+void SalomeStyle::drawComplexControl( ComplexControl control, QPainter* p, const QWidget* widget,\r
+                                                             const QRect& r, const QColorGroup& cg, SFlags flags,\r
+                                                             SCFlags controls, SCFlags active, const QStyleOption& opt ) const\r
+{\r
+\r
+\r
+\r
+\r
+  ((SalomeStyle*)this)->myTitleParent = 0;\r
+\r
+  switch ( control )\r
+  {\r
+  case CC_ComboBox:\r
+         if ( controls & SC_ComboBoxArrow )\r
+    {\r
+           SFlags flags = Style_Default;\r
+\r
+      qDrawShadeRect( p, r, cg, true, pixelMetric( PM_DefaultFrameWidth, widget ),\r
+                      0, widget->isEnabled() ? &cg.brush( QColorGroup::Base ) : &cg.brush( QColorGroup::Background ) );\r
+\r
+           QRect ar = QStyle::visualRect( querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxArrow ), widget );\r
+           if ( active == SC_ComboBoxArrow )\r
+      {\r
+                   p->setPen( cg.dark() );\r
+                   p->setBrush( cg.brush( QColorGroup::Button ) );\r
+                   p->drawRect( ar );\r
+           }\r
+      else\r
+                   qDrawWinPanel( p, ar, cg, FALSE, &cg.brush( QColorGroup::Button ) );\r
+\r
+           ar.addCoords( 2, 2, -2, -2 );\r
+           if ( widget->isEnabled() )\r
+                   flags |= Style_Enabled;\r
+\r
+           if ( active == SC_ComboBoxArrow )\r
+                   flags |= Style_Sunken;\r
+           drawPrimitive( PE_ArrowDown, p, ar, cg, flags );\r
+         }\r
+    PARENT_STYLE::drawComplexControl( control, p, widget, r, cg, flags, controls & ~SC_ComboBoxArrow, active, opt );\r
+    break;\r
+\r
+  case CC_TitleBar:\r
+    if( widget->inherits( "QTitleBar" ) )\r
+      ( ( SalomeStyle* )this )->myTitleParent = ( QWidget* )widget->parent();\r
+\r
+  default:\r
+    PARENT_STYLE::drawComplexControl( control, p, widget, r, cg, flags, controls, active, opt );\r
+    break;\r
+  }\r
+}\r
+\r
+QPixmap SalomeStyle::stylePixmap( StylePixmap st, const QWidget* w, const QStyleOption& opt ) const\r
+{\r
+  switch ( st )\r
+  {\r
+  case SP_DockWindowCloseButton:\r
+  case SP_TitleBarCloseButton:\r
+    return QPixmap( cross_xpm );\r
+  case SP_TitleBarMaxButton:\r
+    return QPixmap( maximize_xpm );\r
+  case SP_TitleBarNormalButton:\r
+    return QPixmap( normal_xpm );\r
+  case SP_TitleBarMinButton:\r
+    return QPixmap( minimize_xpm );\r
+  default:\r
+    return PARENT_STYLE::stylePixmap( st, w, opt );\r
+  }\r
+}\r
+\r
+int SalomeStyle::pixelMetric( PixelMetric pm, const QWidget* widget ) const\r
+{\r
+  int ret = 0;\r
+\r
+  switch ( pm )\r
+  {\r
+  case PM_ButtonMargin:\r
+    ret = 5;\r
+    break;\r
+  case PM_DockWindowFrameWidth:\r
+    ret = 0;\r
+    break;\r
+  case PM_TabBarTabOverlap:\r
+         ret = 2;\r
+         break;\r
+  case PM_TabBarTabHSpace:\r
+         ret = 20;\r
+         break;\r
+  case PM_TabBarTabShiftHorizontal:\r
+  case PM_TabBarTabShiftVertical:\r
+         ret = 0;\r
+         break;\r
+  case PM_TabBarTabVSpace:\r
+               ret = 5;\r
+    break;\r
+  case PM_DefaultFrameWidth:\r
+    ret = 1;\r
+    break;\r
+  case PM_SpinBoxFrameWidth:\r
+    ret = 1;\r
+    break;\r
+  default:\r
+    ret = PARENT_STYLE::pixelMetric( pm, widget );\r
+    break;\r
+  }\r
+  return ret;\r
+}\r
+\r
+/*!\r
+    Class: SalomeStylePlugin [Internal]\r
+    Descr: Plugin for Qt style mechanism\r
+*/\r
+\r
+SalomeStylePlugin::SalomeStylePlugin()\r
+{\r
+}\r
+\r
+SalomeStylePlugin::~SalomeStylePlugin()\r
+{\r
+}\r
+\r
+QStringList SalomeStylePlugin::keys() const\r
+{\r
+  printf( "SalomeStylePlugin::keys()\n" );\r
+\r
+  return QStringList() << "salome";\r
+}\r
+\r
+QStyle* SalomeStylePlugin::create( const QString& str )\r
+{\r
+  if ( str == "salome" )\r
+    return new SalomeStyle();\r
+  else\r
+    return 0;\r
+}\r
+\r
+Q_EXPORT_PLUGIN( SalomeStylePlugin )\r
diff --git a/src/Style/SalomeStyle.h b/src/Style/SalomeStyle.h
new file mode 100644 (file)
index 0000000..81680cc
--- /dev/null
@@ -0,0 +1,90 @@
+#ifndef SALOMESTYLE_H\r
+#define SALOMESTYLE_H\r
+\r
+#define parent_style qwindowsstyle\r
+#define PARENT_STYLE QWindowsStyle\r
+\r
+#define QUOTE(x) #x\r
+#define PARENT_INC(x) QUOTE(x.h)\r
+\r
+//#include PARENT_INC(parent_style)\r
+#include <qwindowsstyle.h>\r
+\r
+#include <qpixmap.h>\r
+#include <qdockwindow.h>\r
+#include <qstyleplugin.h>\r
+\r
+#if defined SALOMESTYLE_EXPORTS\r
+#if defined WIN32\r
+#define SALOMESTYLE_EXPORT _declspec( dllexport )\r
+#else\r
+#define SALOMESTYLE_EXPORT  \r
+#endif\r
+#else\r
+#if defined WIN32\r
+#define SALOMESTYLE_EXPORT _declspec( dllimport )\r
+#else\r
+#define SALOMESTYLE_EXPORT  \r
+#endif\r
+#endif\r
+\r
+class SALOMESTYLE_EXPORT SalomeStyle : public PARENT_STYLE\r
+{\r
+public:\r
+  SalomeStyle();\r
+  virtual ~SalomeStyle();\r
+\r
+  virtual void polish( QWidget* );\r
+\r
+  virtual bool eventFilter( QObject*, QEvent* );\r
+\r
+  static void mix( const double, QRgb&, const QRgb& );\r
+  static void mix( const double, QPixmap&, const QColor& );\r
+  static void mix( const double, const QColor&, const QColor&, QColor& );\r
+\r
+  static void toGrayscale( QPixmap&, double = 1.0 );\r
+\r
+  virtual void drawPrimitive( PrimitiveElement, QPainter*, const QRect&,\r
+                                                     const QColorGroup&, SFlags = Style_Default,\r
+                              const QStyleOption& = QStyleOption::Default ) const;\r
+\r
+  virtual void drawControl( ControlElement, QPainter*, const QWidget*,\r
+                            const QRect&, const QColorGroup&, SFlags = Style_Default,\r
+                            const QStyleOption& = QStyleOption::Default ) const; \r
+\r
+  virtual QRect subRect( SubRect, const QWidget* ) const;\r
+\r
+  virtual void drawComplexControl( ComplexControl, QPainter*, const QWidget*,\r
+                                   const QRect&, const QColorGroup&, SFlags = Style_Default,\r
+                                   SCFlags = SC_All, SCFlags = SC_None,\r
+                                   const QStyleOption& = QStyleOption::Default ) const;\r
+\r
+  virtual QPixmap stylePixmap( StylePixmap, const QWidget* = 0,\r
+                               const QStyleOption& = QStyleOption::Default ) const;\r
+\r
+  virtual int pixelMetric( PixelMetric, const QWidget* widget = 0 ) const;\r
+\r
+protected:\r
+  typedef enum { LeftToRight, RightToLeft, UpToDown, DownToUp } Direction;\r
+\r
+  typedef double (*gradient_func)( double );\r
+\r
+  void drawGradient( QPainter*, const QRect&,\r
+                     const QColor&, const QColor&,\r
+                     const Direction, gradient_func ) const;\r
+\r
+private:\r
+  QWidget* myTitleParent;\r
+};\r
+\r
+class SalomeStylePlugin : public QStylePlugin\r
+{\r
+public:\r
+  SalomeStylePlugin();\r
+  virtual ~SalomeStylePlugin();\r
+\r
+  virtual QStringList keys() const;\r
+  virtual QStyle* create( const QString& );\r
+};\r
+\r
+#endif\r