1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
26 #include <qpopupmenu.h>
31 class SUIT_Application;
34 class CAM_Application;
35 class QtxActionMenuMgr;
36 class QtxActionToolMgr;
39 #pragma warning( disable: 4251 )
43 * Class provide support of tool and menu managers.
45 class CAM_EXPORT CAM_Module : public QObject
51 CAM_Module( const QString& );
52 virtual ~CAM_Module();
54 virtual void initialize( CAM_Application* );
56 QString moduleName() const;
57 QPixmap moduleIcon() const;
59 CAM_DataModel* dataModel() const;
60 CAM_Application* application() const;
62 virtual QString iconName() const;
64 virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& title ) {};
65 virtual void updateCommandsStatus() {};
67 /** @name Set Menu Shown*/
69 virtual void setMenuShown( const bool );
70 void setMenuShown( QAction*, const bool );
71 void setMenuShown( const int, const bool );
74 /** @name Set Tool Shown*/
76 virtual void setToolShown( const bool );
77 void setToolShown( QAction*, const bool );
78 void setToolShown( const int, const bool );
82 virtual bool activateModule( SUIT_Study* );
83 virtual bool deactivateModule( SUIT_Study* );
85 virtual void connectToStudy( CAM_Study* );
87 virtual void studyClosed( SUIT_Study* );
88 virtual void studyChanged( SUIT_Study*, SUIT_Study* );
90 virtual void onApplicationClosed( SUIT_Application* );
93 virtual CAM_DataModel* createDataModel();
95 virtual void setModuleName( const QString& );
96 virtual void setModuleIcon( const QPixmap& );
98 QtxActionMenuMgr* menuMgr() const;
99 QtxActionToolMgr* toolMgr() const;
101 /** @name Create tool methods.*/
103 int createTool( const QString& );
104 int createTool( const int, const int, const int = -1 );
105 int createTool( const int, const QString&, const int = -1 );
106 int createTool( QAction*, const int, const int = -1, const int = -1 );
107 int createTool( QAction*, const QString&, const int = -1, const int = -1 );
110 /** @name Create menu methods.*/
112 int createMenu( const QString&, const int, const int = -1, const int = -1, const int = -1, const bool = false );
113 int createMenu( const QString&, const QString&, const int = -1, const int = -1, const int = -1, const bool = false );
114 int createMenu( const int, const int, const int = -1, const int = -1 );
115 int createMenu( const int, const QString&, const int = -1, const int = -1 );
116 int createMenu( QAction*, const int, const int = -1, const int = -1, const int = -1 );
117 int createMenu( QAction*, const QString&, const int = -1, const int = -1, const int = -1 );
120 static QAction* separator();
122 /**Action ids methods.*/
124 QAction* action( const int ) const;
125 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 QIconSet&, const QString&,
132 const QString&, const int, QObject* = 0,
133 const bool = false, QObject* = 0, const char* = 0 );
136 CAM_Application* myApp;
139 CAM_DataModel* myDataModel;
140 QMap<int, QAction*> myActionMap;
142 friend class CAM_Application;
146 #pragma warning( default: 4251 )
150 typedef CAM_Module* (*GET_MODULE_FUNC)();
153 #define GET_MODULE_NAME "createModule"