]> SALOME platform Git repositories - modules/visu.git/blob - src/VISUGUI/VisuGUI_ScalarBarDlg.h
Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //
24 //  File   : VisuGUI_ScalarBarDlg.h
25 //  Author : Laurent CORNABE & Hubert ROLLAND
26 //  Module : VISU
27 //  $Header$
28
29 #ifndef VISUGUI_SCALARBARDLG_H
30 #define VISUGUI_SCALARBARDLG_H
31
32 #include <qdialog.h>
33 #include <qbuttongroup.h>
34 #include <qgroupbox.h>
35 #include <qlabel.h>
36 #include <qradiobutton.h>
37 #include <qcheckbox.h>
38 #include <qpushbutton.h>
39 #include <qspinbox.h>
40 #include <qlineedit.h>
41 #include <qcombobox.h>
42 #include <qvbox.h>
43 #include <qtoolbutton.h>
44
45 #include "QtxDblSpinBox.h"
46
47 #include "VISU_ScalarMap_i.hh"
48
49 class QButtonGroup;
50 class QGroupBox;
51 class QLabel;
52 class QRadioButton;
53 class QCheckBox;
54 class QPushButton;
55 class QSpinBox;
56 class QLineEdit;
57 class QComboBox;
58 class QVBox;
59 class QToolButton;
60
61 class QtxDblSpinBox;
62 class SalomeApp_Module;
63 class SVTK_FontWidget;
64 class VISU_ScalarMapAct;
65
66 class VisuGUI_TextPrefDlg: public QDialog
67 {
68   Q_OBJECT;
69
70  public:
71   VisuGUI_TextPrefDlg (QWidget* parent);
72   ~VisuGUI_TextPrefDlg() {};
73
74   QString getTitleText() { return myTitleEdt->text(); }
75   void setTitleText(QString theText) { myTitleEdt->setText(theText); }
76
77   void setTitleVisible (bool isVisible)
78     { (isVisible)? myTitleEdt->show() : myTitleEdt->hide(); }
79
80   void storeBeginValues();
81
82  public:
83   SVTK_FontWidget* myTitleFont;
84   SVTK_FontWidget* myLabelFont;
85
86  protected slots:
87   void accept();
88   void reject();
89   void onHelp();
90
91  private:
92   QLineEdit* myTitleEdt;
93   QString    myTitle;
94   QColor     myColors[2];
95   int        myComboVals[2];
96   bool       myCheckVals[6];
97 };
98
99
100 class VisuGUI_ScalarBarPane : public QVBox
101 {
102   Q_OBJECT;
103
104  public:
105   VisuGUI_ScalarBarPane(QWidget* parent, bool SetPref);
106   ~VisuGUI_ScalarBarPane() {};
107
108   void    setRange( double imin, double imax, /*double fmin, double fmax,*/ bool sbRange );
109   void    setDefaultRange(double imin, double imax);
110   bool    isIRange() {return RBIrange->isChecked();}
111   double  getMin() {return MinEdit->text().toDouble();}
112   double  getMax() {return MaxEdit->text().toDouble();}
113   int     getOrientation();
114   void    setPosAndSize( double x, double y, double w, double h, bool vert );
115   double  getX() {return XSpin->value();}
116   double  getY() {return YSpin->value();}
117   double  getWidth() {return WidthSpin->value();}
118   double  getHeight() {return HeightSpin->value();}
119   void    setScalarBarData( int colors, int labels );
120   int     getNbColors() {return ColorSpin->value();}
121   int     getNbLabels() {return LabelSpin->value();}
122   bool    isLogarithmic() {return CBLog->isChecked();}
123   void    setLogarithmic( bool on ) {CBLog->setChecked( on );}
124   bool    isToSave() {return CBSave ? CBSave->isChecked() : false;}
125
126   void initFromResources();
127   void storeToResources();
128
129   void initFromPrsObject(VISU::ScalarMap_i* thePrs);
130   int storeToPrsObject(VISU::ScalarMap_i* thePrs);
131
132   bool check();
133   void deletePreview();
134
135  protected:
136   QButtonGroup*   RangeGroup;
137   QRadioButton*   RBFrange;
138   QRadioButton*   RBIrange;
139   QLineEdit*      MinEdit;
140   QLineEdit*      MaxEdit;
141
142   QRadioButton*   RBhori;
143   QRadioButton*   RBvert;
144
145   QtxDblSpinBox* XSpin;
146   QtxDblSpinBox* YSpin;
147
148   QtxDblSpinBox* WidthSpin;
149   QtxDblSpinBox* HeightSpin;
150
151   QSpinBox*       ColorSpin;
152   QSpinBox*       LabelSpin;
153
154   QCheckBox*      CBSave;
155   QCheckBox*      CBLog;
156   QLabel*         myModeLbl;
157   QComboBox*      myModeCombo;
158   QPushButton*    myTextBtn;
159   VisuGUI_TextPrefDlg* myTextDlg;
160
161   double          Imin,   Imax,  /* Fmin,   Fmax,*/   Rmin,   Rmax;
162   double          myHorX, myHorY, myHorW, myHorH;
163   double          myVerX, myVerY, myVerW, myVerH;
164   int             myRangeMode;
165   bool myIsStoreTextProp;
166
167  private slots:
168   void changeDefaults( int );
169   void changeRange( int );
170   void XYChanged( double );
171   void changeScalarMode( int );
172   void onTextPref();
173   void onPreviewCheck(bool thePreview);
174   void updatePreview();
175
176  private:
177   void createScalarBar();
178   void deleteScalarBar();
179
180   QCheckBox* myPreviewCheck;
181   VISU_ScalarMapAct* myPreviewActor;
182   VISU::ScalarMap_i* myScalarMap;
183   VISU_ScalarMapPL* myScalarMapPL;
184   std::string       myTitle;
185
186   bool myBusy;
187 };
188
189
190 class VisuGUI_ScalarBarDlg : public QDialog
191 {
192   Q_OBJECT;
193
194  public:
195   VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool SetPref = FALSE);
196   ~VisuGUI_ScalarBarDlg() {};
197
198   bool isToSave() {return myScalarPane->isToSave();}
199
200   void initFromResources() {myScalarPane->initFromResources();}
201   void storeToResources() {myScalarPane->storeToResources();}
202
203   void initFromPrsObject(VISU::ScalarMap_i* thePrs) {myScalarPane->initFromPrsObject(thePrs);}
204   int storeToPrsObject(VISU::ScalarMap_i* thePrs) {return myScalarPane->storeToPrsObject(thePrs);}
205
206  protected slots:
207   void accept();
208   void reject();
209   void onHelp();
210
211  protected:
212   VisuGUI_ScalarBarPane* myScalarPane;
213 };
214
215 #endif // VISUGUI_SCALARBARDLG_H