Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QtxBackgroundTool.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: QtxBackgroundTool.h
21 // Author: Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
22 
23 #ifndef QTXBACKGROUNDTOOL_H
24 #define QTXBACKGROUNDTOOL_H
25 
26 #include "Qtx.h"
27 #include "QtxDialog.h"
28 
29 #include <QWidget>
30 #include <QMap>
31 
32 class QCheckBox;
33 class QComboBox;
34 class QStackedWidget;
35 class QLineEdit;
36 class QPushButton;
37 class QtxColorButton;
38 
40 {
41  enum { Color, Gradient };
42  enum { TypeRole = Qt::UserRole, IdRole };
43 
44  Q_OBJECT
45 
46 public:
47  QtxBackgroundTool( QWidget* = 0 );
49  virtual ~QtxBackgroundTool();
50 
51  Qtx::BackgroundData data() const;
52  void setData( const Qtx::BackgroundData& );
53 
54  void gradients( QStringList&, QIntList& ) const;
55  void setGradients( const QStringList&, const QIntList& = QIntList() );
56 
57  bool isModeAllowed( Qtx::BackgroundMode ) const;
58  void setModeAllowed( Qtx::BackgroundMode, bool = true );
59 
60  bool isTextureModeAllowed( Qtx::TextureMode ) const;
61  void setTextureModeAllowed( Qtx::TextureMode, bool = true );
62 
63  bool isTextureAllowed() const;
64  void setTextureAllowed( bool = true );
65 
66  QString imageFormats() const;
67  void setImageFormats( const QString& );
68 
69  Qt::Orientation orientation() const;
70  void setOrientation( Qt::Orientation );
71 
72 private:
73  void init( Qt::Orientation );
74  void internalUpdate();
75 
76 private slots:
77  void updateState();
78  void browse();
79 
80 private:
82  QStackedWidget* myCContainer;
84  QCheckBox* myTextureCheck;
86  QPushButton* myBrowseBtn;
90  QStringList myGradients;
93  QMap<int, bool> myTypesAllowed;
94  QMap<int, bool> myTextureTypesAllowed;
95  QString myImageFormats;
97 };
98 
100 {
101  Q_OBJECT
102 
103 public:
106  virtual ~QtxBackgroundDialog();
107 
108  void setData( const Qtx::BackgroundData& );
109  Qtx::BackgroundData data() const;
110 
111  static Qtx::BackgroundData getBackground( const Qtx::BackgroundData& = Qtx::BackgroundData(),
112  QWidget* = 0,
113  bool = true, bool = true, bool = true, bool = true,
114  const QStringList& = QStringList(),
115  const QIntList& = QIntList(),
116  const QString& = QString() );
117  static Qtx::BackgroundData getBackground( const Qtx::BackgroundData&,
118  QWidget*,
119  const QIntList&,
120  bool = true, bool = true, bool = true, bool = true,
121  const QStringList& = QStringList(),
122  const QIntList& = QIntList(),
123  const QString& = QString() );
124 
125 
126  void setGradients( const QStringList&, const QIntList& = QIntList() );
127  void setModeAllowed( Qtx::BackgroundMode, bool = true );
128  void setTextureAllowed( bool = true );
129  void setTextureModeAllowed( Qtx::TextureMode, bool = true );
130  void setImageFormats( const QString& );
131 
132 private:
133  void init();
134 
135 private:
137 };
138 
139 #endif // QTXBACKGROUNDTOOL_H