Salome HOME
371fda140b528472c6cde2533f29f78212e4f3a0
[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 using namespace std;
15 #include <qdialog.h>
16 #include "SUPERVGUI_Def.h"
17 #include "SUPERVGUI_Port.h"
18 #include "SALOME_Selection.h"
19
20 class SUPERVGUI_Node;
21
22 /** 
23  * Class for ports values management (for internal using)
24  */
25 class SUPERVGUI_PortField : public QObject {
26
27   Q_OBJECT
28
29 public:
30   SUPERVGUI_PortField( QWidget* theParent, SUPERV_Port thePort );
31   virtual ~SUPERVGUI_PortField() {};
32
33   bool eventFilter( QObject* o, QEvent* e );
34
35   bool isEditable () { return myIsEditable; }
36
37   void setData( const QString& data ) { myValue->setText( data ); myValue->home( false ); }
38   void updateGUI()   { myValue->setText( myPort->ToString() ); }
39
40   bool setNewValue();
41   
42 signals :
43   void activated();
44
45 public:
46   SUPERV_Port myPort;
47   QLabel*     myLabel;
48   QLineEdit*  myValue;
49   bool        myIsEditable;
50 };
51
52
53 /**
54  * Browse Node Dialog box
55  */
56 class SUPERVGUI_BrowseNodeDlg: public QDialog {
57   
58   Q_OBJECT
59
60 public:
61   SUPERVGUI_BrowseNodeDlg( SUPERVGUI_Node* theNode );
62   virtual ~SUPERVGUI_BrowseNodeDlg();
63
64   void setValues();
65
66 protected slots:
67   void accept();
68   void reject();
69   void onFieldActivated();
70   void onSelectionChanged();
71
72 protected:
73   void showEvent( QShowEvent* theEvent );
74
75 private:
76   SUPERVGUI_Node*               myNode;
77   bool                          myIsEditable;
78   QPtrList<SUPERVGUI_PortField> myPortsList;
79   SUPERVGUI_PortField*          myActiveField;
80   SALOME_Selection*             mySelection;
81 };
82
83 /**
84  * Get Value dialog box
85  */
86 class SUPERVGUI_GetValueDlg: public QDialog {
87   Q_OBJECT
88
89 public:
90 //  SUPERVGUI_GetValueDlg( SUPERVGUI_Port thePort );
91   SUPERVGUI_GetValueDlg( SUPERVGUI_PortIn* thePort );
92   SUPERVGUI_GetValueDlg( SUPERVGUI_PortInESNode* thePort );
93   ~SUPERVGUI_GetValueDlg();
94
95 private slots:
96   void accept();
97   void reject();
98   void onSelectionChanged();
99   
100 private:
101   QPushButton*         myOKBtn;
102   QPushButton*         myCancelBtn;    
103   SUPERVGUI_PortField* myField;
104   SUPERVGUI_PortIn*    myPort;
105   SUPERVGUI_PortInESNode*    myPortESNode;  //last correction
106   SALOME_Selection*    mySelection;
107 };
108
109 #endif