00001 00002 // exotkAF_ViewBackgroundColorMenuNode.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 <exotkAF_ViewBackgroundColorMenuNode.hxx> 00030 #ifndef _exotkAF_View_HeaderFile 00031 #include <exotkAF_View.hxx> 00032 #endif 00033 #ifndef _Quantity_Color_HeaderFile 00034 #include <Quantity_Color.hxx> 00035 #endif 00036 #ifndef _exotkAF_HeaderFile 00037 #include <exotkAF.hxx> 00038 #endif 00039 #ifndef _exotkAF_Application_HeaderFile 00040 #include <exotkAF_Application.hxx> 00041 #endif 00042 #ifndef _exotkGUI_GUI_HeaderFile 00043 #include <exotkGUI_GUI.hxx> 00044 #endif 00045 #ifndef _exotkGUI_HeaderFile 00046 #include <exotkGUI.hxx> 00047 #endif 00048 00049 // 00050 IMPLEMENT_STANDARD_HANDLE(exotkAF_ViewBackgroundColorMenuNode, exotkTree_MenuNode) 00051 IMPLEMENT_STANDARD_RTTI(exotkAF_ViewBackgroundColorMenuNode, exotkTree_MenuNode) 00052 // 00053 // Foreach ancestors, we add a IMPLEMENT_STANDARD_SUPERTYPE and 00054 // a IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY macro. 00055 // We must respect the order: from the direct ancestor class 00056 // to the base class. 00057 // 00058 00059 IMPLEMENT_STANDARD_TYPE(exotkAF_ViewBackgroundColorMenuNode) 00060 IMPLEMENT_STANDARD_SUPERTYPE(exotkTree_MenuNode) 00061 IMPLEMENT_STANDARD_SUPERTYPE(exotkTree_TreeNode) 00062 IMPLEMENT_STANDARD_SUPERTYPE(MMgt_TShared) 00063 IMPLEMENT_STANDARD_SUPERTYPE(Standard_Transient) 00064 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() 00065 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(exotkTree_MenuNode) 00066 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(exotkTree_TreeNode) 00067 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(MMgt_TShared) 00068 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(Standard_Transient) 00069 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() 00070 IMPLEMENT_STANDARD_TYPE_END(exotkAF_ViewBackgroundColorMenuNode) 00071 00072 //================================================================================== 00073 // Function name : exotkAF_ViewBackgroundColorMenuNode::exotkAF_ViewBackgroundColorMenuNode 00074 //================================================================================== 00075 // Written by : Stephane Routelous - 2001-11-06 15:53:16 00076 // Description : 00077 // Return type : 00078 //================================================================================== 00079 // Argument : const Handle_exotkAF_View& aView 00080 exotkAF_ViewBackgroundColorMenuNode::exotkAF_ViewBackgroundColorMenuNode(const Handle_exotkAF_View& aView) 00081 :myView(aView) 00082 { 00083 myName = "Set Background Color..."; 00084 } 00085 00086 00087 //================================================================================== 00088 // Function name : exotkAF_ViewBackgroundColorMenuNode::~exotkAF_ViewBackgroundColorMenuNode 00089 //================================================================================== 00090 // Written by : Stephane Routelous - 2001-11-06 15:53:18 00091 // Description : 00092 // Return type : 00093 //================================================================================== 00094 exotkAF_ViewBackgroundColorMenuNode::~exotkAF_ViewBackgroundColorMenuNode() 00095 { 00096 } 00097 00098 //================================================================================== 00099 // Function name : exotkAF_ViewBackgroundColorMenuNode::Execute 00100 //================================================================================== 00101 // Written by : Stephane Routelous - 2001-11-06 15:53:20 00102 // Description : 00103 // Return type : Standard_Boolean 00104 //================================================================================== 00105 Standard_Boolean exotkAF_ViewBackgroundColorMenuNode::Execute() 00106 { 00107 Standard_Boolean theSuccess = Standard_False; 00108 Quantity_Color theOldColor; 00109 if (myView->BackgroundColor(theOldColor)) 00110 { 00111 Quantity_Color theNewColor; 00112 Handle_exotkAF_Application theApp = exotkAF::Application(); 00113 if (!theApp.IsNull()) 00114 { 00115 Standard_Boolean theColorIsSelected = Standard_False; 00116 if (exotkGUI::SelectColor(theOldColor, theNewColor,theColorIsSelected) && theColorIsSelected) 00117 { 00118 if (myView->SetBackgroundColor(theNewColor)) 00119 { 00120 theSuccess = Standard_True; 00121 } 00122 } 00123 } 00124 } 00125 return theSuccess; 00126 }
1.2.12 written by Dimitri van Heesch,
© 1997-2001