]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Add filter for the Object Browser.
authormzn <mzn@opencascade.com>
Tue, 31 May 2005 11:28:49 +0000 (11:28 +0000)
committermzn <mzn@opencascade.com>
Tue, 31 May 2005 11:28:49 +0000 (11:28 +0000)
src/SalomeApp/Makefile.in
src/SalomeApp/SalomeApp_Application.cxx
src/SalomeApp/SalomeApp_OBFilter.cxx [new file with mode: 0644]
src/SalomeApp/SalomeApp_OBFilter.h [new file with mode: 0644]

index 4a926dfefc38d6ea3b3f07f9bb0230415f8d08a4..e13e104be32ea21613a09f1f2cdf4180a47569f1 100755 (executable)
@@ -35,7 +35,8 @@ EXPORT_HEADERS= SalomeApp.h \
                SalomeApp_DataSubOwner.h \
                SalomeApp_Selection.h \
                SalomeApp_Filter.h \
-               SalomeApp_TypeFilter.h          
+               SalomeApp_TypeFilter.h \
+               SalomeApp_OBFilter.h            
 
 # .po files to transform in .qm
 PO_FILES = SalomeApp_images.po \
@@ -67,7 +68,8 @@ LIB_SRC= SalomeApp_Application.cxx \
         SalomeApp_ModuleDlg.cxx \
         SalomeApp_Selection.cxx \
         SalomeApp_Filter.cxx \
-        SalomeApp_TypeFilter.cxx
+        SalomeApp_TypeFilter.cxx \
+        SalomeApp_OBFilter.cxx
 
 LIB_MOC = SalomeApp_Application.h \
          SalomeApp_DataModel.h \
index 18310dead9bfd289584941c2e41650dcacc62c7b..7aa8d3d9dd14f8154f67f7359a98287a9a700015 100644 (file)
@@ -18,6 +18,7 @@
 #include "SalomeApp_EventFilter.h"
 #include "SalomeApp_WidgetContainer.h"
 #include "SalomeApp_ModuleDlg.h"
+#include "SalomeApp_OBFilter.h"
 
 #include <LogWindow.h>
 
@@ -731,6 +732,7 @@ QWidget* SalomeApp_Application::createWindow( const int flag )
   if ( flag == WT_ObjectBrowser )
   {
     OB_Browser* ob = new OB_Browser( desktop() );
+    ob->setFilter( new SalomeApp_OBFilter(selectionMgr()) );
 
     ob->setCaption( tr( "OBJECT_BROWSER" ) );
     ob->resize( OBJECT_BROWSER_WIDTH, ob->height() );
diff --git a/src/SalomeApp/SalomeApp_OBFilter.cxx b/src/SalomeApp/SalomeApp_OBFilter.cxx
new file mode 100644 (file)
index 0000000..3a9cbf4
--- /dev/null
@@ -0,0 +1,24 @@
+#include "SalomeApp_OBFilter.h"
+
+#include "SalomeApp_SelectionMgr.h" 
+#include "SalomeApp_DataObject.h"
+#include "SalomeApp_DataOwner.h"
+
+SalomeApp_OBFilter::SalomeApp_OBFilter( SalomeApp_SelectionMgr* theSelMgr )
+{
+  mySelMgr = theSelMgr;
+}
+
+SalomeApp_OBFilter::~SalomeApp_OBFilter()
+{
+}
+
+bool SalomeApp_OBFilter::isOk( const SUIT_DataObject* theDataObj ) const
+{
+  const SalomeApp_DataObject* obj = dynamic_cast<const SalomeApp_DataObject*>( theDataObj );
+  if ( obj )
+    return mySelMgr->isOk( new SalomeApp_DataOwner( obj->entry() ) );
+
+  return false;
+}
+
diff --git a/src/SalomeApp/SalomeApp_OBFilter.h b/src/SalomeApp/SalomeApp_OBFilter.h
new file mode 100644 (file)
index 0000000..15f3ebe
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef SALOMEAPP_OBFILTER_H
+#define SALOMEAPP_OBFILTER_H
+
+#include "SalomeApp.h"
+#include "OB_Filter.h"
+
+class SalomeApp_SelectionMgr;
+
+class SALOMEAPP_EXPORT SalomeApp_OBFilter: public OB_Filter
+{
+public:
+  SalomeApp_OBFilter( SalomeApp_SelectionMgr* theSelMgr );
+  ~SalomeApp_OBFilter();
+
+  virtual bool isOk(  const SUIT_DataObject* ) const;
+
+private:
+  SalomeApp_SelectionMgr* mySelMgr;
+
+};
+
+#endif