Salome HOME
Update from BR_V5_DEV 13Feb2009
[modules/gui.git] / src / CAM / CAM_Application.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 #ifndef CAM_APPLICATION_H
23 #define CAM_APPLICATION_H
24
25 #include "CAM.h"
26
27 #include <STD_Application.h>
28 #include <QList>
29
30 class QMenu;
31 class CAM_Module;
32
33 #ifdef WIN32
34 #pragma warning( disable:4251 )
35 #endif
36
37 class CAM_EXPORT CAM_Application : public STD_Application  
38 {
39   Q_OBJECT
40
41 public:
42   typedef QList<CAM_Module*> ModuleList;
43
44 public:
45   CAM_Application( const bool = true );
46   virtual ~CAM_Application();
47
48   virtual void        start();
49
50   CAM_Module*         activeModule() const;
51   CAM_Module*         module( const QString& ) const;
52
53   ModuleList          modules() const;
54   void                modules( ModuleList& ) const;
55   void                modules( QStringList&, const bool loaded = true ) const;
56
57   virtual void        addModule( CAM_Module* );
58
59   virtual void        loadModules();
60   virtual CAM_Module* loadModule( const QString&, const bool = true );
61
62   virtual bool        activateModule( const QString& );
63
64   virtual void        contextMenuPopup( const QString&, QMenu*, QString& );
65
66   QString             moduleName( const QString& ) const;
67   QString             moduleTitle( const QString& ) const;
68   QString             moduleIcon( 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, icon; } ModuleInfo;
89   typedef QList<ModuleInfo> ModuleInfoList;
90
91 private:
92   CAM_Module*         myModule;        //!< active module
93   ModuleList          myModules;       //!< loaded modules list
94   ModuleInfoList      myInfoList;      //!< modules info list
95   bool                myAutoLoad;      //!< auto loading flag
96 };
97
98 #ifdef WIN32
99 #pragma warning( default:4251 )
100 #endif
101
102 #endif