src/CAM/CAM_Application.h

Go to the documentation of this file.
00001 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
00002 // 
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either 
00006 // version 2.1 of the License.
00007 // 
00008 // This library is distributed in the hope that it will be useful 
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public  
00014 // License along with this library; if not, write to the Free Software 
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 #ifndef CAM_APPLICATION_H
00020 #define CAM_APPLICATION_H
00021 
00022 #include "STD_Application.h"
00023 
00024 #include "CAM_Module.h"
00025 
00026 #include <qptrlist.h>
00027 
00028 class QPopupMenu;
00029 
00030 #ifdef WIN32
00031 #pragma warning( disable:4251 )
00032 #endif
00033 
00041 class CAM_EXPORT CAM_Application : public STD_Application  
00042 {
00043   Q_OBJECT
00044 
00045 public:
00046   typedef QPtrList<CAM_Module>         ModuleList;
00047   typedef QPtrListIterator<CAM_Module> ModuleListIterator;
00048 
00049 public:
00050   CAM_Application( const bool = true );
00051   virtual ~CAM_Application();
00052 
00053   virtual void        start();
00054 
00055   CAM_Module*         activeModule() const;
00056   CAM_Module*         module(  const QString& ) const;
00057 
00060   ModuleListIterator  modules() const;
00061   void                modules( ModuleList& ) const;
00062   void                modules( QStringList&, const bool loaded = true ) const;
00064 
00065   virtual void        addModule( CAM_Module* );
00066 
00067   virtual void        loadModules();
00068   virtual CAM_Module* loadModule( const QString& );
00069 
00070   virtual bool        activateModule( const QString& );
00071 
00072   virtual void        contextMenuPopup( const QString&, QPopupMenu*, QString& );
00073 
00074   QString             moduleName( const QString& ) const;
00075   QString             moduleTitle( const QString& ) const;
00076 
00077   virtual void        createEmptyStudy();
00078 
00079 protected:
00080   virtual SUIT_Study* createNewStudy();
00081   virtual void        updateCommandsStatus();
00082 
00083   virtual void        moduleAdded( CAM_Module* );
00084   virtual void        beforeCloseDoc( SUIT_Study* );
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; } ModuleInfo;
00096   typedef QValueList<ModuleInfo>                    ModuleInfoList;
00097 
00098 private:
00099   CAM_Module*         myModule;
00100   ModuleList          myModules;
00101   ModuleInfoList      myInfoList;
00102   bool                        myAutoLoad;
00103 };
00104 
00105 #ifdef WIN32
00106 #pragma warning( default:4251 )
00107 #endif
00108 
00109 #endif