1 // SALOME SALOMEGUI : implementation of desktop and GUI kernel
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : QAD_ObjectBrowser.h
25 // Author : Nicolas REJNERI
29 #ifndef QAD_OBJECTBROWSER_H
30 #define QAD_OBJECTBROWSER_H
33 #include "QAD_Popup.h"
35 #include "SALOME_InteractiveObject.hxx"
41 #include <qtabwidget.h>
42 #include <qtoolbutton.h>
46 #include <SALOMEconfig.h>
47 #include CORBA_SERVER_HEADER(SALOMEDS)
48 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
52 class QAD_ObjectBrowserItem;
53 typedef QList<QAD_ObjectBrowserItem> ItemList;
54 typedef QMap<QString, ItemList> ItemMap;
56 class QAD_EXPORT QAD_ObjectBrowser : public QTabWidget, public QAD_PopupClientServer
61 QAD_ObjectBrowser( SALOMEDS::Study_var study, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
62 virtual ~QAD_ObjectBrowser();
64 bool eventFilter( QObject* o, QEvent* e );
67 /* popup management */
70 QListView* getListView() const;
71 QListView* getUseCaseView() const;
74 void UpdateUseCaseBrowser();
76 void unHighlightAll();
77 void highlight( const Handle(SALOME_InteractiveObject)& IObject, bool highlight );
78 bool getItems( const Handle(SALOME_InteractiveObject)& IObject,
79 QList<QAD_ObjectBrowserItem>& List);
80 bool getItems( SALOMEDS::SObject_ptr SO,
81 QList<QAD_ObjectBrowserItem>& List);
82 QAD_ObjectBrowserItem* getItem( const Handle(SALOME_InteractiveObject)& IObject );
83 QAD_ObjectBrowserItem* getItem( SALOMEDS::SObject_ptr SO );
84 QAD_ObjectBrowserItem* getUCItem( const Handle(SALOME_InteractiveObject)& IObject );
85 QAD_ObjectBrowserItem* getUCItem( SALOMEDS::SObject_ptr SO );
86 void rename( const Handle(SALOME_InteractiveObject)& IObject, QString newName );
88 void setShowIAPP( bool show );
89 void setShowInfoColumns( bool show );
90 void setShowValueColumn( bool show );
91 void setEnableChronoSort( bool enable );
94 void Update( SALOMEDS::SObject_ptr SO,
95 QAD_ObjectBrowserItem* theParentItem );
96 void UpdateUCItem( SALOMEDS::SObject_var UCObject,
97 QAD_ObjectBrowserItem* UCItem );
98 QAD_ObjectBrowserItem* AddItem( QListView* theView,
99 const QString& theName,
100 const QString& theEntry,
101 const QString& theIOR,
103 const QString& theValue,
104 QAD_ObjectBrowserItem* theAfter = 0 );
105 QAD_ObjectBrowserItem* AddItem( QAD_ObjectBrowserItem* theParentItem,
106 const QString& theName,
107 const QString& theEntry,
108 const QString& theIOR,
110 const QString& theRef,
111 const QString& theValue,
112 QAD_ObjectBrowserItem* theAfter = 0 );
113 QString getValueFromObject( SALOMEDS::SObject_ptr SO );
114 bool hasEditableAttribute( const Handle(SALOME_InteractiveObject)& object );
115 bool hasTable( const Handle(SALOME_InteractiveObject)& object );
118 void onSelectedItem();
119 void onUseCaseSelectedItem();
120 void onEditAttribute();
122 void showPopupMenu(QListViewItem*);
123 void showUseCasePopupMenu(QListViewItem*);
125 void onExpanded (QListViewItem*);
126 void onCollapsed(QListViewItem*);
127 void onUseCasePopupMenu( int );
132 ItemMap myListViewMap;
133 ItemMap myUseCaseMap;
134 QListView* myListView;
135 QListView* myUseCaseView;
136 QPopupMenu* myPopupMenu;
137 SALOMEDS::Study_ptr myStudy;
138 QToolButton* myNewBtn;
139 QToolButton* myAddBtn;
140 QToolButton* myDelBtn;
141 QToolButton* myCurrentBtn;
142 QToolButton* myRenameBtn;
143 QToolButton* myClearBtn;