Salome HOME
Improve popup management
[modules/gui.git] / src / SVTK / SVTK_Functor.h
1 #ifndef SVTK_Functor_H
2 #define SVTK_Functor_H
3
4 #include <functional>
5
6 #include <string>
7
8 #include <VTKViewer_Functor.h>
9
10 #include "SALOME_InteractiveObject.hxx"
11
12 namespace VTK
13 {
14   template<class TActor> struct TIsSameEntry
15   {
16     std::string myEntry;
17     TIsSameEntry(const char* theEntry): myEntry(theEntry) {}
18     bool operator()(TActor* theActor)
19     {
20             if ( theActor->hasIO() )
21       {
22               Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
23               if ( anIO->hasEntry() )
24                 return myEntry == anIO->getEntry();
25             }
26             return false;
27     }
28   };
29
30   template<class TActor> struct TIsSameIObject
31   {
32     Handle(SALOME_InteractiveObject) myIObject;
33     TIsSameIObject(const Handle(SALOME_InteractiveObject)& theIObject):
34             myIObject(theIObject)
35     {}
36     bool operator()(TActor* theActor)
37     {
38             if(theActor->hasIO())
39       {
40               Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
41               return myIObject->isSame(anIO);
42             }
43             return false;
44     }
45   };
46 }
47
48
49 #endif