]> SALOME platform Git repositories - modules/visu.git/blob - src/VISUGUI/VisuGUI_ScalarBarDlg.h
Salome HOME
Join modifications from branch BR_3_1_0deb
[modules/visu.git] / src / VISUGUI / VisuGUI_ScalarBarDlg.h
1 //  VISU VISUGUI : GUI of VISU component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21 //
22 //
23 //
24 //  File   : VisuGUI_ScalarBarDlg.h
25 //  Author : Laurent CORNABE & Hubert ROLLAND
26 //  Module : VISU
27
28 #ifndef VISUGUI_SCALARBARDLG_H
29 #define VISUGUI_SCALARBARDLG_H
30
31 #include <qdialog.h>
32 #include <qbuttongroup.h>
33 #include <qgroupbox.h>
34 #include <qlabel.h>
35 #include <qradiobutton.h>
36 #include <qcheckbox.h>
37 #include <qpushbutton.h>
38 #include <qspinbox.h>
39 #include <qlineedit.h>
40 #include <qcombobox.h>
41 #include <qvbox.h>
42 #include <qtoolbutton.h>
43
44 #include "QtxDblSpinBox.h"
45
46 #include "VISU_ScalarMap_i.hh"
47
48 class QButtonGroup;
49 class QGroupBox;
50 class QLabel;
51 class QRadioButton;
52 class QCheckBox;
53 class QPushButton;
54 class QSpinBox;
55 class QLineEdit;
56 class QComboBox;
57 class QVBox;
58 class QToolButton;
59
60 class QtxDblSpinBox;
61 class SalomeApp_Module;
62 class VisuGUI_FontWg;
63 class VISU_ScalarMapAct;
64
65 class VisuGUI_TextPrefDlg: public QDialog
66 {
67   Q_OBJECT;
68
69  public:
70   VisuGUI_TextPrefDlg (QWidget* parent);
71   ~VisuGUI_TextPrefDlg() {};
72
73   QString getTitleText() { return myTitleEdt->text(); }
74   void setTitleText(QString theText) { myTitleEdt->setText(theText); }
75
76   void setTitleVisible (bool isVisible)
77     { (isVisible)? myTitleEdt->show() : myTitleEdt->hide(); }
78
79  public:
80   VisuGUI_FontWg* myTitleFont;
81   VisuGUI_FontWg* myLabelFont;
82
83  private:
84   QLineEdit* myTitleEdt;
85 };
86
87
88 class VisuGUI_ScalarBarPane : public QVBox
89 {
90   Q_OBJECT;
91
92  public:
93   VisuGUI_ScalarBarPane(QWidget* parent, bool SetPref);
94   ~VisuGUI_ScalarBarPane() {};
95
96   void    setRange( double imin, double imax, /*double fmin, double fmax,*/ bool sbRange );
97   bool    isIRange() {return RBIrange->isChecked();}
98   double  getMin() {return MinEdit->text().toDouble();}
99   double  getMax() {return MaxEdit->text().toDouble();}
100   int     getOrientation();
101   void    setPosAndSize( double x, double y, double w, double h, bool vert );
102   double  getX() {return XSpin->value();}
103   double  getY() {return YSpin->value();}
104   double  getWidth() {return WidthSpin->value();}
105   double  getHeight() {return HeightSpin->value();}
106   void    setScalarBarData( int colors, int labels );
107   int     getNbColors() {return ColorSpin->value();}
108   int     getNbLabels() {return LabelSpin->value();}
109   bool    isLogarithmic() {return CBLog->isChecked();}
110   void    setLogarithmic( bool on ) {CBLog->setChecked( on );}
111   bool    isToSave() {return CBSave ? CBSave->isChecked() : false;}
112
113   void initFromResources();
114   void storeToResources();
115
116   void initFromPrsObject(VISU::ScalarMap_i* thePrs);
117   int storeToPrsObject(VISU::ScalarMap_i* thePrs);
118
119   bool check();
120   void deletePreview();
121
122  protected:
123   QButtonGroup*   RangeGroup;
124   QRadioButton*   RBFrange;
125   QRadioButton*   RBIrange;
126   QLineEdit*      MinEdit;
127   QLineEdit*      MaxEdit;
128
129   QRadioButton*   RBhori;
130   QRadioButton*   RBvert;
131
132   QtxDblSpinBox* XSpin;
133   QtxDblSpinBox* YSpin;
134
135   QtxDblSpinBox* WidthSpin;
136   QtxDblSpinBox* HeightSpin;
137
138   QSpinBox*       ColorSpin;
139   QSpinBox*       LabelSpin;
140
141   QCheckBox*      CBSave;
142   QCheckBox*      CBLog;
143   QLabel*         myModeLbl;
144   QComboBox*      myModeCombo;
145   QPushButton*    myTextBtn;
146   VisuGUI_TextPrefDlg* myTextDlg;
147
148   double          Imin,   Imax,  /* Fmin,   Fmax,*/   Rmin,   Rmax;
149   double          myHorX, myHorY, myHorW, myHorH;
150   double          myVerX, myVerY, myVerW, myVerH;
151   int             myRangeMode;
152   bool myIsStoreTextProp;
153
154  private slots:
155   void changeDefaults( int );
156   void changeRange( int );
157   void XYChanged( double );
158   void onTextPref();
159   void onPreviewCheck(bool thePreview);
160   void updatePreview();
161
162  private:
163   void createScalarBar();
164   void deleteScalarBar();
165
166   QCheckBox* myPreviewCheck;
167   VISU_ScalarMapAct* myPreviewActor;
168   VISU::ScalarMap_i* myScalarMap;
169
170   bool myBusy;
171 };
172
173
174 class VisuGUI_ScalarBarDlg : public QDialog
175 {
176   Q_OBJECT;
177
178  public:
179   VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool SetPref = FALSE);
180   ~VisuGUI_ScalarBarDlg() {};
181
182   bool isToSave() {return myScalarPane->isToSave();}
183
184   void initFromResources() {myScalarPane->initFromResources();}
185   void storeToResources() {myScalarPane->storeToResources();}
186
187   void initFromPrsObject(VISU::ScalarMap_i* thePrs) {myScalarPane->initFromPrsObject(thePrs);}
188   int storeToPrsObject(VISU::ScalarMap_i* thePrs) {return myScalarPane->storeToPrsObject(thePrs);}
189
190  protected slots:
191   void accept();
192   void reject();
193
194  protected:
195   VisuGUI_ScalarBarPane* myScalarPane;
196 };
197
198 #endif // VISUGUI_SCALARBARDLG_H