00001 00002 // exotkAIS_DisplayModeMenuNode.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 00028 #include <exotkAIS_DisplayModeMenuNode.hxx> 00029 00030 #ifndef _AIS_InteractiveObject_HeaderFile 00031 #include <AIS_InteractiveObject.hxx> 00032 #endif 00033 #ifndef _AIS_InteractiveContext_HeaderFile 00034 #include <AIS_InteractiveContext.hxx> 00035 #endif 00036 // 00037 IMPLEMENT_STANDARD_HANDLE(exotkAIS_DisplayModeMenuNode, exotkTree_MenuNode) 00038 IMPLEMENT_STANDARD_RTTI(exotkAIS_DisplayModeMenuNode, exotkTree_MenuNode) 00039 // 00040 // Foreach ancestors, we add a IMPLEMENT_STANDARD_SUPERTYPE and 00041 // a IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY macro. 00042 // We must respect the order: from the direct ancestor class 00043 // to the base class. 00044 // 00045 00046 IMPLEMENT_STANDARD_TYPE(exotkAIS_DisplayModeMenuNode) 00047 IMPLEMENT_STANDARD_SUPERTYPE(exotkTree_MenuNode) 00048 IMPLEMENT_STANDARD_SUPERTYPE(exotkTree_TreeNode) 00049 IMPLEMENT_STANDARD_SUPERTYPE(MMgt_TShared) 00050 IMPLEMENT_STANDARD_SUPERTYPE(Standard_Transient) 00051 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() 00052 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(exotkTree_MenuNode) 00053 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(exotkTree_TreeNode) 00054 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(MMgt_TShared) 00055 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(Standard_Transient) 00056 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() 00057 IMPLEMENT_STANDARD_TYPE_END(exotkAIS_DisplayModeMenuNode) 00058 00059 exotkAIS_DisplayModeMenuNode::exotkAIS_DisplayModeMenuNode(const Handle_AIS_InteractiveObject& anInteractiveObject,const enum exotkAIS_DisplayMode aMode) 00060 :myInteractiveObject(anInteractiveObject),myDisplayMode(aMode) 00061 { 00062 myIsChecked = ( anInteractiveObject->DisplayMode() == aMode ); 00063 } 00064 00065 00066 //================================================================================== 00067 // Function name : exotkAIS_DisplayModeMenuNode::~exotkAIS_DisplayModeMenuNode 00068 //================================================================================== 00069 // Written by : Stephane Routelous - 2001-11-06 15:54:27 00070 // Description : 00071 // Return type : 00072 //================================================================================== 00073 exotkAIS_DisplayModeMenuNode::~exotkAIS_DisplayModeMenuNode() 00074 { 00075 } 00076 00077 //================================================================================== 00078 // Function name : exotkAIS_DisplayModeMenuNode::Execute 00079 //================================================================================== 00080 // Written by : Stephane Routelous - 2001-11-06 15:54:29 00081 // Description : 00082 // Return type : Standard_Boolean 00083 //================================================================================== 00084 Standard_Boolean exotkAIS_DisplayModeMenuNode::Execute() 00085 { 00086 Standard_Boolean theReturnValue = Standard_False; 00087 if ( !myInteractiveObject.IsNull() ) 00088 { 00089 if ( myInteractiveObject->HasInteractiveContext() ) 00090 { 00091 Handle_AIS_InteractiveContext theAISContext = myInteractiveObject->GetContext(); 00092 if ( !theAISContext.IsNull() ) 00093 { 00094 try 00095 { 00096 theAISContext->SetDisplayMode(myInteractiveObject,(Standard_Integer)myDisplayMode); 00097 theReturnValue = Standard_True; 00098 } 00099 catch(Standard_Failure) 00100 { 00101 theReturnValue = Standard_False; 00102 } 00103 catch(...) 00104 { 00105 theReturnValue = Standard_False; 00106 } 00107 } 00108 } 00109 } 00110 return theReturnValue; 00111 }
1.2.12 written by Dimitri van Heesch,
© 1997-2001