Back to index

salome-gui  6.5.0
QtxFontEdit.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:      QtxFontEdit.h
00021 // Author:    Sergey TELKOV
00022 //
00023 #ifndef QTXFONTEDIT_H
00024 #define QTXFONTEDIT_H
00025 
00026 #include "Qtx.h"
00027 
00028 #include <QFrame>
00029 
00030 class QtxComboBox;
00031 class QComboBox;
00032 class QToolButton;
00033 class QFontComboBox;
00034 
00035 class QTX_EXPORT QtxFontEdit : public QFrame
00036 {
00037   Q_OBJECT
00038 
00039 public:
00041   typedef enum { 
00042     Family    = 0x01,                                      
00043     Size      = 0x02,                                      
00044     UserSize  = 0x04,                                      
00045     Bold      = 0x08,                                      
00046     Italic    = 0x10,                                      
00047     Underline = 0x20,                                      
00048     Shadow    = 0x40,                                      
00049     Preview   = 0x80,                                      
00050     Scripting = Bold | Italic | Underline,                 
00051     All = Family | Size | UserSize | Scripting | Preview   
00052   } Features;
00053 
00054   typedef enum 
00055   {
00056     Native, 
00057     Custom  
00058   } Mode;
00059 
00060 public:
00061   QtxFontEdit( const int, QWidget* = 0 );
00062   QtxFontEdit( QWidget* = 0 );
00063   virtual ~QtxFontEdit();
00064 
00065   QFont          currentFont() const;
00066   void           setCurrentFont( const QFont& );
00067 
00068   int            fontSize() const;
00069   QString        fontFamily() const;
00070   int            fontScripting() const;
00071 
00072   void           setFontSize( const int );
00073   void           setFontFamily( const QString& );
00074   void           setFontScripting( const int );
00075 
00076   int            features() const;
00077   void           setFeatures( const int );
00078 
00079   void           setMode( const int );
00080   int            mode() const;
00081 
00082   void           setFonts( const QStringList& );
00083   QStringList    fonts() const;
00084 
00085   void           setSizes( const QList<int>& = QList<int>() );
00086   QList<int>     sizes() const;
00087 
00088 signals:
00089   void           changed( const QFont& );
00090 
00091 private slots:
00092   void           onPreview( bool );
00093   void           onFontChanged( const QFont& );
00094   void           onPropertyChanged();
00095  
00096 private:
00097   void           initialize();
00098   void           updateState();
00099 
00100 private:
00101   QtxComboBox*   mySize;
00102   QFontComboBox* myFamily;
00103   QToolButton*   myPreview;
00104   int            myFeatures;
00105   QToolButton    *myB, *myI, *myU, *myS;
00106   int            myMode;
00107   QComboBox*     myCustomFams;
00108 };
00109 
00110 #endif // QTXFONTEDIT_H