Version: 9.12.0
QtxBackgroundTool.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, 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
QList< int > QIntList
list of int values
Definition: Qtx.h:55
#define QTX_EXPORT
Definition: Qtx.h:36
Orientation
Orientation.
Definition: SalomePyQt.h:138
@ TypeRole
Definition: VTKViewer_MarkerWidget.cxx:34
@ IdRole
Definition: VTKViewer_MarkerWidget.cxx:34
Dialog box that can be used to set-up the background data.
Definition: QtxBackgroundTool.h:100
QtxBackgroundTool * myTool
Definition: QtxBackgroundTool.h:136
Implementation of the widget managing background data.
Definition: QtxBackgroundTool.h:40
QMap< int, bool > myTextureTypesAllowed
Definition: QtxBackgroundTool.h:94
QComboBox * myTextureMode
Definition: QtxBackgroundTool.h:87
QtxColorButton * myFirstColor
Definition: QtxBackgroundTool.h:88
@ Color
Definition: QtxBackgroundTool.h:41
QStackedWidget * myCContainer
Definition: QtxBackgroundTool.h:82
QStringList myGradients
Definition: QtxBackgroundTool.h:90
QtxColorButton * mySecondColor
Definition: QtxBackgroundTool.h:89
QCheckBox * myTextureCheck
Definition: QtxBackgroundTool.h:84
bool myTextureAllowed
Definition: QtxBackgroundTool.h:92
QWidget * myTContainer
Definition: QtxBackgroundTool.h:83
QIntList myGradientsIds
Definition: QtxBackgroundTool.h:91
QMap< int, bool > myTypesAllowed
Definition: QtxBackgroundTool.h:93
QString myImageFormats
Definition: QtxBackgroundTool.h:95
int myLastGradient
Definition: QtxBackgroundTool.h:96
QComboBox * myModeCombo
Definition: QtxBackgroundTool.h:81
QLineEdit * myFileName
Definition: QtxBackgroundTool.h:85
QPushButton * myBrowseBtn
Definition: QtxBackgroundTool.h:86
The QtxColorButton class implements a widget for color preference items editing.
Definition: QtxColorButton.h:36
Generic dialog box class.
Definition: QtxDialog.h:43
Stores background data.
Definition: Qtx.h:178
TextureMode
Texture mode.
Definition: Qtx.h:144
BackgroundMode
Background mode.
Definition: Qtx.h:136