Salome HOME
Fix for bug PAL9160 ( No shading on visualizations ).
[modules/visu.git] / src / VISUGUI / VisuGUI_ScalarBarDlg.h
index a1706e82590256de24c9ee957ee8600fa374d226..33c55f963a00f7f129da10b59560dd424e653b63 100644 (file)
@@ -1,28 +1,28 @@
 //  VISU VISUGUI : GUI of VISU component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 //  File   : VisuGUI_ScalarBarDlg.h
-//  Author : Laurent CORNABE & Hubert ROLLAND 
+//  Author : Laurent CORNABE & Hubert ROLLAND
 //  Module : VISU
 //  $Header$
 
 #include <qspinbox.h>
 #include <qlineedit.h>
 #include <qcombobox.h>
+#include <qvbox.h>
+#include <qtoolbutton.h>
+
+#include "QtxDblSpinBox.h"
+
+#include "VISU_ScalarMap_i.hh"
+
+class QButtonGroup;
+class QGroupBox;
+class QLabel;
+class QRadioButton;
+class QCheckBox;
+class QPushButton;
+class QSpinBox;
+class QLineEdit;
+class QComboBox;
+class QVBox;
+class QToolButton;
+
+class QtxDblSpinBox;
+class SalomeApp_Module;
+class VisuGUI_FontWg;
+class VISU_ScalarMapAct;
+
+class VisuGUI_TextPrefDlg: public QDialog
+{
+  Q_OBJECT;
+
+ public:
+  VisuGUI_TextPrefDlg (QWidget* parent);
+  ~VisuGUI_TextPrefDlg() {};
+
+  QString getTitleText() { return myTitleEdt->text(); }
+  void setTitleText(QString theText) { myTitleEdt->setText(theText); }
+
+  void setTitleVisible (bool isVisible)
+    { (isVisible)? myTitleEdt->show() : myTitleEdt->hide(); }
+
+ public:
+  VisuGUI_FontWg* myTitleFont;
+  VisuGUI_FontWg* myLabelFont;
+
+ private:
+  QLineEdit* myTitleEdt;
+};
+
 
-#include "QAD_SpinBoxDbl.h"
-#include "VISU_PrsObject_i.hh"
+class VisuGUI_ScalarBarPane : public QVBox
+{
+  Q_OBJECT;
+
+ public:
+  VisuGUI_ScalarBarPane(QWidget* parent, bool SetPref);
+  ~VisuGUI_ScalarBarPane() {};
+
+  void    setRange( double imin, double imax, /*double fmin, double fmax,*/ bool sbRange );
+  bool    isIRange() {return RBIrange->isChecked();}
+  double  getMin() {return MinEdit->text().toDouble();}
+  double  getMax() {return MaxEdit->text().toDouble();}
+  int     getOrientation();
+  void    setPosAndSize( double x, double y, double w, double h, bool vert );
+  double  getX() {return XSpin->value();}
+  double  getY() {return YSpin->value();}
+  double  getWidth() {return WidthSpin->value();}
+  double  getHeight() {return HeightSpin->value();}
+  void    setScalarBarData( int colors, int labels );
+  int     getNbColors() {return ColorSpin->value();}
+  int     getNbLabels() {return LabelSpin->value();}
+  bool    isLogarithmic() {return CBLog->isChecked();}
+  void    setLogarithmic( bool on ) {CBLog->setChecked( on );}
+  bool    isToSave() {return CBSave ? CBSave->isChecked() : false;}
+
+  void initFromResources();
+  void storeToResources();
+
+  void initFromPrsObject(VISU::ScalarMap_i* thePrs);
+  int storeToPrsObject(VISU::ScalarMap_i* thePrs);
+
+  bool check();
+  void deletePreview();
+
+ protected:
+  QButtonGroup*   RangeGroup;
+  QRadioButton*   RBFrange;
+  QRadioButton*   RBIrange;
+  QLineEdit*      MinEdit;
+  QLineEdit*      MaxEdit;
+
+  QRadioButton*   RBhori;
+  QRadioButton*   RBvert;
+
+  QtxDblSpinBox* XSpin;
+  QtxDblSpinBox* YSpin;
+
+  QtxDblSpinBox* WidthSpin;
+  QtxDblSpinBox* HeightSpin;
+
+  QSpinBox*       ColorSpin;
+  QSpinBox*       LabelSpin;
+
+  QCheckBox*      CBSave;
+  QCheckBox*      CBLog;
+  QLabel*         myModeLbl;
+  QComboBox*      myModeCombo;
+  QPushButton*    myTextBtn;
+  VisuGUI_TextPrefDlg* myTextDlg;
+
+  double          Imin,   Imax,  /* Fmin,   Fmax,*/   Rmin,   Rmax;
+  double          myHorX, myHorY, myHorW, myHorH;
+  double          myVerX, myVerY, myVerW, myVerH;
+  int             myRangeMode;
+  bool myIsStoreTextProp;
+
+ private slots:
+  void changeDefaults( int );
+  void changeRange( int );
+  void XYChanged( double );
+  void onTextPref();
+  void onPreviewCheck(bool thePreview);
+  void updatePreview();
+
+ private:
+  void createScalarBar();
+  void deleteScalarBar();
+
+  QCheckBox* myPreviewCheck;
+  VISU_ScalarMapAct* myPreviewActor;
+  VISU::ScalarMap_i* myScalarMap;
+};
 
 
 class VisuGUI_ScalarBarDlg : public QDialog
-{ 
-    Q_OBJECT
-
-public:
-    VisuGUI_ScalarBarDlg( bool SetPref = FALSE );
-    ~VisuGUI_ScalarBarDlg();
-
-    void    setRange( double imin, double imax, double fmin, double fmax, bool sbRange );
-    bool    isIRange();
-    double  getMin();
-    double  getMax();
-    int     getOrientation();
-    void    setPosAndSize( double x, double y, double w, double h, bool vert );
-    double  getX();
-    double  getY();
-    double  getWidth();
-    double  getHeight();
-    void    setScalarBarData( int colors, int labels );
-    int     getNbColors();
-    int     getNbLabels();
-    bool    isLogarithmic();
-    void    setLogarithmic( bool on );
-    bool    isToSave();
-
-    void initFromResources();
-    void storeToResources();
-
-    void initFromPrsObject(VISU::ScalarMap_i* thePrs);
-    void storeToPrsObject(VISU::ScalarMap_i* thePrs);
-
-
-protected:
-    QButtonGroup*   RangeGroup;
-    QRadioButton*   RBFrange;
-    QRadioButton*   RBIrange;
-    QLineEdit*      MinEdit;
-    QLineEdit*      MaxEdit;
-
-    QRadioButton*   RBhori;
-    QRadioButton*   RBvert;
-
-    QAD_SpinBoxDbl* XSpin;
-    QAD_SpinBoxDbl* YSpin;
-
-    QAD_SpinBoxDbl* WidthSpin;
-    QAD_SpinBoxDbl* HeightSpin;
-
-    QSpinBox*       ColorSpin;
-    QSpinBox*       LabelSpin;
-
-    QCheckBox*      CBSave;
-    QCheckBox*      CBLog;
-    QLabel*         myModeLbl;
-    QComboBox*      myModeCombo;
-    
-    double          Imin,   Imax,   Fmin,   Fmax,   Rmin,   Rmax;
-    double          myHorX, myHorY, myHorW, myHorH;
-    double          myVerX, myVerY, myVerW, myVerH;
-    int             myRangeMode;
-
-protected slots:
-    void accept();
-
-private slots:
-    void changeDefaults( int );
-    void changeRange( int );
-    void XYChanged( double );
+{
+  Q_OBJECT;
+
+ public:
+  VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool SetPref = FALSE);
+  ~VisuGUI_ScalarBarDlg() {};
+
+  bool isToSave() {return myScalarPane->isToSave();}
+
+  void initFromResources() {myScalarPane->initFromResources();}
+  void storeToResources() {myScalarPane->storeToResources();}
+
+  void initFromPrsObject(VISU::ScalarMap_i* thePrs) {myScalarPane->initFromPrsObject(thePrs);}
+  int storeToPrsObject(VISU::ScalarMap_i* thePrs) {return myScalarPane->storeToPrsObject(thePrs);}
+
+ protected slots:
+  void accept();
+  void reject();
+
+ protected:
+  VisuGUI_ScalarBarPane* myScalarPane;
 };
 
 #endif // VISUGUI_SCALARBARDLG_H