0025695: Visualization, AIS_InteractiveContext - define default HilightMode
[occt.git] / src / SelectMgr / SelectMgr_EntityOwner.hxx
index 4e1cced..f52150d 100644 (file)
 #ifndef _SelectMgr_EntityOwner_HeaderFile
 #define _SelectMgr_EntityOwner_HeaderFile
 
+#include <Graphic3d_ZLayerId.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <PrsMgr_PresentationManager3d.hxx>
+#include <SelectBasics_EntityOwner.hxx>
+#include <SelectMgr_SelectableObject.hxx>
 #include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <SelectMgr_SOPtr.hxx>
 #include <Standard_Boolean.hxx>
-#include <SelectBasics_EntityOwner.hxx>
 #include <Standard_Integer.hxx>
-#include <PrsMgr_PresentationManager3d.hxx>
+#include <Standard_Type.hxx>
 #include <Quantity_NameOfColor.hxx>
-#include <Graphic3d_HighlightStyle.hxx>
-#include <Graphic3d_ZLayerId.hxx>
-#include <SelectMgr_SelectableObject.hxx>
-class Standard_NoSuchObject;
-class PrsMgr_PresentationManager;
-class TopLoc_Location;
-class V3d_Viewer;
-
 
-class SelectMgr_EntityOwner;
-DEFINE_STANDARD_HANDLE(SelectMgr_EntityOwner, SelectBasics_EntityOwner)
+class V3d_Viewer;
 
 //! A framework to define classes of owners of sensitive primitives.
 //! The owner is the link between application and
@@ -45,31 +37,29 @@ DEFINE_STANDARD_HANDLE(SelectMgr_EntityOwner, SelectBasics_EntityOwner)
 //! it must define owner classes inheriting this framework.
 class SelectMgr_EntityOwner : public SelectBasics_EntityOwner
 {
-
+  DEFINE_STANDARD_RTTIEXT(SelectMgr_EntityOwner, SelectBasics_EntityOwner)
 public:
 
-  
   //! Initializes the selection priority aPriority.
   Standard_EXPORT SelectMgr_EntityOwner(const Standard_Integer aPriority = 0);
-  
+
   //! Constructs a framework with the selectable object
   //! anSO being attributed the selection priority aPriority.
   Standard_EXPORT SelectMgr_EntityOwner(const Handle(SelectMgr_SelectableObject)& aSO, const Standard_Integer aPriority = 0);
-  
+
   //! Constructs a framework from existing one
   //! anSO being attributed the selection priority aPriority.
   Standard_EXPORT SelectMgr_EntityOwner(const Handle(SelectMgr_EntityOwner)& theOwner, const Standard_Integer aPriority = 0);
   
   //! Returns true if there is a selectable object to serve as an owner.
-  Standard_EXPORT Standard_Boolean HasSelectable() const;
-  
+  Standard_Boolean HasSelectable() const { return mySelectable != NULL; }
+
   //! Returns a selectable object detected in the working context.
   Standard_EXPORT virtual Handle(SelectMgr_SelectableObject) Selectable() const;
-  
-  //! Sets the selectable object anSO to be used by the
-  //! second constructor above.
-  Standard_EXPORT void Set (const Handle(SelectMgr_SelectableObject)& aSO);
-  
+
+  //! Sets the selectable object.
+  Standard_EXPORT virtual void SetSelectable (const Handle(SelectMgr_SelectableObject)& theSelObj);
+
   //! Returns true if the presentation manager aPM
   //! highlights selections corresponding to the selection mode aMode.
   Standard_EXPORT virtual Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0) const;
@@ -79,16 +69,15 @@ public:
   //! selectable object manages highlighting on its own, execution will be passed to
   //! SelectMgr_SelectableObject::HilightOwnerWithColor method
   Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
-                                                 const Handle(Graphic3d_HighlightStyle)& theStyle,
+                                                 const Handle(Prs3d_Drawer)& theStyle,
                                                  const Standard_Integer theMode = 0);
-  
-  //! Removes highlighting from the owner of a detected
-  //! selectable object in the presentation manager aPM.
+
+  //! Removes highlighting from the owner of a detected selectable object in the presentation manager.
   //! This object could be the owner of a sensitive primitive.
-  //! The display mode for the highlight is aMode; this has
-  //! the default value of 0, that is, wireframe mode.
-  Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0);
-  
+  //! @param thePrsMgr presentation manager
+  //! @param theMode   obsolete argument for compatibility, should be ignored by implementations
+  Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr, const Standard_Integer theMode = 0);
+
   //! Clears the owners matching the value of the selection
   //! mode aMode from the presentation manager object aPM.
   Standard_EXPORT virtual void Clear (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0);
@@ -103,17 +92,17 @@ public:
   
   //! Set the state of the owner.
   //! @param theIsSelected [in] shows if owner is selected.
-    void SetSelected (const Standard_Boolean theIsSelected);
-  
+  void SetSelected (const Standard_Boolean theIsSelected) { myIsSelected = theIsSelected; }
+
   //! @return Standard_True if the owner is selected.
-    Standard_Boolean IsSelected() const;
-  
+  Standard_Boolean IsSelected() const { return myIsSelected; }
+
   //! Set the state of the owner.
   //! The method is deprecated. Use SetSelected() instead.
-    void State (const Standard_Integer aStatus);
-  
-    Standard_Integer State() const;
-  
+  void State (const Standard_Integer theStatus) { myIsSelected = (theStatus == 1); }
+
+  Standard_Integer State() const { return myIsSelected ? 1 : 0; }
+
   //! if owner is not auto hilighted, for group contains many such owners
   //! will be called one method HilightSelected of SelectableObject
   Standard_EXPORT virtual Standard_Boolean IsAutoHilight() const;
@@ -137,28 +126,25 @@ public:
     return mySelectable == theOther.get();
   }
 
+  //! Returns TRUE if this owner points to a part of object and FALSE for entire object.
+  Standard_Boolean ComesFromDecomposition() const { return myFromDecomposition; }
 
-  DEFINE_STANDARD_RTTIEXT(SelectMgr_EntityOwner,SelectBasics_EntityOwner)
+  //! Sets flag indicating this owner points to a part of object (TRUE) or to entire object (FALSE).
+  void SetComesFromDecomposition (const Standard_Boolean theIsFromDecomposition) { myFromDecomposition = theIsFromDecomposition; }
 
-protected:
-
-
-
-
-private:
+public:
 
+  //! Sets the selectable object.
+  void Set (const Handle(SelectMgr_SelectableObject)& theSelObj) { SetSelectable (theSelObj); }
 
-  SelectMgr_SOPtr mySelectable;
-  Standard_Boolean myIsSelected;
+protected:
 
+  SelectMgr_SelectableObject* mySelectable;        //!< raw pointer to selectable object
+  Standard_Boolean            myIsSelected;        //!< flag indicating selected state
+  Standard_Boolean            myFromDecomposition; //!< flag indicating this owner points to a part of object (TRUE) or to entire object (FALSE)
 
 };
 
-
-#include <SelectMgr_EntityOwner.lxx>
-
-
-
-
+DEFINE_STANDARD_HANDLE(SelectMgr_EntityOwner, SelectBasics_EntityOwner)
 
 #endif // _SelectMgr_EntityOwner_HeaderFile