Salome HOME
660d188164e11c6292fb59201b97296276bfc476
[modules/visu.git] / src / VISUGUI / VisuGUI_SetupPlot2dDlg.h
1 // Copyright (C) 2007-2011  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 <VISU_Table_i.hh>
35
36 #include <QDialog>
37 #include <QList>
38
39 //=================================================================================
40 // class    : VisuGUI_SetupPlot2dDlg
41 // purpose  : Dialog box for setup Plot2d view
42 //=================================================================================
43
44 class QScrollArea;
45 class QPushButton;
46 class QLabel;
47 class QCheckBox;
48 class QComboBox;
49 class SalomeApp_IntSpinBox;
50 class QToolButton;
51 class VisuGUI_ItemContainer;
52 class QtxColorButton;
53
54 class VisuGUI_SetupPlot2dDlg : public QDialog
55
56   Q_OBJECT
57
58 public:
59   VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, VISU::Table_i* table ,QWidget* parent = 0 );
60   ~VisuGUI_SetupPlot2dDlg();
61
62   void getCurves( QList<Plot2d_Curve*>& container );
63   void getCurvesSource( int& horIndex, QList<int>& verIndexes, QList<int>& ver2Indexes, QList<int>& zIndexes );
64   bool getCurveAttributes( const int vIndex, bool& isAuto, int& marker, int& line, int& lineWidth, QColor& color);
65   int idx(const int i) const {return myIdxMap[i];}
66
67 private:
68   void keyPressEvent( QKeyEvent* e );
69
70 private slots:
71   void onHBtnToggled( bool );
72   void onVBtnToggled( bool );
73   void onV2BtnToggled( bool );
74   void onHelp();
75   void enableControls();
76
77 private:
78   QScrollArea*                myView;
79   QPushButton*                myOkBtn;
80   QPushButton*                myCancelBtn;
81   QPushButton*                myHelpBtn;
82   QList<VisuGUI_ItemContainer*> myItems;
83   QMap<int,int>                 myIdxMap;
84
85   _PTR(SObject)               myObject;
86   VISU::Table_i*              myTable;
87 };
88
89 class VisuGUI_ItemContainer : public QObject
90 {
91   Q_OBJECT
92
93 public:
94   VisuGUI_ItemContainer( QObject* parent = 0 );
95   
96   void   createWidgets( QWidget* parentWidget, const QStringList& );
97   void   enableWidgets( bool enable );
98
99   void   setHorizontalOn( bool on );
100   bool   isHorizontalOn() const;
101   void   setVerticalOn( bool on );
102   bool   isVerticalOn() const;
103   void   setVertical2On( bool on );
104   bool   isVertical2On() const;
105   bool   isAutoAssign() const;
106   void   setAutoAssign( bool on );
107   void   setLine( const int line, const int width );
108   int    getLine() const;
109   int    getLineWidth() const;
110   void   setMarker( const int marker );
111   int    getMarker() const;
112   void   setColor( const QColor& color );
113   QColor getColor() const;
114   int    assigned() const;
115
116 protected:
117   void   updateState();
118
119 signals:
120   void   autoClicked();
121   void   horToggled( bool );
122   void   verToggled( bool );
123   void   ver2Toggled( bool );
124
125 public slots:
126   void   onAutoChanged();
127 //void   onColorChanged();
128   void   onHVToggled( bool );
129
130 public:
131   bool                  myEnabled;
132   QToolButton*          myHBtn;
133   QToolButton*          myVBtn;
134   QToolButton*          myV2Btn;
135   QLabel*               myTitleLab;
136   QLabel*               myUnitLab;
137   QLabel*               myDvtnLab;
138   QCheckBox*            myAutoCheck;
139   QComboBox*            myLineCombo;
140   SalomeApp_IntSpinBox* myLineSpin;
141   QComboBox*            myMarkerCombo, *myAssigned;
142   QtxColorButton*       myColorBtn;
143 };
144
145 #endif // VISUGUI_SetupPlot2dDlg_H
146