Salome HOME
IPAL9285,9292,9314
[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 //  $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 VisuGUI_FontWg;
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
121  protected:
122   QButtonGroup*   RangeGroup;
123   QRadioButton*   RBFrange;
124   QRadioButton*   RBIrange;
125   QLineEdit*      MinEdit;
126   QLineEdit*      MaxEdit;
127
128   QRadioButton*   RBhori;
129   QRadioButton*   RBvert;
130
131   QtxDblSpinBox* XSpin;
132   QtxDblSpinBox* YSpin;
133
134   QtxDblSpinBox* WidthSpin;
135   QtxDblSpinBox* HeightSpin;
136
137   QSpinBox*       ColorSpin;
138   QSpinBox*       LabelSpin;
139
140   QCheckBox*      CBSave;
141   QCheckBox*      CBLog;
142   QLabel*         myModeLbl;
143   QComboBox*      myModeCombo;
144   QPushButton*    myTextBtn;
145   VisuGUI_TextPrefDlg* myTextDlg;
146
147   double          Imin,   Imax,  /* Fmin,   Fmax,*/   Rmin,   Rmax;
148   double          myHorX, myHorY, myHorW, myHorH;
149   double          myVerX, myVerY, myVerW, myVerH;
150   int             myRangeMode;
151   bool myIsStoreTextProp;
152
153  private slots:
154   void changeDefaults( int );
155   void changeRange( int );
156   void XYChanged( double );
157   void onTextPref();
158 };
159
160
161 class VisuGUI_ScalarBarDlg : public QDialog
162 {
163   Q_OBJECT;
164
165  public:
166   VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool SetPref = FALSE);
167   ~VisuGUI_ScalarBarDlg() {};
168
169   bool isToSave() {return myScalarPane->isToSave();}
170
171   void initFromResources() {myScalarPane->initFromResources();}
172   void storeToResources() {myScalarPane->storeToResources();}
173
174   void initFromPrsObject(VISU::ScalarMap_i* thePrs) {myScalarPane->initFromPrsObject(thePrs);}
175   int storeToPrsObject(VISU::ScalarMap_i* thePrs) {return myScalarPane->storeToPrsObject(thePrs);}
176
177  protected slots:
178   void accept();
179
180  protected:
181   VisuGUI_ScalarBarPane* myScalarPane;
182 };
183
184 #endif // VISUGUI_SCALARBARDLG_H