Salome HOME
Merge from V5_1_main 14/05/2010
[modules/visu.git] / src / VISUGUI / VisuGUI_SetupPlot2dDlg.h
1 //  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  File   : VisuGUI_SetupPlot2dDlg.h
24 //  Author : Vadim SANDLER
25 //  Module : SALOME
26 //
27 #ifndef VISUGUI_SetupPlot2dDlg_H
28 #define VISUGUI_SetupPlot2dDlg_H
29
30 #include "Plot2d_Curve.h"
31
32 #include <SALOMEDSClient_SObject.hxx>
33
34 #include <QDialog>
35 #include <QList>
36
37 //=================================================================================
38 // class    : VisuGUI_SetupPlot2dDlg
39 // purpose  : Dialog box for setup Plot2d view
40 //=================================================================================
41
42 class QScrollArea;
43 class QPushButton;
44 class QLabel;
45 class QCheckBox;
46 class QComboBox;
47 class SalomeApp_IntSpinBox;
48 class QToolButton;
49 class VisuGUI_ItemContainer;
50 class QtxColorButton;
51
52 class VisuGUI_SetupPlot2dDlg : public QDialog
53
54   Q_OBJECT
55
56 public:
57   VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* parent = 0 );
58   ~VisuGUI_SetupPlot2dDlg();
59
60   void getCurves( QList<Plot2d_Curve*>& container );
61   void getCurvesSource( int& horIndex, QList<int>& verIndexes, QList<int>& ver2Indexes, QList<int>& zIndexes );
62   bool getCurveAttributes( const int vIndex, bool& isAuto, int& marker, int& line, int& lineWidth, QColor& color);
63
64 private:
65   void keyPressEvent( QKeyEvent* e );
66
67 private slots:
68   void onHBtnToggled( bool );
69   void onVBtnToggled( bool );
70   void onV2BtnToggled( bool );
71   void onHelp();
72   void enableControls();
73
74 private:
75   QScrollArea*                myView;
76   QPushButton*                myOkBtn;
77   QPushButton*                myCancelBtn;
78   QPushButton*                myHelpBtn;
79   QList<VisuGUI_ItemContainer*> myItems;
80
81   _PTR(SObject)               myObject;
82 };
83
84 class VisuGUI_ItemContainer : public QObject
85 {
86   Q_OBJECT
87
88 public:
89   VisuGUI_ItemContainer( QObject* parent = 0 );
90   
91   void   createWidgets( QWidget* parentWidget, const QStringList& );
92   void   enableWidgets( bool enable );
93
94   void   setHorizontalOn( bool on );
95   bool   isHorizontalOn() const;
96   void   setVerticalOn( bool on );
97   bool   isVerticalOn() const;
98   void   setVertical2On( bool on );
99   bool   isVertical2On() const;
100   bool   isAutoAssign() const;
101   void   setAutoAssign( bool on );
102   void   setLine( const int line, const int width );
103   int    getLine() const;
104   int    getLineWidth() const;
105   void   setMarker( const int marker );
106   int    getMarker() const;
107   void   setColor( const QColor& color );
108   QColor getColor() const;
109   int    assigned() const;
110
111 protected:
112   void   updateState();
113
114 signals:
115   void   autoClicked();
116   void   horToggled( bool );
117   void   verToggled( bool );
118   void   ver2Toggled( bool );
119
120 public slots:
121   void   onAutoChanged();
122 //void   onColorChanged();
123   void   onHVToggled( bool );
124
125 public:
126   bool                  myEnabled;
127   QToolButton*          myHBtn;
128   QToolButton*          myVBtn;
129   QToolButton*          myV2Btn;
130   QLabel*               myTitleLab;
131   QLabel*               myUnitLab;
132   QCheckBox*            myAutoCheck;
133   QComboBox*            myLineCombo;
134   SalomeApp_IntSpinBox* myLineSpin;
135   QComboBox*            myMarkerCombo, *myAssigned;
136   QtxColorButton*       myColorBtn;
137 };
138
139 #endif // VISUGUI_SetupPlot2dDlg_H
140