1 // VISU VISUGUI : GUI of VISU component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : VisuGUI_ScalarBarDlg.h
25 // Author : Laurent CORNABE & Hubert ROLLAND
29 #ifndef VISUGUI_SCALARBARDLG_H
30 #define VISUGUI_SCALARBARDLG_H
33 #include <qbuttongroup.h>
34 #include <qgroupbox.h>
36 #include <qradiobutton.h>
37 #include <qcheckbox.h>
38 #include <qpushbutton.h>
40 #include <qlineedit.h>
41 #include <qcombobox.h>
43 #include <qtoolbutton.h>
45 #include "QtxDblSpinBox.h"
47 #include "VISU_ScalarMap_i.hh"
62 class SalomeApp_Module;
63 class SVTK_FontWidget;
64 class VISU_ScalarMapAct;
66 class VisuGUI_TextPrefDlg: public QDialog
71 VisuGUI_TextPrefDlg (QWidget* parent);
72 ~VisuGUI_TextPrefDlg() {};
74 QString getTitleText() { return myTitleEdt->text(); }
75 void setTitleText(QString theText) { myTitleEdt->setText(theText); }
77 void setTitleVisible (bool isVisible)
78 { (isVisible)? myTitleEdt->show() : myTitleEdt->hide(); }
81 SVTK_FontWidget* myTitleFont;
82 SVTK_FontWidget* myLabelFont;
85 QLineEdit* myTitleEdt;
89 class VisuGUI_ScalarBarPane : public QVBox
94 VisuGUI_ScalarBarPane(QWidget* parent, bool SetPref);
95 ~VisuGUI_ScalarBarPane() {};
97 void setRange( double imin, double imax, /*double fmin, double fmax,*/ bool sbRange );
98 void setDefaultRange(double imin, double imax);
99 bool isIRange() {return RBIrange->isChecked();}
100 double getMin() {return MinEdit->text().toDouble();}
101 double getMax() {return MaxEdit->text().toDouble();}
102 int getOrientation();
103 void setPosAndSize( double x, double y, double w, double h, bool vert );
104 double getX() {return XSpin->value();}
105 double getY() {return YSpin->value();}
106 double getWidth() {return WidthSpin->value();}
107 double getHeight() {return HeightSpin->value();}
108 void setScalarBarData( int colors, int labels );
109 int getNbColors() {return ColorSpin->value();}
110 int getNbLabels() {return LabelSpin->value();}
111 bool isLogarithmic() {return CBLog->isChecked();}
112 void setLogarithmic( bool on ) {CBLog->setChecked( on );}
113 bool isToSave() {return CBSave ? CBSave->isChecked() : false;}
115 void initFromResources();
116 void storeToResources();
118 void initFromPrsObject(VISU::ScalarMap_i* thePrs);
119 int storeToPrsObject(VISU::ScalarMap_i* thePrs);
122 void deletePreview();
125 QButtonGroup* RangeGroup;
126 QRadioButton* RBFrange;
127 QRadioButton* RBIrange;
131 QRadioButton* RBhori;
132 QRadioButton* RBvert;
134 QtxDblSpinBox* XSpin;
135 QtxDblSpinBox* YSpin;
137 QtxDblSpinBox* WidthSpin;
138 QtxDblSpinBox* HeightSpin;
146 QComboBox* myModeCombo;
147 QPushButton* myTextBtn;
148 VisuGUI_TextPrefDlg* myTextDlg;
150 double Imin, Imax, /* Fmin, Fmax,*/ Rmin, Rmax;
151 double myHorX, myHorY, myHorW, myHorH;
152 double myVerX, myVerY, myVerW, myVerH;
154 bool myIsStoreTextProp;
157 void changeDefaults( int );
158 void changeRange( int );
159 void XYChanged( double );
160 void changeScalarMode( int );
162 void onPreviewCheck(bool thePreview);
163 void updatePreview();
166 void createScalarBar();
167 void deleteScalarBar();
169 QCheckBox* myPreviewCheck;
170 VISU_ScalarMapAct* myPreviewActor;
171 VISU::ScalarMap_i* myScalarMap;
177 class VisuGUI_ScalarBarDlg : public QDialog
182 VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool SetPref = FALSE);
183 ~VisuGUI_ScalarBarDlg() {};
185 bool isToSave() {return myScalarPane->isToSave();}
187 void initFromResources() {myScalarPane->initFromResources();}
188 void storeToResources() {myScalarPane->storeToResources();}
190 void initFromPrsObject(VISU::ScalarMap_i* thePrs) {myScalarPane->initFromPrsObject(thePrs);}
191 int storeToPrsObject(VISU::ScalarMap_i* thePrs) {return myScalarPane->storeToPrsObject(thePrs);}
198 VisuGUI_ScalarBarPane* myScalarPane;
201 #endif // VISUGUI_SCALARBARDLG_H