Salome HOME
MPV: Merge V1_2d
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_BrowseNodeDlg.h
1 //  SUPERV SUPERVGUI : GUI for Supervisor component
2 //
3 //  Copyright (C) 2003  CEA/DEN, EDF R&D
4 //
5 //
6 //
7 //  File   : SUPERVGUI_BrowseNodeDlg.h
8 //  Author : Vitaly SMETANNIKOV
9 //  Module : SUPERV
10
11 #ifndef SUPERVGUI_BrowseNodeDlg_H
12 #define SUPERVGUI_BrowseNodeDlg_H
13
14 #include <qdialog.h>
15 #include "SUPERVGUI_Def.h"
16 #include "SUPERVGUI_Port.h"
17 #include "SALOME_Selection.h"
18
19 class SUPERVGUI_Node;
20
21 /** 
22  * Class for ports values management (for internal using)
23  */
24 class SUPERVGUI_PortField : public QObject {
25
26   Q_OBJECT
27
28 public:
29   SUPERVGUI_PortField( QWidget* theParent, SUPERV_Port thePort );
30   virtual ~SUPERVGUI_PortField() {};
31
32   bool eventFilter( QObject* o, QEvent* e );
33
34   bool isEditable () { return myIsEditable; }
35
36   void setData( const QString& data ) { myValue->setText( data ); myValue->home( false ); }
37   void updateGUI()   { myValue->setText( myPort->ToString() ); }
38
39   bool setNewValue();
40   
41 signals :
42   void activated();
43
44 public:
45   SUPERV_Port myPort;
46   QLabel*     myLabel;
47   QLineEdit*  myValue;
48   bool        myIsEditable;
49 };
50
51
52 /**
53  * Browse Node Dialog box
54  */
55 class SUPERVGUI_BrowseNodeDlg: public QDialog {
56   
57   Q_OBJECT
58
59 public:
60   SUPERVGUI_BrowseNodeDlg( SUPERVGUI_Node* theNode );
61   virtual ~SUPERVGUI_BrowseNodeDlg();
62
63   void setValues();
64
65 protected slots:
66   void accept();
67   void reject();
68   void onFieldActivated();
69   void onSelectionChanged();
70
71 protected:
72   void showEvent( QShowEvent* theEvent );
73
74 private:
75   SUPERVGUI_Node*               myNode;
76   bool                          myIsEditable;
77   QPtrList<SUPERVGUI_PortField> myPortsList;
78   SUPERVGUI_PortField*          myActiveField;
79   SALOME_Selection*             mySelection;
80 };
81
82 /**
83  * Get Value dialog box
84  */
85 class SUPERVGUI_GetValueDlg: public QDialog {
86   Q_OBJECT
87
88 public:
89 //  SUPERVGUI_GetValueDlg( SUPERVGUI_Port thePort );
90   SUPERVGUI_GetValueDlg( SUPERVGUI_PortIn* thePort );
91   SUPERVGUI_GetValueDlg( SUPERVGUI_PortInESNode* thePort );
92   ~SUPERVGUI_GetValueDlg();
93
94 private slots:
95   void accept();
96   void reject();
97   void onSelectionChanged();
98   
99 private:
100   QPushButton*         myOKBtn;
101   QPushButton*         myCancelBtn;    
102   SUPERVGUI_PortField* myField;
103   SUPERVGUI_PortIn*    myPort;
104   SUPERVGUI_PortInESNode*    myPortESNode;  //last correction
105   SALOME_Selection*    mySelection;
106 };
107
108 #endif