Version: 6.3.1

src/Style/Style_PrefDlg.h

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  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 
00062 protected:
00063   void               keyPressEvent( QKeyEvent* );
00064 
00065 private:
00066   Style_ResourceMgr* resourceMgr();
00067   void               fromModel( Style_Model* );
00068   void               toModel( Style_Model* ) const;
00069   
00070   QString            findUniqueName( const QString&, QListWidgetItem* = 0, bool = false );
00071 
00072 signals:
00073   void               styleChanged();
00074 
00075 private slots:
00076   void               onApply();
00077   void               onHelp();
00078 
00079   void               onStyleChanged();
00080   void               onLinesType();
00081   void               onChanged();
00082   void               onItemChanged( QListWidgetItem* );
00083   void               onEffectChanged( QAbstractButton* );
00084 
00085 private:
00086   Style_ResourceMgr* myResMgr;
00087   QCheckBox*         myStyleCheck;
00088   QListWidget*       myStylesList;
00089   QTabWidget*        myStylesTab;
00090 
00091   PaletteEditor*     myPaletteEditor;
00092   QtxFontEdit*       myFontEdit;
00093   QComboBox*         myLinesCombo;
00094   QSlider*           myLinesTransparency;
00095   QtxDoubleSpinBox*  myEditRound;
00096   QtxDoubleSpinBox*  myButtonRound;
00097   QtxDoubleSpinBox*  myFrameRound;
00098   QtxDoubleSpinBox*  mySliderRound;
00099   QCheckBox*         myAntiAliasing;
00100   QSpinBox*          myHorHandleDelta;
00101   QSpinBox*          myVerHandleDelta;
00102   QSpinBox*          mySplitterLength;
00103   QSpinBox*          mySliderSize;
00104   QRadioButton*      myEffectNone;
00105   QRadioButton*      myEffectHighlight;
00106   QRadioButton*      myEffectAutoRaise;
00107 
00108   QRadioButton*      myCurrentEffect;
00109 };
00110 
00111 class Style_PrefDlg::PaletteEditor : public QFrame
00112 {
00113   Q_OBJECT
00114 
00115 public:
00116   PaletteEditor( QWidget* = 0 );
00117   ~PaletteEditor();
00118  
00119   void               addColumn( const QString& );
00120   void               addItem( int );
00121   QList<int>         items() const;
00122 
00123   void               setColor( int, QPalette::ColorGroup, const QColor& );
00124   void               setColor( int, const QColor&, const QColor& = QColor(), const QColor& = QColor() );
00125   QColor             color( int, QPalette::ColorGroup ) const;
00126 
00127   bool               isAuto() const;
00128   void               setAuto( bool );
00129 
00130   void               fromColor( const QColor& );
00131 
00132 private:
00133   static QString     idToName( int );
00134   QWidget*           line();
00135 
00136 private slots:
00137   void               onQuick();
00138   void               onAuto();
00139 
00140 signals:
00141   void               changed();
00142 
00143 private:
00144   typedef QMap<QPalette::ColorGroup, QtxColorButton*> Btns;
00145 
00146   QFrame*            myContainer;
00147   QPushButton*       myQuickButton;
00148   QCheckBox*         myAutoCheck;
00149   QLabel*            myActiveLab;
00150   QLabel*            myInactiveLab;
00151   QLabel*            myDisabledLab;
00152 
00153   QMap<int, Btns>    myButtons;
00154   int                myCurrentRow;
00155   int                myCurrentColumn;
00156 
00157   friend class Style_PrefDlg;
00158 };
00159 
00160 #endif // STYLE_PREFDLG_H
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS