1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File: QtxBackgroundTool.h
21 // Author: Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
23 #ifndef QTXBACKGROUNDTOOL_H
24 #define QTXBACKGROUNDTOOL_H
27 #include "QtxDialog.h"
39 class QTX_EXPORT QtxBackgroundTool : public QWidget
41 enum { Color, Gradient };
42 enum { TypeRole = Qt::UserRole, IdRole };
47 QtxBackgroundTool( QWidget* = 0 );
48 QtxBackgroundTool( Qt::Orientation, QWidget* = 0 );
49 virtual ~QtxBackgroundTool();
51 Qtx::BackgroundData data() const;
52 void setData( const Qtx::BackgroundData& );
54 void gradients( QStringList&, QIntList& ) const;
55 void setGradients( const QStringList&, const QIntList& = QIntList() );
57 bool isModeAllowed( Qtx::BackgroundMode ) const;
58 void setModeAllowed( Qtx::BackgroundMode, bool = true );
60 bool isTextureModeAllowed( Qtx::TextureMode ) const;
61 void setTextureModeAllowed( Qtx::TextureMode, bool = true );
63 bool isTextureAllowed() const;
64 void setTextureAllowed( bool = true );
66 QString imageFormats() const;
67 void setImageFormats( const QString& );
69 Qt::Orientation orientation() const;
70 void setOrientation( Qt::Orientation );
73 void init( Qt::Orientation );
74 void internalUpdate();
81 QComboBox* myModeCombo;
82 QStackedWidget* myCContainer;
83 QWidget* myTContainer;
84 QCheckBox* myTextureCheck;
85 QLineEdit* myFileName;
86 QPushButton* myBrowseBtn;
87 QComboBox* myTextureMode;
88 QtxColorButton* myFirstColor;
89 QtxColorButton* mySecondColor;
90 QStringList myGradients;
91 QIntList myGradientsIds;
92 bool myTextureAllowed;
93 QMap<int, bool> myTypesAllowed;
94 QMap<int, bool> myTextureTypesAllowed;
95 QString myImageFormats;
99 class QTX_EXPORT QtxBackgroundDialog : public QtxDialog
104 QtxBackgroundDialog( QWidget* = 0 );
105 QtxBackgroundDialog( const Qtx::BackgroundData&, QWidget* = 0 );
106 virtual ~QtxBackgroundDialog();
108 void setData( const Qtx::BackgroundData& );
109 Qtx::BackgroundData data() const;
111 static Qtx::BackgroundData getBackground( const Qtx::BackgroundData& = Qtx::BackgroundData(),
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&,
120 bool = true, bool = true, bool = true, bool = true,
121 const QStringList& = QStringList(),
122 const QIntList& = QIntList(),
123 const QString& = QString() );
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& );
136 QtxBackgroundTool* myTool;
139 #endif // QTXBACKGROUNDTOOL_H