Salome HOME
Fix for bug PAL9160 ( No shading on visualizations ).
[modules/visu.git] / src / VISUGUI / VisuGUI_ScalarBarDlg.h
index 21bcd89779424419c4b2feee16faac71b32c6f56..33c55f963a00f7f129da10b59560dd424e653b63 100644 (file)
@@ -1,36 +1,34 @@
 //  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$
 
 #ifndef VISUGUI_SCALARBARDLG_H
 #define VISUGUI_SCALARBARDLG_H
 
-#include "QAD_SpinBoxDbl.h"
-
 #include <qdialog.h>
 #include <qbuttongroup.h>
 #include <qgroupbox.h>
 #include <qvbox.h>
 #include <qtoolbutton.h>
 
-#include "VISU_ScalarMap_i.hh"
+#include "QtxDblSpinBox.h"
 
+#include "VISU_ScalarMap_i.hh"
 
-class VisuGUI_TextPrefDlg: public QDialog 
+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() {};
-
-    bool isBoldTitle() { return myTitBoldChk->isChecked();}
-    void setBoldTitle(bool isBold) { myTitBoldChk->setChecked(isBold);}
-
-    bool isItalicTitle() { return myTitItalicChk->isChecked();}
-    void setItalicTitle(bool isItalic) { myTitItalicChk->setChecked(isItalic);}
-
-    bool isShadowTitle() { return myTitShadowChk->isChecked();}
-    void setShadowTitle(bool isShadow) { myTitShadowChk->setChecked(isShadow);}
-
-    QString getTitleText() { return myTitleEdt->text();}
-    void setTitleText(QString theText) { myTitleEdt->setText(theText);}
-
-    QColor getTitleColor() { return myTitColor->paletteBackgroundColor();}
-    void setTitleColor(QColor theColor) { myTitColor->setPaletteBackgroundColor(theColor);}
-
-    int getTitleFont();
-    void setTitleFont(int theFont);
+  Q_OBJECT;
 
+ public:
+  VisuGUI_TextPrefDlg (QWidget* parent);
+  ~VisuGUI_TextPrefDlg() {};
 
-    bool isBoldLabel()   { return myLblBoldChk->isChecked();}
-    void setBoldLabel(bool isBold)   { myLblBoldChk->setChecked(isBold);}
+  QString getTitleText() { return myTitleEdt->text(); }
+  void setTitleText(QString theText) { myTitleEdt->setText(theText); }
 
-    bool isItalicLabel() { return myLblItalicChk->isChecked();}
-    void setItalicLabel(bool isItalic) { myLblItalicChk->setChecked(isItalic);}
+  void setTitleVisible (bool isVisible)
+    { (isVisible)? myTitleEdt->show() : myTitleEdt->hide(); }
 
-    bool isShadowLabel() { return myLblShadowChk->isChecked();}
-    void setShadowLabel(bool isShadow) { myLblShadowChk->setChecked(isShadow);}
-
-    QColor getLabelColor() { return myLblColor->paletteBackgroundColor();}
-    void setLabelColor(QColor theColor) { myLblColor->setPaletteBackgroundColor(theColor);}
-
-    int getLabelFont();
-    void setLabelFont(int theFont);
-
-    void setTitleVisible(bool isVisible) 
-      { (isVisible)? myTitleEdt->show() : myTitleEdt->hide();}
-
-private slots:
-  void setTitleColor();
-  void setLabelColor(); 
+ public:
+  VisuGUI_FontWg* myTitleFont;
+  VisuGUI_FontWg* myLabelFont;
 
  private:
-    QLineEdit* myTitleEdt;
-    QComboBox* myTitFontCombo;
-    QCheckBox* myTitBoldChk;
-    QCheckBox* myTitItalicChk;
-    QCheckBox* myTitShadowChk;
-    QToolButton* myTitColor;
-
-    QComboBox* myLblFontCombo;
-    QCheckBox* myLblBoldChk;
-    QCheckBox* myLblItalicChk;
-    QCheckBox* myLblShadowChk;
-    QToolButton* myLblColor;
+  QLineEdit* myTitleEdt;
 };
 
 
 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();
-
-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;
-    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();
-};
+  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() {};
+class VisuGUI_ScalarBarDlg : public QDialog
+{
+  Q_OBJECT;
 
-    bool isToSave() {return myScalarPane->isToSave();}
+ public:
+  VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool SetPref = FALSE);
+  ~VisuGUI_ScalarBarDlg() {};
 
-    void initFromResources() {myScalarPane->initFromResources();}
-    void storeToResources() {myScalarPane->storeToResources();}
+  bool isToSave() {return myScalarPane->isToSave();}
 
-    void initFromPrsObject(VISU::ScalarMap_i* thePrs) {myScalarPane->initFromPrsObject(thePrs);}
-    int storeToPrsObject(VISU::ScalarMap_i* thePrs) {return myScalarPane->storeToPrsObject(thePrs);}
+  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();
+ protected slots:
+  void accept();
+  void reject();
 
  protected:
-    VisuGUI_ScalarBarPane* myScalarPane;
-
+  VisuGUI_ScalarBarPane* myScalarPane;
 };
 
 #endif // VISUGUI_SCALARBARDLG_H