Salome HOME
Copyrights update
[modules/gui.git] / src / CAM / CAM_Application.h
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
2 // 
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either 
6 // version 2.1 of the License.
7 // 
8 // This library is distributed in the hope that it will be useful 
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public  
14 // License along with this library; if not, write to the Free Software 
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/
18 //
19 #ifndef CAM_APPLICATION_H
20 #define CAM_APPLICATION_H
21
22 #include "STD_Application.h"
23
24 #include "CAM_Module.h"
25
26 #include <qptrlist.h>
27
28 class QPopupMenu;
29
30 #ifdef WIN32
31 #pragma warning( disable:4251 )
32 #endif
33
34 class CAM_EXPORT CAM_Application : public STD_Application  
35 {
36   Q_OBJECT
37
38 public:
39   typedef QPtrList<CAM_Module>         ModuleList;
40   typedef QPtrListIterator<CAM_Module> ModuleListIterator;
41
42 public:
43   CAM_Application( const bool = true );
44   virtual ~CAM_Application();
45
46   virtual void        start();
47
48   CAM_Module*         activeModule() const;
49   CAM_Module*         module(  const QString& ) const;
50
51   /** @name Modules lists.*/
52   //@{
53   ModuleListIterator  modules() const;
54   void                modules( ModuleList& ) const;
55   void                modules( QStringList&, const bool loaded = true ) const;
56   //@}
57
58   virtual void        addModule( CAM_Module* );
59
60   virtual void        loadModules();
61   virtual CAM_Module* loadModule( const QString& );
62
63   virtual bool        activateModule( const QString& );
64
65   virtual void        contextMenuPopup( const QString&, QPopupMenu*, QString& );
66
67   QString             moduleName( const QString& ) const;
68   QString             moduleTitle( const QString& ) const;
69
70   virtual void        createEmptyStudy();
71
72 protected:
73   virtual SUIT_Study* createNewStudy();
74   virtual void        updateCommandsStatus();
75
76   virtual void        moduleAdded( CAM_Module* );
77   virtual void        beforeCloseDoc( SUIT_Study* );
78   virtual bool        activateModule( CAM_Module* = 0 );
79
80   virtual void        setActiveStudy( SUIT_Study* );
81
82   QString             moduleLibrary( const QString&, const bool = true ) const;
83
84 private:
85   void                readModuleList();
86
87 private:
88   typedef struct { QString name, title, internal; } ModuleInfo;
89   typedef QValueList<ModuleInfo>                    ModuleInfoList;
90
91 private:
92   CAM_Module*         myModule;
93   ModuleList          myModules;
94   ModuleInfoList      myInfoList;
95   bool                            myAutoLoad;
96 };
97
98 #ifdef WIN32
99 #pragma warning( default:4251 )
100 #endif
101
102 #endif