Salome HOME
616fc1adcd851543d39f16483f6da4cb3620296c
[modules/visu.git] / src / VISUGUI / VisuGUI_SetupPlot2dDlg.h
1 //  Copyright (C) 2003  CEA/DEN, EDF R&D
2 //
3 //
4 //
5 //  File   : VisuGUI_SetupPlot2dDlg.h
6 //  Author : Vadim SANDLER
7 //  Module : SALOME
8 //  $Header$
9
10 #ifndef VISUGUI_SetupPlot2dDlg_H
11 #define VISUGUI_SetupPlot2dDlg_H
12
13 #include "Plot2d_Curve.h"
14
15 #include <SALOMEDSClient_SObject.hxx>
16
17 #include <qdialog.h>
18 #include <qptrlist.h>
19
20 //=================================================================================
21 // class    : VisuGUI_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 VisuGUI_ItemContainer;
33
34 class VisuGUI_SetupPlot2dDlg : public QDialog
35
36   Q_OBJECT
37
38 public:
39   VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* parent = 0 );
40   ~VisuGUI_SetupPlot2dDlg();
41
42   void getCurves( QPtrList<Plot2d_Curve>& container );
43   void getCurvesSource( int& horIndex, QValueList<int>& verIndexes );
44   bool getCurveAttributes( const int vIndex, bool& isAuto, int& marker, int& line, int& lineWidth, QColor& color);
45
46 private slots:
47   void onHBtnToggled( bool );
48   void onVBtnToggled( bool );
49   void onHelp();
50   void enableControls();
51
52 private:
53   QScrollView*                myView;
54   QPushButton*                myOkBtn;
55   QPushButton*                myCancelBtn;
56   QPushButton*                myHelpBtn;
57   QPtrList<VisuGUI_ItemContainer> myItems;
58
59   _PTR(SObject)               myObject;
60 };
61
62 class VisuGUI_ItemContainer : public QObject
63 {
64   Q_OBJECT
65
66 public:
67   VisuGUI_ItemContainer( QObject* parent = 0, const char* name = 0 );
68   
69   void   createWidgets( QWidget* parentWidget );
70   void   enableWidgets( bool enable );
71
72   void   setHorizontalOn( bool on );
73   bool   isHorizontalOn() const;
74   void   setVerticalOn( bool on );
75   bool   isVerticalOn() const;
76   bool   isAutoAssign() const;
77   void   setAutoAssign( bool on );
78   void   setLine( const int line, const int width );
79   int    getLine() const;
80   int    getLineWidth() const;
81   void   setMarker( const int marker );
82   int    getMarker() const;
83   void   setColor( const QColor& color );
84   QColor getColor() const;
85
86 protected:
87   void   updateState();
88
89 signals:
90   void   autoClicked();
91   void   horToggled( bool );
92   void   verToggled( bool );
93
94 public slots:
95   void   onAutoChanged();
96   void   onColorChanged();
97   void   onHVToggled( bool );
98
99 public:
100   bool                  myEnabled;
101   QToolButton*          myHBtn;
102   QToolButton*          myVBtn;
103   QLabel*               myTitleLab;
104   QLabel*               myUnitLab;
105   QCheckBox*            myAutoCheck;
106   QComboBox*            myLineCombo;
107   QSpinBox*             myLineSpin;
108   QComboBox*            myMarkerCombo;
109   QToolButton*          myColorBtn;
110 };
111
112 #endif // VISUGUI_SetupPlot2dDlg_H
113