Back to index

salome-gui  6.5.0
Style_PrefDlg.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_PrefDlg.h
00021 // Author : Vadim SANDLER, Open CASCADE S.A.S (vadim.sandler@opencascade.com)
00022 //
00023 #ifndef STYLE_PREFDLG_H
00024 #define STYLE_PREFDLG_H
00025 
00026 #include "Style.h"
00027 
00028 #include <QtxDialog.h>
00029 #include <QFrame>
00030 #include <QMap>
00031 
00032 class QCheckBox;
00033 class QComboBox;
00034 class QLabel;
00035 class QListWidget;
00036 class QListWidgetItem;
00037 class QPushButton;
00038 class QRadioButton;
00039 class QSlider;
00040 class QSpinBox;
00041 class QTabWidget;
00042 class QtxColorButton;
00043 class QtxDoubleSpinBox;
00044 class QtxFontEdit;
00045 class Style_ResourceMgr;
00046 class Style_Model;
00047 
00048 class STYLE_SALOME_EXPORT Style_PrefDlg : public QtxDialog
00049 {
00050   Q_OBJECT
00051 
00052   class PaletteEditor;
00053   enum { Current, Default, Global, User };
00054   enum { TypeRole = Qt::UserRole + 123, NameRole  };
00055 
00056 public:
00057   Style_PrefDlg( QWidget* = 0 );
00058   ~Style_PrefDlg();
00059 
00060   void               accept();
00061   bool               eventFilter( QObject*, QEvent* );
00062 
00063 private:
00064   Style_ResourceMgr* resourceMgr();
00065   void               fromModel( Style_Model* );
00066   void               toModel( Style_Model* ) const;
00067   
00068   QString            findUniqueName( const QString&, QListWidgetItem* = 0, bool = false );
00069 
00070 signals:
00071   void               styleChanged();
00072 
00073 private slots:
00074   void               onApply();
00075   void               onHelp();
00076 
00077   void               onStyleChanged();
00078   void               onLinesType();
00079   void               onChanged();
00080   void               onItemChanged( QListWidgetItem* );
00081   void               onEffectChanged( QAbstractButton* );
00082 
00083 private:
00084   Style_ResourceMgr* myResMgr;
00085   QCheckBox*         myStyleCheck;
00086   QListWidget*       myStylesList;
00087   QTabWidget*        myStylesTab;
00088 
00089   PaletteEditor*     myPaletteEditor;
00090   QtxFontEdit*       myFontEdit;
00091   QComboBox*         myLinesCombo;
00092   QSlider*           myLinesTransparency;
00093   QtxDoubleSpinBox*  myEditRound;
00094   QtxDoubleSpinBox*  myButtonRound;
00095   QtxDoubleSpinBox*  myFrameRound;
00096   QtxDoubleSpinBox*  mySliderRound;
00097   QCheckBox*         myAntiAliasing;
00098   QSpinBox*          myHorHandleDelta;
00099   QSpinBox*          myVerHandleDelta;
00100   QSpinBox*          mySplitterLength;
00101   QSpinBox*          mySliderSize;
00102   QRadioButton*      myEffectNone;
00103   QRadioButton*      myEffectHighlight;
00104   QRadioButton*      myEffectAutoRaise;
00105 
00106   QRadioButton*      myCurrentEffect;
00107 };
00108 
00109 class Style_PrefDlg::PaletteEditor : public QFrame
00110 {
00111   Q_OBJECT
00112 
00113 public:
00114   PaletteEditor( QWidget* = 0 );
00115   ~PaletteEditor();
00116  
00117   void               addColumn( const QString& );
00118   void               addItem( int );
00119   QList<int>         items() const;
00120 
00121   void               setColor( int, QPalette::ColorGroup, const QColor& );
00122   void               setColor( int, const QColor&, const QColor& = QColor(), const QColor& = QColor() );
00123   QColor             color( int, QPalette::ColorGroup ) const;
00124 
00125   bool               isAuto() const;
00126   void               setAuto( bool );
00127 
00128   void               fromColor( const QColor& );
00129 
00130 private:
00131   static QString     idToName( int );
00132   QWidget*           line();
00133 
00134 private slots:
00135   void               onQuick();
00136   void               onAuto();
00137 
00138 signals:
00139   void               changed();
00140 
00141 private:
00142   typedef QMap<QPalette::ColorGroup, QtxColorButton*> Btns;
00143 
00144   QFrame*            myContainer;
00145   QPushButton*       myQuickButton;
00146   QCheckBox*         myAutoCheck;
00147   QLabel*            myActiveLab;
00148   QLabel*            myInactiveLab;
00149   QLabel*            myDisabledLab;
00150 
00151   QMap<int, Btns>    myButtons;
00152   int                myCurrentRow;
00153   int                myCurrentColumn;
00154 
00155   friend class Style_PrefDlg;
00156 };
00157 
00158 #endif // STYLE_PREFDLG_H