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
16 #include <qstringlist.h>
17 #include <qlineedit.h>
18 #include <qcombobox.h>
20 class SUPERVGUI_CanvasNode;
23 * Simple redefinition of ListBoxItem for storing ports name and type without having to parce it
25 class PortListItem : QListBoxText {
27 PortListItem ( QListBox* lb, const QString& name, const QString& type )
28 : QListBoxText( lb/*, QString( "%1 (%2)" ).arg( name ).arg( type )*/ ),
33 virtual QString text() const { return QString( "%1 (%2)" ).arg( PortName ).arg( PortType ); }
39 class SUPERVGUI_ManagePortsDlg: public QDialog {
44 SUPERVGUI_ManagePortsDlg( SUPERVGUI_CanvasNode* theNode );
45 virtual ~SUPERVGUI_ManagePortsDlg();
51 void addInput() { addPort( myInList ); }
52 void addOutput() { addPort( myOutList );}
53 void removeInput() { removePort( myInList ); }
54 void removeOutput() { removePort( myOutList );}
55 void upInput() { moveUp( myInList ); }
56 void upOutput() { moveUp( myOutList );}
57 void downInput() { moveDown( myInList ); }
58 void downOutput() { moveDown( myOutList );}
60 void nameChanged( const QString& name );
61 void typeChanged( const QString& type );
62 void itemChanged( QListBoxItem * item );
65 virtual void showEvent( QShowEvent* theEvent );
66 void addPort( QListBox* );
67 void removePort( QListBox* );
68 void moveUp( QListBox* );
69 void moveDown( QListBox* );
70 void moveItem( QListBox* theLB, const int from, const int to );
74 void init( const SUPERVGUI_CanvasNode* theNode );
76 SUPERVGUI_CanvasNode* myNode;
79 QComboBox* myTypeCombo;
82 QListBoxItem* myLastItem;
86 * Port parameters dialog definition (taken from SUPERVGUI_Node.h without change)
88 class SUPERVGUI_PortParamsDlg: public QDialog {
92 SUPERVGUI_PortParamsDlg(const QStringList& thePortsNames);
93 ~SUPERVGUI_PortParamsDlg() {};
95 QString getName() { return myNameTxt->text(); }
96 QString getType() { return myTypeTxt->currentText(); }
103 QLineEdit* myNameTxt;
104 QComboBox* myTypeTxt;
105 QStringList myPortsNames;