00001 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE 00002 // 00003 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, 00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 00005 // 00006 // This library is free software; you can redistribute it and/or 00007 // modify it under the terms of the GNU Lesser General Public 00008 // License as published by the Free Software Foundation; either 00009 // version 2.1 of the License. 00010 // 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 // Lesser General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU Lesser General Public 00017 // License along with this library; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 // 00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com 00021 // 00022 00023 #ifndef CAM_APPLICATION_H 00024 #define CAM_APPLICATION_H 00025 00026 #include "CAM.h" 00027 00028 #include <STD_Application.h> 00029 #include <QList> 00030 00031 class QMenu; 00032 class CAM_Module; 00033 00034 #ifdef WIN32 00035 #pragma warning( disable:4251 ) 00036 #endif 00037 00038 class CAM_EXPORT CAM_Application : public STD_Application 00039 { 00040 Q_OBJECT 00041 00042 public: 00043 typedef QList<CAM_Module*> ModuleList; 00044 00045 public: 00046 CAM_Application( const bool = true ); 00047 virtual ~CAM_Application(); 00048 00049 virtual void start(); 00050 00051 CAM_Module* activeModule() const; 00052 CAM_Module* module( const QString& ) const; 00053 00054 ModuleList modules() const; 00055 void modules( ModuleList& ) const; 00056 void modules( QStringList&, const bool loaded = true ) const; 00057 00058 virtual void addModule( CAM_Module* ); 00059 00060 virtual void loadModules(); 00061 virtual CAM_Module* loadModule( const QString&, const bool = true ); 00062 00063 virtual bool activateModule( const QString& ); 00064 00065 virtual void contextMenuPopup( const QString&, QMenu*, QString& ); 00066 00067 QString moduleName( const QString& ) const; 00068 QString moduleTitle( const QString& ) const; 00069 QString moduleIcon( const QString& ) const; 00070 bool isModuleAccessible( const QString& ) const; 00071 00072 virtual void createEmptyStudy(); 00073 00074 protected: 00075 virtual SUIT_Study* createNewStudy(); 00076 virtual void updateCommandsStatus(); 00077 00078 virtual void moduleAdded( CAM_Module* ); 00079 virtual void beforeCloseDoc( SUIT_Study* ); 00080 virtual void afterCloseDoc(); 00081 virtual bool activateModule( CAM_Module* = 0 ); 00082 00083 virtual void setActiveStudy( SUIT_Study* ); 00084 00085 QString moduleLibrary( const QString&, const bool = true ) const; 00086 00087 private: 00088 void readModuleList(); 00089 00090 private: 00091 typedef struct { QString name, title, internal, icon; bool isSingleton; } ModuleInfo; 00092 typedef QList<ModuleInfo> ModuleInfoList; 00093 00094 private: 00095 CAM_Module* myModule; 00096 ModuleList myModules; 00097 ModuleInfoList myInfoList; 00098 bool myAutoLoad; 00099 }; 00100 00101 #ifdef WIN32 00102 #pragma warning( default:4251 ) 00103 #endif 00104 00105 #endif