Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

exotkAIS_InteractiveObjectPopup.cxx

Go to the documentation of this file.
00001 
00002 //   exotkAIS_InteractiveObjectPopup.cxx
00004 //    Copyright (C) 2001  Stephane Routelous
00005 //
00006 //    This file is part of exoTK.
00007 //
00008 //    exoTK is free software; you can redistribute it and/or modify
00009 //    it under the terms of the GNU General Public License as published by
00010 //    the Free Software Foundation; either version 2 of the License, or
00011 //    (at your option) any later version.
00012 //
00013 //    exoTK is distributed in the hope that it will be useful,
00014 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 //    GNU General Public License for more details.
00017 //
00018 //    You should have received a copy of the GNU General Public License
00019 //    along with exoTK; if not, write to the Free Software
00020 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 
00029 #include <exotkAIS_InteractiveObjectPopup.hxx>
00030 #ifndef  _AIS_InteractiveObject_HeaderFile
00031 #include <AIS_InteractiveObject.hxx>
00032 #endif
00033 #ifndef  _exotkAIS_HeaderFile
00034 #include <exotkAIS.hxx>
00035 #endif
00036 #ifndef  _exotkTree_TreeNode_HeaderFile
00037 #include <exotkTree_TreeNode.hxx>
00038 #endif
00039 #ifndef  _exotkAIS_DisplayManager_HeaderFile
00040 #include <exotkAIS_DisplayManager.hxx>
00041 #endif
00042 #ifndef  _AIS_InteractiveContext_HeaderFile
00043 #include <AIS_InteractiveContext.hxx>
00044 #endif
00045 //
00046 IMPLEMENT_STANDARD_HANDLE(exotkAIS_InteractiveObjectPopup, exotkTree_Menu)
00047 IMPLEMENT_STANDARD_RTTI(exotkAIS_InteractiveObjectPopup, exotkTree_Menu)
00048 //
00049 // Foreach ancestors, we add a IMPLEMENT_STANDARD_SUPERTYPE and 
00050 // a IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY macro.
00051 // We must respect the order: from the direct ancestor class
00052 // to the base class.
00053 //
00054 
00055 IMPLEMENT_STANDARD_TYPE(exotkAIS_InteractiveObjectPopup)
00056 IMPLEMENT_STANDARD_SUPERTYPE(exotkTree_Menu) 
00057 IMPLEMENT_STANDARD_SUPERTYPE(exotkTree_Tree) 
00058 IMPLEMENT_STANDARD_SUPERTYPE(MMgt_TShared) 
00059 IMPLEMENT_STANDARD_SUPERTYPE(Standard_Transient)
00060 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY()
00061 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(exotkTree_Menu)
00062 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(exotkTree_Tree)
00063 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(MMgt_TShared)
00064 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(Standard_Transient)
00065 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END()
00066 IMPLEMENT_STANDARD_TYPE_END(exotkAIS_InteractiveObjectPopup)
00067 
00068 
00069 exotkAIS_InteractiveObjectPopup::exotkAIS_InteractiveObjectPopup()
00070 {
00071 }
00072 
00073 exotkAIS_InteractiveObjectPopup::~exotkAIS_InteractiveObjectPopup()
00074 {
00075 }
00076 
00077 Standard_Boolean exotkAIS_InteractiveObjectPopup::Create(const Handle_AIS_InteractiveObject &anInteractiveObject)
00078 {
00079         Standard_Boolean theSuccess = Standard_False;
00080         Handle_exotkAIS_InteractiveObjectPopup theCreatedPopup = exotkAIS::CreatePopupMenu(anInteractiveObject);
00081         if (!theCreatedPopup.IsNull())
00082         {
00083                 Handle_exotkTree_TreeNode theRoot = theCreatedPopup->Root();
00084                 if (!theRoot.IsNull()) 
00085                 {
00086                         SetRoot(theRoot);
00087                         theSuccess = Standard_True;
00088                 }
00089         }
00090         
00091         return theSuccess;
00092 }
00093 Standard_Boolean exotkAIS_InteractiveObjectPopup::Create(const Handle_exotkAIS_DisplayManager& aDisplayManager)
00094 {
00095         Standard_Boolean theSuccess = Standard_False;
00096         Handle_AIS_InteractiveContext theCtx = aDisplayManager->InteractiveContext();
00097         Handle_AIS_InteractiveObject theIO;
00098         for ( theCtx->InitCurrent() ; theCtx->MoreCurrent() && theIO.IsNull(); theCtx->NextCurrent() )
00099         {
00100                 theIO = theCtx->Current();
00101         }
00102         Handle_exotkAIS_InteractiveObjectPopup theCreatedPopup = exotkAIS::CreatePopupMenu(theIO);
00103         if (!theCreatedPopup.IsNull())
00104         {
00105                 Handle_exotkTree_TreeNode theRoot = theCreatedPopup->Root();
00106                 if (!theRoot.IsNull()) 
00107                 {
00108                         SetRoot(theRoot);
00109                         theSuccess = Standard_True;
00110                 }
00111         }
00112         
00113         return theSuccess;
00114 
00115 }

Generated on Wed Jan 23 12:16:41 2002 for exotk by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001