Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QtxFontEdit.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 // File: QtxFontEdit.h
21 // Author: Sergey TELKOV
22 //
23 #ifndef QTXFONTEDIT_H
24 #define QTXFONTEDIT_H
25 
26 #include "Qtx.h"
27 
28 #include <QFrame>
29 
30 class QtxComboBox;
31 class QComboBox;
32 class QToolButton;
33 class QFontComboBox;
34 
36 {
37  Q_OBJECT
38 
39 public:
41  typedef enum {
42  Family = 0x01,
43  Size = 0x02,
44  UserSize = 0x04,
45  Bold = 0x08,
46  Italic = 0x10,
47  Underline = 0x20,
48  Shadow = 0x40,
49  Preview = 0x80,
50  Scripting = Bold | Italic | Underline,
51  All = Family | Size | UserSize | Scripting | Preview
52  } Features;
53 
54  typedef enum
55  {
57  Custom
58  } Mode;
59 
60 public:
61  QtxFontEdit( const int, QWidget* = 0 );
62  QtxFontEdit( QWidget* = 0 );
63  virtual ~QtxFontEdit();
64 
65  QFont currentFont() const;
66  void setCurrentFont( const QFont& );
67 
68  int fontSize() const;
69  QString fontFamily() const;
70  int fontScripting() const;
71 
72  void setFontSize( const int );
73  void setFontFamily( const QString& );
74  void setFontScripting( const int );
75 
76  int features() const;
77  void setFeatures( const int );
78 
79  void setMode( const int );
80  int mode() const;
81 
82  void setFonts( const QStringList& );
83  QStringList fonts() const;
84 
85  void setSizes( const QList<int>& = QList<int>() );
86  QList<int> sizes() const;
87 
88 signals:
89  void changed( const QFont& );
90 
91 private slots:
92  void onPreview( bool );
93  void onFontChanged( const QFont& );
94  void onPropertyChanged();
95 
96 private:
97  void initialize();
98  void updateState();
99 
100 private:
102  QFontComboBox* myFamily;
105  QToolButton *myB, *myI, *myU, *myS;
106  int myMode;
108 };
109 
110 #endif // QTXFONTEDIT_H