1 // SUPERV SUPERVGUI : GUI for Supervisor component
3 // Copyright (C) 2003 CEA/DEN, EDF R&D
7 // File : SUPERVGUI_ManagePortsDlg.h
8 // Author : Alexander SLADKOV
11 #ifndef SUPERVGUI_ManagePortsDlg_H
12 #define SUPERVGUI_ManagePortsDlg_H
14 #include "SUPERVGUI.h"
18 #include <qstringlist.h>
19 #include <qlineedit.h>
20 #include <qcombobox.h>
23 class SUPERVGUI_CanvasNode;
26 * Simple redefinition of ListBoxItem for storing ports name and type without having to parce it
28 class PortListItem : QListBoxText {
30 PortListItem ( QListBox* lb, const QString& name, const QString& type )
31 : QListBoxText( lb/*, QString( "%1 (%2)" ).arg( name ).arg( type )*/ ),
36 virtual QString text() const { return QString( "%1 (%2)" ).arg( PortName ).arg( PortType ); }
42 class SUPERVGUI_ManagePortsDlg: public QDialog {
47 SUPERVGUI_ManagePortsDlg( SUPERVGUI_CanvasNode* theNode );
48 virtual ~SUPERVGUI_ManagePortsDlg();
54 void addInput() { addPort( myInList ); }
55 void addOutput() { addPort( myOutList );}
56 void removeInput() { removePort( myInList ); }
57 void removeOutput() { removePort( myOutList );}
58 void upInput() { moveUp( myInList ); }
59 void upOutput() { moveUp( myOutList );}
60 void downInput() { moveDown( myInList ); }
61 void downOutput() { moveDown( myOutList );}
63 void nameChanged( const QString& name );
64 void typeChanged( const QString& type );
65 void itemChanged( QListBoxItem * item );
68 virtual void showEvent( QShowEvent* theEvent );
69 void addPort( QListBox* );
70 void removePort( QListBox* );
71 void moveUp( QListBox* );
72 void moveDown( QListBox* );
73 void moveItem( QListBox* theLB, const int from, const int to );
75 void createLinkEngine( SUPERV::Port_ptr thePort,
76 QValueList< QPair< QString,QString > >& theOwnList,
77 QValueList< QPair< QString,QString > >& theCorrespList );
81 void init( const SUPERVGUI_CanvasNode* theNode );
83 SUPERVGUI_CanvasNode* myNode;
86 QComboBox* myTypeCombo;
89 QListBoxItem* myLastItem;
93 * Port parameters dialog definition (taken from SUPERVGUI_Node.h without change)
95 class SUPERVGUI_PortParamsDlg: public QDialog {
99 SUPERVGUI_PortParamsDlg(const QStringList& thePortsNames);
100 ~SUPERVGUI_PortParamsDlg() {};
102 QString getName() { return myNameTxt->text(); }
103 QString getType() { return myTypeTxt->currentText(); }
110 QLineEdit* myNameTxt;
111 QComboBox* myTypeTxt;
112 QStringList myPortsNames;