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