iisfreecadscheme.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2009 Jürgen Riegel <juergen.riegel@web.de>              *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  is distributed in the hope that it will be useful,      *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 
00024 #include "iisfreecadscheme.h"
00025 #include <QApplication>
00026 #include <QStyle>
00027 
00028 
00029 iisFreeCADTaskPanelScheme* iisFreeCADTaskPanelScheme::myDefaultXPScheme = 0;
00030 
00031 iisFreeCADTaskPanelScheme::iisFreeCADTaskPanelScheme(QObject *parent)
00032         : iisTaskPanelScheme(parent)
00033 {
00034 #ifdef Q_OS_WIN32
00035     QLinearGradient panelBackgroundGrd(0,0, 0,300);
00036     panelBackgroundGrd.setColorAt(1, QColor(51,51,101));
00037     panelBackgroundGrd.setColorAt(0, QColor(171,171,193));
00038     panelBackground = panelBackgroundGrd;
00039 
00040     QLinearGradient headerBackgroundGrd(0,0, 300,0);
00041     headerBackgroundGrd.setColorAt(0, 0xffffff);
00042     headerBackgroundGrd.setColorAt(1, 0xc6d3f7);
00043     headerBackground = headerBackgroundGrd;
00044 
00045     headerBorder = QPen(Qt::NoPen);
00046     headerSize = 25;
00047     headerAnimation = false;
00048 
00049     headerLabelScheme.text = QColor(0x215dc6);
00050     headerLabelScheme.textOver = QColor(0x428eff);
00051     headerLabelScheme.iconSize = 22;
00052 
00053     headerButtonFold = QPixmap(":/Resources/headerButtonFold_XPBlue2.png");
00054     headerButtonFoldOver = QPixmap(":/Resources/headerButtonFoldOver_XPBlue2.png");
00055     headerButtonUnfold = QPixmap(":/Resources/headerButtonUnfold_XPBlue2.png");
00056     headerButtonUnfoldOver = QPixmap(":/Resources/headerButtonUnfoldOver_XPBlue2.png");
00057     headerButtonSize = QSize(17,17);
00058 
00059     groupBackground = QBrush(0xd6dff7);
00060     groupBorder = QColor(0xffffff);
00061 
00062     taskLabelScheme.text = QColor(0x215dc6);
00063     taskLabelScheme.textOver = QColor(0x428eff);
00064 #else
00065     QPalette p = QApplication::palette();
00066     QLinearGradient panelBackgroundGrd(0,0, 0,300);
00067     panelBackgroundGrd.setColorAt(1, p.color(QPalette::Dark));
00068     panelBackgroundGrd.setColorAt(0, p.color(QPalette::Midlight));
00069     panelBackground = panelBackgroundGrd;
00070 
00071     QLinearGradient headerBackgroundGrd(0,0,0,100);
00072     headerBackgroundGrd.setColorAt(0, p.color(QPalette::Highlight));
00073     headerBackgroundGrd.setColorAt(1, p.color(QPalette::Highlight).lighter());
00074     headerBackground = headerBackgroundGrd;
00075 
00076     headerBorder = QPen(Qt::NoPen);
00077     headerSize = 25;
00078     headerAnimation = false;
00079 
00080     headerLabelScheme.text = p.color(QPalette::HighlightedText);
00081     headerLabelScheme.textOver = p.color(QPalette::BrightText);
00082     headerLabelScheme.iconSize = 22;
00083 
00084     headerButtonSize = QSize(17,17);
00085     QPalette p2 = p;
00086     p2.setColor(QPalette::Highlight,p2.color(QPalette::Highlight).lighter());
00087     QPixmap px1 = drawFoldIcon(p);
00088     QPixmap px2 = drawFoldIcon(p2);
00089     headerButtonFold = px1;
00090     headerButtonFoldOver = px2;
00091     QTransform mat;
00092     mat.rotate(180.0);
00093     headerButtonUnfold = px1.transformed(mat);
00094     headerButtonUnfoldOver = px2.transformed(mat);
00095 
00096     groupBackground = p.window();
00097     groupBorder = p.color(QPalette::Window);
00098 
00099     taskLabelScheme.text = p.color(QPalette::Text);
00100     taskLabelScheme.textOver = p.color(QPalette::Highlight);
00101 #endif
00102 }
00103 
00104 iisFreeCADTaskPanelScheme::~iisFreeCADTaskPanelScheme()
00105 {
00106 
00107 }
00108 
00109 iisTaskPanelScheme* iisFreeCADTaskPanelScheme::defaultScheme()  
00110 { 
00111         if (!myDefaultXPScheme)
00112                 myDefaultXPScheme = new iisFreeCADTaskPanelScheme();
00113 
00114         return myDefaultXPScheme; 
00115 }
00116 
00117 QPixmap iisFreeCADTaskPanelScheme::drawFoldIcon(const QPalette& p) const
00118 {
00119     QImage img(17,17,QImage::Format_ARGB32_Premultiplied);
00120     img.fill(0x00000000);
00121     QPainter painter;
00122     painter.begin(&img);
00123     painter.setBrush(p.window());
00124     painter.drawEllipse(2,2,13,13);
00125     painter.setPen(p.color(QPalette::Base));
00126     painter.drawEllipse(2,2,13,13);
00127     painter.setPen(p.color(QPalette::Highlight));
00128     painter.drawLine(QLine(5,7,8,4));
00129     painter.drawLine(QLine(6,7,8,5));
00130     painter.drawLine(QLine(8,4,11,7));
00131     painter.drawLine(QLine(8,5,10,7));
00132     painter.drawLine(QLine(5,11,8,8));
00133     painter.drawLine(QLine(6,11,8,9));
00134     painter.drawLine(QLine(8,8,11,11));
00135     painter.drawLine(QLine(9,8,10,11));
00136     painter.end();
00137     return QPixmap::fromImage(img);
00138 }

Generated on Wed Nov 23 19:00:18 2011 for FreeCAD by  doxygen 1.6.1