Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[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 /*!
35   \class CAM_Application
36   Defines application configuration and behaviour for application with modules.
37   Every module has own data model, necessary windows and viewers, etc.
38   Application provides all necessary functionality for module management
39   (loading of modules/activation/deactivation, etc)
40 */
41 class CAM_EXPORT CAM_Application : public STD_Application  
42 {
43   Q_OBJECT
44
45 public:
46   typedef QPtrList<CAM_Module>         ModuleList;
47   typedef QPtrListIterator<CAM_Module> ModuleListIterator;
48
49 public:
50   CAM_Application( const bool = true );
51   virtual ~CAM_Application();
52
53   virtual void        start();
54
55   CAM_Module*         activeModule() const;
56   CAM_Module*         module(  const QString& ) const;
57
58   /** @name Modules lists.*/
59   //@{
60   ModuleListIterator  modules() const;
61   void                modules( ModuleList& ) const;
62   void                modules( QStringList&, const bool loaded = true ) const;
63   //@}
64
65   virtual void        addModule( CAM_Module* );
66
67   virtual void        loadModules();
68   virtual CAM_Module* loadModule( const QString& );
69
70   virtual bool        activateModule( const QString& );
71
72   virtual void        contextMenuPopup( const QString&, QPopupMenu*, QString& );
73
74   QString             moduleName( const QString& ) const;
75   QString             moduleTitle( const QString& ) const;
76
77   virtual void        createEmptyStudy();
78
79 protected:
80   virtual SUIT_Study* createNewStudy();
81   virtual void        updateCommandsStatus();
82
83   virtual void        moduleAdded( CAM_Module* );
84   virtual void        beforeCloseDoc( SUIT_Study* );
85   virtual bool        activateModule( CAM_Module* = 0 );
86
87   virtual void        setActiveStudy( SUIT_Study* );
88
89   QString             moduleLibrary( const QString&, const bool = true ) const;
90
91 private:
92   void                readModuleList();
93
94 private:
95   typedef struct { QString name, title, internal; } ModuleInfo;
96   typedef QValueList<ModuleInfo>                    ModuleInfoList;
97
98 private:
99   CAM_Module*         myModule;
100   ModuleList          myModules;
101   ModuleInfoList      myInfoList;
102   bool                            myAutoLoad;
103 };
104
105 #ifdef WIN32
106 #pragma warning( default:4251 )
107 #endif
108
109 #endif