Salome HOME
Initialisation de la base KERNEL avec la version operationnelle de KERNEL_SRC issue...
[modules/kernel.git] / src / SALOMEGUI / QAD_ObjectBrowser.h
1 //  File      : QAD_ObjectBrowser.h
2 //  Created   : Thu Jun 14 15:40:24 2001
3 //  Author    : Nicolas REJNERI
4 //  Project   : SALOME
5 //  Module    : SALOMEGUI
6 //  Copyright : Open CASCADE
7 //  $Header$
8
9 #ifndef QAD_OBJECTBROWSER_H
10 #define QAD_OBJECTBROWSER_H
11
12 #include "QAD.h"
13 #include "QAD_Popup.h"
14
15 #include "SALOME_InteractiveObject.hxx"
16  
17 // QT Includes
18 #include <qlist.h>
19 #include <qvariant.h>
20 #include <qwidget.h>
21 #include <qtabwidget.h>
22 #include <qtoolbutton.h>
23 #include <qmap.h>
24
25 // IDL headers
26 #include <SALOMEconfig.h>
27 #include CORBA_SERVER_HEADER(SALOMEDS)
28 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
29
30 class QListViewItem;
31 class QListView;
32 class QAD_ObjectBrowserItem;
33 typedef QList<QAD_ObjectBrowserItem> ItemList;
34 typedef QMap<QString, ItemList>      ItemMap;
35
36 class QAD_EXPORT QAD_ObjectBrowser : public QTabWidget, public QAD_PopupClientServer
37 {
38   Q_OBJECT
39
40 public:
41     QAD_ObjectBrowser( SALOMEDS::Study_var study, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
42     virtual ~QAD_ObjectBrowser();
43
44     bool                   eventFilter( QObject* o, QEvent* e );
45
46     void                   setupListView();
47     /* popup management */
48     void                   onCreatePopup();
49
50     QListView*             getListView() const;
51     QListView*             getUseCaseView() const;
52
53     void                   Update();
54     void                   UpdateUseCaseBrowser();
55
56     void                   unHighlightAll();
57     void                   highlight( const Handle(SALOME_InteractiveObject)& IObject, bool highlight );
58     bool                   getItems( const Handle(SALOME_InteractiveObject)& IObject, 
59                                      QList<QAD_ObjectBrowserItem>& List);
60     bool                   getItems( SALOMEDS::SObject_ptr SO, 
61                                      QList<QAD_ObjectBrowserItem>& List);
62     QAD_ObjectBrowserItem* getItem( const Handle(SALOME_InteractiveObject)& IObject );
63     QAD_ObjectBrowserItem* getItem( SALOMEDS::SObject_ptr SO );
64     QAD_ObjectBrowserItem* getUCItem( const Handle(SALOME_InteractiveObject)& IObject );
65     QAD_ObjectBrowserItem* getUCItem( SALOMEDS::SObject_ptr SO );
66     void                   rename( const Handle(SALOME_InteractiveObject)& IObject, QString newName );
67
68     void                   setShowIAPP( bool show );
69     void                   setShowInfoColumns( bool show );
70     void                   setShowValueColumn( bool show );
71     void                   setEnableChronoSort( bool enable );
72
73 protected:
74     void                   Update( SALOMEDS::SObject_ptr SO,
75                                    QAD_ObjectBrowserItem* theParentItem );
76     void                   UpdateUCItem( SALOMEDS::SObject_var UCObject, 
77                                          QAD_ObjectBrowserItem* UCItem );
78     QAD_ObjectBrowserItem* AddItem( QListView*             theView,
79                                     const QString&         theName,
80                                     const QString&         theEntry,
81                                     const QString&         theIOR, 
82                                     int                    theType,
83                                     const QString&         theValue,
84                                     QAD_ObjectBrowserItem* theAfter = 0 );
85     QAD_ObjectBrowserItem* AddItem( QAD_ObjectBrowserItem* theParentItem,
86                                     const QString&         theName,
87                                     const QString&         theEntry,
88                                     const QString&         theIOR, 
89                                     int                    theType,
90                                     const QString&         theRef,
91                                     const QString&         theValue,
92                                     QAD_ObjectBrowserItem* theAfter = 0 );
93     QString                getValueFromObject( SALOMEDS::SObject_ptr SO );
94     bool                   hasEditableAttribute( const Handle(SALOME_InteractiveObject)& object );
95     bool                   hasTable( const Handle(SALOME_InteractiveObject)& object );
96
97 protected slots:
98     void                   onSelectedItem();
99     void                   onUseCaseSelectedItem();
100     void                   onEditAttribute();
101
102     void                   showPopupMenu(QListViewItem*);
103     void                   showUseCasePopupMenu(QListViewItem*);
104     
105     void                   onExpanded (QListViewItem*);
106     void                   onCollapsed(QListViewItem*);
107     void                   onUseCasePopupMenu( int );
108
109     void                   onUseCaseBtn();
110
111 private:
112     ItemMap                myListViewMap;
113     ItemMap                myUseCaseMap;
114     QListView*             myListView;
115     QListView*             myUseCaseView;
116     QPopupMenu*            myPopupMenu;
117     SALOMEDS::Study_ptr    myStudy;
118     QToolButton*           myNewBtn;
119     QToolButton*           myAddBtn;
120     QToolButton*           myDelBtn;
121     QToolButton*           myCurrentBtn;
122     QToolButton*           myRenameBtn;
123     QToolButton*           myClearBtn;
124 };
125
126 #endif