Salome HOME
NRI : Merge from V1_2.
[modules/kernel.git] / src / Plot2d / Plot2d_SetupPlot2dDlg.h
1 //  Copyright (C) 2003  CEA/DEN, EDF R&D
2 //
3 //
4 //
5 //  File   : Plot2d_SetupPlot2dDlg.h
6 //  Author : Vadim SANDLER
7 //  Module : SALOME
8 //  $Header$
9
10 #ifndef Plot2d_SetupPlot2dDlg_H
11 #define Plot2d_SetupPlot2dDlg_H
12
13 #include <qdialog.h>
14 #include <qlist.h>
15
16 #include <SALOMEconfig.h>
17 #include CORBA_SERVER_HEADER(SALOMEDS)
18 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
19
20 //=================================================================================
21 // class    : Plot2d_SetupPlot2dDlg
22 // purpose  : Dialog box for setup Plot2d view
23 //=================================================================================
24
25 class QScrollView;
26 class QPushButton;
27 class QLabel;
28 class QCheckBox;
29 class QComboBox;
30 class QSpinBox;
31 class QToolButton;
32 class Plot2d_ItemContainer;
33 class Plot2d_CurveContainer;
34
35 class Plot2d_SetupPlot2dDlg : public QDialog
36
37   Q_OBJECT
38
39 public:
40   Plot2d_SetupPlot2dDlg( SALOMEDS::SObject_var object, QWidget* parent = 0 );
41   ~Plot2d_SetupPlot2dDlg();
42
43   void getCurves( Plot2d_CurveContainer& container );
44   void getCurvesSource( int& horIndex, QValueList<int>& verIndexes );
45   bool getCurveAttributes( const int vIndex, bool& isAuto, int& marker, int& line, int& lineWidth, QColor& color);
46
47 private slots:
48   void onHBtnToggled( bool );
49   void onVBtnToggled( bool );
50   void enableControls();
51
52 private:
53   QScrollView*                myView;
54   QPushButton*                myOkBtn;
55   QPushButton*                myCancelBtn;
56   QList<Plot2d_ItemContainer> myItems;
57
58   SALOMEDS::SObject_var       myObject;
59 };
60
61 class Plot2d_ItemContainer : public QObject
62 {
63   Q_OBJECT
64
65 public:
66   Plot2d_ItemContainer( QObject* parent = 0, const char* name = 0 );
67   
68   void   createWidgets( QWidget* parentWidget );
69   void   enableWidgets( bool enable );
70
71   void   setHorizontalOn( bool on );
72   bool   isHorizontalOn() const;
73   void   setVerticalOn( bool on );
74   bool   isVerticalOn() const;
75   bool   isAutoAssign() const;
76   void   setAutoAssign( bool on );
77   void   setLine( const int line, const int width );
78   int    getLine() const;
79   int    getLineWidth() const;
80   void   setMarker( const int marker );
81   int    getMarker() const;
82   void   setColor( const QColor& color );
83   QColor getColor() const;
84
85 protected:
86   void   updateState();
87
88 signals:
89   void   autoClicked();
90   void   horToggled( bool );
91   void   verToggled( bool );
92
93 public slots:
94   void   onAutoChanged();
95   void   onColorChanged();
96   void   onHVToggled( bool );
97
98 public:
99   bool                  myEnabled;
100   QToolButton*          myHBtn;
101   QToolButton*          myVBtn;
102   QLabel*               myTitleLab;
103   QLabel*               myUnitLab;
104   QCheckBox*            myAutoCheck;
105   QComboBox*            myLineCombo;
106   QSpinBox*             myLineSpin;
107   QComboBox*            myMarkerCombo;
108   QToolButton*          myColorBtn;
109 };
110
111 #endif // Plot2d_SetupPlot2dDlg_H
112