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 );
92 void showUseCaseBrowser ( bool show );
93 void autoSizeColumns ( bool autosize );
96 void Update( SALOMEDS::SObject_ptr SO,
97 QAD_ObjectBrowserItem* theParentItem );
98 void UpdateUCItem( SALOMEDS::SObject_var UCObject,
99 QAD_ObjectBrowserItem* UCItem );
100 QAD_ObjectBrowserItem* AddItem( QListView* theView,
101 const QString& theName,
102 const QString& theEntry,
103 const QString& theIOR,
105 const QString& theValue,
106 QAD_ObjectBrowserItem* theAfter = 0 );
107 QAD_ObjectBrowserItem* AddItem( QAD_ObjectBrowserItem* theParentItem,
108 const QString& theName,
109 const QString& theEntry,
110 const QString& theIOR,
112 const QString& theRef,
113 const QString& theValue,
114 QAD_ObjectBrowserItem* theAfter = 0 );
115 QString getValueFromObject( SALOMEDS::SObject_ptr SO );
116 bool hasEditableAttribute( const Handle(SALOME_InteractiveObject)& object );
117 bool hasTable( const Handle(SALOME_InteractiveObject)& object );
120 void onSelectedItem();
121 void onUseCaseSelectedItem();
122 void onEditAttribute();
124 void showPopupMenu(QListViewItem*);
125 void showUseCasePopupMenu(QListViewItem*);
128 void onExpanded (QListViewItem*);
129 void onCollapsed(QListViewItem*);
130 void onUseCasePopupMenu( int );
135 ItemMap myListViewMap;
136 ItemMap myUseCaseMap;
137 QListView* myListView;
139 QListView* myUseCaseView;
140 QPopupMenu* myPopupMenu;
141 SALOMEDS::Study_ptr myStudy;
142 QToolButton* myNewBtn;
143 QToolButton* myAddBtn;
144 QToolButton* myDelBtn;
145 QToolButton* myCurrentBtn;
146 QToolButton* myRenameBtn;
147 QToolButton* myClearBtn;
151 class Btn : public QToolButton
155 Btn ( QWidget * parent, const char * name = 0 );