1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
37 class QtxActionMenuMgr;
38 class QtxActionToolMgr;
40 class SUIT_Application;
43 class CAM_Application;
46 #pragma warning( disable: 4251 )
49 class CAM_EXPORT CAM_Module : public QObject
55 CAM_Module( const QString& );
56 virtual ~CAM_Module();
58 virtual void initialize( CAM_Application* );
61 QString moduleName() const;
62 virtual QPixmap moduleIcon() const;
63 virtual QString iconName() const;
65 CAM_DataModel* dataModel() const;
66 CAM_Application* application() const;
68 virtual void contextMenuPopup( const QString&, QMenu*, QString& ) {};
69 virtual void updateCommandsStatus() {};
71 virtual void putInfo( const QString&, const int = -1 );
73 bool isActiveModule() const;
75 virtual void setMenuShown( const bool );
76 void setMenuShown( QAction*, const bool );
77 void setMenuShown( const int, const bool );
79 virtual void setToolShown( const bool );
80 void setToolShown( QAction*, const bool );
81 void setToolShown( const int, const bool );
83 virtual void updateModuleVisibilityState();
86 virtual bool activateModule( SUIT_Study* );
87 virtual bool deactivateModule( SUIT_Study* );
89 virtual void connectToStudy( CAM_Study* );
91 virtual void studyClosed( SUIT_Study* );
92 virtual void studyChanged( SUIT_Study*, SUIT_Study* );
94 virtual void onApplicationClosed( SUIT_Application* );
97 void onInfoChanged( QString );
100 virtual bool isSelectionCompatible();
102 virtual CAM_DataModel* createDataModel();
104 void setName( const QString& );
105 virtual void setModuleName( const QString& );
107 QtxActionMenuMgr* menuMgr() const;
108 QtxActionToolMgr* toolMgr() const;
110 int createTool( const QString& );
111 int createTool( const int, const int, const int = -1 );
112 int createTool( const int, const QString&, const int = -1 );
113 int createTool( QAction*, const int, const int = -1, const int = -1 );
114 int createTool( QAction*, const QString&, const int = -1, const int = -1 );
116 int createMenu( const QString&, const int, const int = -1, const int = -1, const int = -1 );
117 int createMenu( const QString&, const QString&, const int = -1, const int = -1, const int = -1 );
118 int createMenu( const int, const int, const int = -1, const int = -1 );
119 int createMenu( const int, const QString&, const int = -1, const int = -1 );
120 int createMenu( QAction*, const int, const int = -1, const int = -1, const int = -1 );
121 int createMenu( QAction*, const QString&, const int = -1, const int = -1, const int = -1 );
123 static QAction* separator();
125 QAction* action( const int ) const;
126 int actionId( const QAction* ) const;
128 int registerAction( const int, QAction* );
129 bool unregisterAction( const int );
130 bool unregisterAction( QAction* );
131 QAction* createAction( const int, const QString&, const QIcon&, const QString&,
132 const QString&, const int, QObject* = 0,
133 const bool = false, QObject* = 0, const char* = 0, const QString& = QString() );
136 CAM_Application* myApp; //!< parent application object
137 QString myName; //!< module title (user name)
138 QPixmap myIcon; //!< module icon
139 QString myInfo; //!< latest info message
140 CAM_DataModel* myDataModel; //!< data model
141 QMap<int, QAction*> myActionMap; //!< menu actions
142 bool myMenuShown; //!< menu shown flag
143 bool myToolShown; //!< tool shown flag
145 friend class CAM_Application;
149 #pragma warning( default: 4251 )
154 typedef CAM_Module* (*GET_MODULE_FUNC)();
155 typedef char* (*GET_VERSION_FUNC)();
158 #define GET_MODULE_NAME "createModule"
159 #define GET_VERSION_NAME "getModuleVersion"