// Author : Sergey LITONIN
// Module : SALOME
-#include "SalomeApp_Operation.h"
-
-#include "SalomeApp_Module.h"
-#include "SalomeApp_Application.h"
-#include "SalomeApp_Operation.h"
+#include <SalomeApp_Operation.h>
+#include <SalomeApp_Module.h>
+#include <SalomeApp_Application.h>
+#include <SalomeApp_Operation.h>
+#include <SalomeApp_DataOwner.h>
+#include <SalomeApp_SelectionMgr.h>
-#include <SalomeApp_Dialog.h>
#include <SUIT_Desktop.h>
-#include <SalomeApp_SelectionMgr.h>
/*
return SUIT_Operation::eventFilter( obj, e );
}
+//=======================================================================
+// name : type
+// Purpose : Find type by entry
+//=======================================================================
+int SalomeApp_Operation::type( const QString& ) const
+{
+ return -1;
+}
+
+//=======================================================================
+// name : selected
+// Purpose : Get names, types and entries of selected objects
+//=======================================================================
+void SalomeApp_Operation::selected( QStringList& names, SalomeApp_Dialog::TypesList& types, QStringList& entries ) const
+{
+ SUIT_DataOwnerPtrList list; selectionMgr()->selected( list );
+ SUIT_DataOwnerPtrList::const_iterator anIt = list.begin(),
+ aLast = list.end();
+ for( ; anIt!=aLast; anIt++ )
+ {
+ SalomeApp_DataOwner* owner = dynamic_cast<SalomeApp_DataOwner*>( (*anIt).operator->() );
+ if( owner )
+ {
+ QString entry = owner->entry();
+ entries.append( entry );
+ types.append( type( entry ) );
+ names.append( owner->IO()->getName() );
+ }
+ }
+}
//=======================================================================
// name : eventFilter
// Purpose : Block mouse and key events if operator is not active one
if ( myModule != 0 )
myModule->update( flags );
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#ifndef SalomeApp_Operation_H
#define SalomeApp_Operation_H
-#include "SUIT_Operation.h"
+#include <SUIT_Operation.h>
+#include <SalomeApp_Dialog.h>
class SalomeApp_Module;
class SalomeApp_Application;
class SalomeApp_Operation;
class SalomeApp_SelectionMgr;
-class SalomeApp_Dialog;
class SUIT_Desktop;
/*
void update( const int );
// Call update() method of module ( see SalomeApp_Module for description )
+
+
+
+ virtual void selected( QStringList&, SalomeApp_Dialog::TypesList&, QStringList& ) const;
+ // Get names, types and entries of selected objects
+
+ virtual int type( const QString& ) const;
+ // Find type by entry: default implementation is to return -1
+ // Please redefine it if you want function "selected" to work correctly
+
private slots:
virtual void onSelectionDone();
bool eventFilter( QObject*, QEvent* );
// Block mouse and key events if operator is not active one
-
+
private:
SalomeApp_Module* myModule;