Salome HOME
Merge from OCC_development_generic_2006
[modules/gui.git] / src / SVTK / SVTK_CubeAxesDlg.h
1 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 //
4 //  This library is free software; you can redistribute it and/or
5 //  modify it under the terms of the GNU Lesser General Public
6 //  License as published by the Free Software Foundation; either
7 //  version 2.1 of the License.
8 //
9 //  This library is distributed in the hope that it will be useful,
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 //  Lesser General Public License for more details.
13 //
14 //  You should have received a copy of the GNU Lesser General Public
15 //  License along with this library; if not, write to the Free Software
16 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
19 //
20 //
21 //
22 //  File   : SVTK_CubeAxesDlg.h
23 //  Author : Sergey LITONIN
24 //  Module : VISU
25
26
27 #ifndef SVTK_CubeAxesDlg_H
28 #define SVTK_CubeAxesDlg_H
29
30 #include <qdialog.h>
31 #include <qframe.h>
32
33 class QWidget;
34 class QFrame;
35 class QPushButton;
36 class QTabWidget;
37 class QCheckBox;
38 class QLineEdit;
39 class QGroupBox;
40
41 class QtxAction;
42
43 class vtkAxisActor2D;
44 class SVTK_CubeAxesActor2D;
45
46 class SVTK_FontWidget;
47 class SVTK_AxisWidget;
48 class SVTK_MainWindow;
49
50 /*!
51  * Class       : SVTK_CubeAxesDlg
52  * Description : Dialog for specifynig cube axes properties
53  */
54 class SVTK_CubeAxesDlg : public QDialog
55 {
56   Q_OBJECT
57
58 public:
59                   SVTK_CubeAxesDlg(SVTK_MainWindow* theParent,
60                                    const char* theName,
61                                    QtxAction* theAction);
62   virtual         ~SVTK_CubeAxesDlg();
63
64   void            Update();
65
66 private slots:
67   void            onOk();
68   bool            onApply();
69   void            onClose();
70
71   virtual void    done( int );
72
73 private:
74   QWidget*        createButtonFrame( QWidget* );
75   QWidget*        createMainFrame  ( QWidget* );
76   bool            isValid() const;
77
78 private:
79   SVTK_MainWindow *myMainWindow;
80   SVTK_CubeAxesActor2D* myActor;
81   QtxAction* myAction;
82
83   QTabWidget*     myTabWg;
84   QCheckBox*      myIsVisible;
85
86   QPushButton*    myOkBtn;
87   QPushButton*    myApplyBtn;
88   QPushButton*    myCloseBtn;
89   SVTK_AxisWidget* myAxes[ 3 ];
90 };
91
92 /*!
93  * Class       : SVTK_AxisWidget
94  * Description : Tab of dialog
95  */
96 class SVTK_AxisWidget : public QFrame
97 {
98   Q_OBJECT
99
100 public:
101                   SVTK_AxisWidget( QWidget* );
102                   ~SVTK_AxisWidget();
103
104   void            UseName( const bool );
105   void            SetName( const QString& );
106   void            SetNameFont( const QColor&, const int, const bool, const bool, const bool );
107   bool            ReadData( vtkAxisActor2D* );
108   bool            Apply( vtkAxisActor2D* );
109
110 protected:
111   bool            eventFilter(QObject*, QEvent*);
112
113 private slots:
114   void            onNameChecked();
115   void            onLabelsChecked();
116   void            onTicksChecked();
117
118 private:
119   void            updateControlState();
120   void            setEnabled( QGroupBox*, const bool );
121
122 private:
123   // name
124   QGroupBox*      myNameGrp;
125   QCheckBox*      myIsNameVisible;
126   QLineEdit*      myAxisName;
127   SVTK_FontWidget* myNameFont;
128
129   // labels
130   QGroupBox*      myLabelsGrp;
131   QCheckBox*      myIsLabelsVisible;
132   QLineEdit*      myLabelNumber;
133   QLineEdit*      myLabelOffset;
134   SVTK_FontWidget* myLabelsFont;
135
136   // tick marks
137   QGroupBox*      myTicksGrp;
138   QCheckBox*      myIsTicksVisible;
139   QLineEdit*      myTickLength;
140
141   friend class SVTK_CubeAxesDlg;
142 };
143
144 #endif