Back to index

salome-gui  6.5.0
CAM_Application.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  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   typedef struct { QString name;  QString version; } ModuleShortInfo;
00045   typedef QList<ModuleShortInfo> ModuleShortInfoList;
00046 
00047 public:
00048   CAM_Application( const bool = true );
00049   virtual ~CAM_Application();
00050 
00051   virtual void        start();
00052 
00053   CAM_Module*         activeModule() const;
00054   CAM_Module*         module( const QString& ) const;
00055 
00056   ModuleList          modules() const;
00057   void                modules( ModuleList& ) const;
00058   void                modules( QStringList&, const bool loaded = true ) const;
00059 
00060   virtual void        addModule( CAM_Module* );
00061 
00062   virtual void        loadModules();
00063   virtual CAM_Module* loadModule( const QString&, const bool = true );
00064 
00065   virtual bool        activateModule( const QString& );
00066 
00067   virtual void        contextMenuPopup( const QString&, QMenu*, QString& );
00068 
00069   QString             moduleName( const QString& ) const;
00070   QString             moduleTitle( const QString& ) const;
00071   QString             moduleIcon( const QString& ) const;
00072   bool                isModuleAccessible( const QString& ) const;
00073 
00074   virtual void        createEmptyStudy();
00075 
00076   ModuleShortInfoList getVersionInfo() const;
00077 
00078 protected:
00079   virtual SUIT_Study* createNewStudy();
00080   virtual void        updateCommandsStatus();
00081 
00082   virtual void        moduleAdded( CAM_Module* );
00083   virtual void        beforeCloseDoc( SUIT_Study* );
00084   virtual void        afterCloseDoc();
00085   virtual bool        activateModule( CAM_Module* = 0 );
00086 
00087   virtual void        setActiveStudy( SUIT_Study* );
00088 
00089   QString             moduleLibrary( const QString&, const bool = true ) const;
00090 
00091 private:
00092   void                readModuleList();
00093 
00094 private:
00095   typedef struct { QString name, title, internal, icon; bool isSingleton; QString version; } ModuleInfo;
00096   typedef QList<ModuleInfo> ModuleInfoList;
00097 
00098 private:
00099   CAM_Module*         myModule;        
00100   ModuleList          myModules;       
00101   ModuleInfoList      myInfoList;      
00102   bool                myAutoLoad;      
00103   bool                myBlocked;       
00104 };
00105 
00106 #ifdef WIN32
00107 #pragma warning( default:4251 )
00108 #endif
00109 
00110 #endif