1 // Copyright (C) 2007-2016 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, or (at your option) any later version.
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
23 #include "CAM_Module.h"
25 #include "CAM_DataModel.h"
26 #include "CAM_Application.h"
27 #include "CAM_Study.h"
29 #include <QtxAction.h>
30 #include <QtxActionGroup.h>
31 #include <QtxActionMenuMgr.h>
32 #include <QtxActionToolMgr.h>
34 #include <SUIT_Desktop.h>
35 #include <SUIT_Session.h>
36 #include <SUIT_ResourceMgr.h>
42 \brief Base implementation of the module in the CAM application architecture.
44 Provides support of menu/toolbars management.
50 ActionMgrLocker( QtxActionMgr* m, bool use ) : myMgr( m ), myUseLock( use )
53 myUpdEnabled = myMgr->isUpdatesEnabled();
54 myMgr->setUpdatesEnabled( false );
60 myMgr->setUpdatesEnabled( myUpdEnabled );
71 \brief Default constructor.
73 Creates unnamed module.
75 CAM_Module::CAM_Module()
85 Creates module with the specified \a name.
87 \param name module name
89 CAM_Module::CAM_Module( const QString& name )
104 CAM_Module::~CAM_Module()
111 \brief Initialize module.
113 This method is usually called when the module is created (for example,
114 on the module library loading).
115 Successor classes can use this method to create menu/toolbar actions
116 and perform other module initialization.
118 \param app parent application object
119 \sa activateModule(), deactivateModule()
121 void CAM_Module::initialize( CAM_Application* app )
126 SUIT_Session* aSession = SUIT_Session::session();
127 connect( aSession, SIGNAL( applicationClosed( SUIT_Application* ) ),
128 this, SLOT( onApplicationClosed( SUIT_Application* ) ) );
130 connect( myApp, SIGNAL( infoChanged( QString ) ), this, SLOT( onInfoChanged( QString ) ) );
135 \brief Get module icon.
136 \return module icon pixmap
139 QPixmap CAM_Module::moduleIcon() const
141 if ( myIcon.isNull() ) {
142 QString iname = iconName();
143 if ( !iname.isEmpty() ) {
144 CAM_Module* that = (CAM_Module*)this;
145 that->myIcon = application()->resourceMgr()->loadPixmap( name(), iname, false );
152 \brief Get module icon's name.
154 This function is used to get module icon's file name.
155 Default implementation returns empty string.
157 \return module icon's name.
160 QString CAM_Module::iconName() const
162 return application()->moduleIcon( name() );
166 \brief Get module (internal) name
168 \sa setName(), moduleName(), setModuleName()
170 QString CAM_Module::name() const
176 \brief Get module title (user name)
178 \sa setModuleName(), name(), setName()
180 QString CAM_Module::moduleName() const
186 \brief Get data model.
188 Creates data model, if it is not yet created.
190 \return data model pointer
191 \sa createDataModel()
193 CAM_DataModel* CAM_Module::dataModel() const
197 CAM_Module* that = (CAM_Module*)this;
198 that->myDataModel = that->createDataModel();
199 that->myDataModel->initialize();
205 \brief Get application.
206 \return application pointer
208 CAM_Application* CAM_Module::application() const
214 \brief If return false, selection will be cleared at module activation
216 bool CAM_Module::isSelectionCompatible()
222 \brief Activate module.
224 This method is called when the user activates module.
225 Successor classes can use this method to customize module activation process,
226 for example, to show own menus, toolbars, etc.
228 Default implementation always returns \c true.
230 \return \c true if module is activated successfully.
231 \sa initialize(), deactivateModule()
233 bool CAM_Module::activateModule( SUIT_Study* /*study*/ )
235 // IMN 05/03/2015: we copied myActionMap for reset/unset actions accelerator keys
236 // after activate/deactivate modules
237 for ( QMap<QAction*, QKeySequence>::Iterator it = myActionShortcutMap.begin(); it != myActionShortcutMap.end(); ++it )
239 // Reset actions accelerator keys
240 it.key()->setShortcut( it.value() );
242 myActionShortcutMap.clear();
247 \brief Deactivate module.
249 This method is called when the user deactivates module.
250 Successor classes can use this method to customize module deactivation process,
251 for example, to hide own menus, toolbars, etc.
253 Default implementation always returns \c true.
255 \return \c true if module is deactivated successfully.
256 \sa initialize(), activateModule()
258 bool CAM_Module::deactivateModule( SUIT_Study* )
260 // IMN 05/03/2015: we copied myActionMap for reset/unset actions accelerator keys
261 // after activate/deactivate modules
262 myActionShortcutMap.clear();
263 for ( QMap<int, QAction*>::Iterator it = myActionMap.begin(); it != myActionMap.end(); ++it )
265 myActionShortcutMap.insert( it.value(), it.value()->shortcut() );
266 it.value()->setShortcut( QKeySequence() );
272 \brief Called when study is closed.
274 Removes data model from the \a study.
276 \param study study being closed
278 void CAM_Module::studyClosed( SUIT_Study* study )
280 CAM_Study* camDoc = dynamic_cast<CAM_Study*>( study );
284 CAM_DataModel* dm = dataModel();
285 if ( dm && camDoc->containsDataModel( dm ) ) {
287 camDoc->removeDataModel( dm );
292 \brief Called when study is changed (obsolete).
294 Default implementation does nothing.
296 \param oldStudy old study
297 \param newStudy new study
299 void CAM_Module::studyChanged( SUIT_Study* /*oldStudy*/, SUIT_Study* /*newStudy*/ )
304 \brief Check if the module is active.
305 \return \c true if module is active.
307 bool CAM_Module::isActiveModule() const
309 return application() ? application()->activeModule() == this : false;
313 \brief Put the text message into the status bar of the application main window.
315 If \a msec > 0, the message will be shown \a msec milliseconds.
316 If \a msec < 0, the message will be constantly displayed until module is active.
318 \param msg text message
319 \param msec message displaying duration in milliseconds
321 void CAM_Module::putInfo( const QString& msg, const int msec )
324 application()->putInfo( msg, msec );
331 \brief Restore message info.
333 Restores constant text message when previous information status message is removed.
335 \param txt previous message (being removed)
338 void CAM_Module::onInfoChanged( QString txt )
340 if ( txt.isEmpty() && isActiveModule() && !myInfo.isEmpty() && application() )
341 application()->putInfo( myInfo );
345 \brief Called when application is closed.
347 Nullify application pointer if the application is being closed.
349 \param theApp application
351 void CAM_Module::onApplicationClosed( SUIT_Application* theApp )
358 \brief Create data model.
359 \return created data model object or 0 if it could not be created
361 CAM_DataModel* CAM_Module::createDataModel()
363 return new CAM_DataModel( this );
367 \brief Set module (internal) name
368 \param name new module name
369 \sa name(), moduleName(), setModuleName()
371 void CAM_Module::setName( const QString& name )
373 setObjectName( name );
377 \brief Set module title (user name)
378 \param name new module title
379 \sa moduleName(), name(), setName()
381 void CAM_Module::setModuleName( const QString& name )
387 \brief Get menu manager.
388 \return menu manager pointer
390 QtxActionMenuMgr* CAM_Module::menuMgr() const
392 QtxActionMenuMgr* mgr = 0;
393 if ( application() && application()->desktop() )
394 mgr = application()->desktop()->menuMgr();
399 \brief Get toolbar manager.
400 \return toolbar manager pointer
402 QtxActionToolMgr* CAM_Module::toolMgr() const
404 QtxActionToolMgr* mgr = 0;
405 if ( application() && application()->desktop() )
406 mgr = application()->desktop()->toolMgr();
411 \brief Create toolbar with speicifed \a name.
413 If the toolbar has been already created, its ID is just returned.
415 \param title toolbar title
416 \param name toolbar name (identifier)
417 \return toolbar ID or -1 if toolbar could not be created
419 int CAM_Module::createTool( const QString& title, const QString& name )
424 ActionMgrLocker lock( toolMgr(), !myToolShown );
426 return toolMgr()->createToolBar( title, name );
430 \brief Add toolbar item.
432 Insert action \a to the toolbar manager and register it with specified \a id.
433 Resulting action ID may differ from the requested one. This can happen if
434 requested ID is already in use.
436 If action has been already added previously, its ID is just returned.
438 If \a id < 0, the action ID is generated automatically.
440 If \a idx < 0, the action is added to the end of the toolbar.
443 \param tBar toolbar ID
444 \param id requested action ID
445 \param idx action index (desired position in the toolbar)
446 \return action ID or -1 if toolbar item could not be added
448 int CAM_Module::createTool( QAction* a, const int tBar, const int id, const int idx )
453 ActionMgrLocker lock( toolMgr(), !myToolShown );
455 int regId = registerAction( id, a );
456 int intId = toolMgr()->insert( a, tBar, idx );
459 setToolShown( a, false );
461 return intId != -1 ? regId : -1;
465 \brief Add toolbar item.
467 Insert action \a to the toolbar manager and register it with specified \a id.
468 Resulting action ID may differ from the requested one. This can happen if
469 requested ID is already in use.
471 If action has been already added previously, its ID is just returned.
473 If \a id < 0, the action ID is generated automatically.
475 If \a idx < 0, the action is added to the end of the toolbar.
478 \param tBar toolbar name
479 \param id requested action ID
480 \param idx action index (desired position in the toolbar)
481 \return action ID or -1 if toolbar item could not be added
483 int CAM_Module::createTool( QAction* a, const QString& tBar, const int id, const int idx )
488 ActionMgrLocker lock( toolMgr(), !myToolShown );
490 int regId = registerAction( id, a );
491 int intId = toolMgr()->insert( a, tBar, idx );
494 setToolShown( a, false );
496 return intId != -1 ? regId : -1;
500 \brief Add toolbar item.
502 Insert action with \a id identifier to the toolbar manager.
503 It is assumed that action has been already registered.
505 Resulting action ID may differ from the requested one. This can happen if
506 requested ID is already in use.
508 If action has been already added previously, its ID is just returned.
510 If \a idx < 0, the action is added to the end of the toolbar.
513 \param tBar toolbar ID
514 \param idx action index (desired position in the toolbar)
515 \return action ID or -1 if toolbar item could not be added
517 int CAM_Module::createTool( const int id, const int tBar, const int idx )
522 ActionMgrLocker lock( toolMgr(), !myToolShown );
524 int intId = toolMgr()->insert( action( id ), tBar, idx );
527 setToolShown( action( id ), false );
529 return intId != -1 ? id : -1;
533 \brief Add toolbar item.
535 Insert action with \a id identifier to the toolbar manager.
536 It is assumed that action has been already registered.
538 Resulting action ID may differ from the requested one. This can happen if
539 requested ID is already in use.
541 If action has been already added previously, its ID is just returned.
543 If \a idx < 0, the action is added to the end of the toolbar.
546 \param tBar toolbar name
547 \param idx action index (desired position in the toolbar)
548 \return action ID or -1 if toolbar item could not be added
550 int CAM_Module::createTool( const int id, const QString& tBar, const int idx )
555 ActionMgrLocker lock( toolMgr(), !myToolShown );
557 int intId = toolMgr()->insert( action( id ), tBar, idx );
560 setToolShown( action( id ), false );
562 return intId != -1 ? id : -1;
566 \brief Create menu or submenu.
568 Create main menu or popup submenu and register it with specified \a id.
569 Resulting action ID may differ from the requested one. This can happen if
570 requested ID is already in use.
572 If \a id < 0, the menu ID is generated automatically.
573 If menu has been already created previously, its ID is just returned.
575 The \a menu parameter represents the menu name - it could be a sequence
576 of strings, separated by '|' symbol. For example, "File|Edit" means
577 File->Edit submenu. If menu doesn't exist, it is created automatically.
579 Parameter \a idx defines the index of the menu item in the menu group which
580 is defined by the \a group. If \a idx < 0, the menu/submenu is added to the
581 end of the menu group.
583 \param subMenu subMenu name
584 \param menu parent menu ID
585 \param id requested menu ID
586 \param group menu group ID
587 \param idx menu item index (desired position in the menu group)
588 \return menu item ID or -1 if menu item could not be added
590 int CAM_Module::createMenu( const QString& subMenu, const int menu,
591 const int id, const int group, const int idx, QMenu * menuObj )
596 return menuMgr()->insert( subMenu, menu, group, id, idx, menuObj );
600 \brief Create menu or submenu.
602 Create main menu or popup submenu and register it with specified \a id.
603 Resulting action ID may differ from the requested one. This can happen if
604 requested ID is already in use.
606 If \a id < 0, the menu ID is generated automatically.
607 If menu has been already created previously, its ID is just returned.
609 The \a menu parameter represents the menu name - it could be a sequence
610 of strings, separated by '|' symbol. For example, "File|Edit" means
611 File->Edit submenu. If menu doesn't exist, it is created automatically.
613 Parameter \a idx defines the index of the menu item in the menu group which
614 is defined by the \a group. If \a idx < 0, the menu/submenu is added to the
615 end of the menu group.
617 \param subMenu subMenu name
618 \param menu parent menu name(s)
619 \param id requested menu ID
620 \param group menu group ID
621 \param idx menu item index (desired position in the menu group)
622 \return menu item ID or -1 if menu item could not be added
624 int CAM_Module::createMenu( const QString& subMenu, const QString& menu,
625 const int id, const int group, const int idx )
630 return menuMgr()->insert( subMenu, menu, group, id, idx );
634 \brief Add menu item.
636 Insert action \a to the menu manager and register it with specified \a id.
637 Resulting action ID may differ from the requested one. This can happen if
638 requested ID is already in use.
640 If \a id < 0, the action ID is generated automatically.
642 If action has been already added previously, its ID is just returned.
644 Parameter \a idx defines the index of the menu item in the menu group which
645 is defined by the \a group. If \a idx < 0, the action is added to the
646 end of the menu group.
650 \param id requested action ID
651 \param group menu group ID
652 \param idx action index (desired position in the menu group)
653 \return action ID or -1 if menu item could not be added
655 int CAM_Module::createMenu( QAction* a, const int menu, const int id, const int group, const int idx )
657 if ( !a || !menuMgr() )
660 ActionMgrLocker lock( menuMgr(), !myMenuShown );
662 int regId = registerAction( id, a );
663 int intId = menuMgr()->insert( a, menu, group, idx );
666 setMenuShown( a, false );
668 return intId != -1 ? regId : -1;
672 \brief Add menu item.
674 Insert action \a to the menu manager and register it with specified \a id.
675 Resulting action ID may differ from the requested one. This can happen if
676 requested ID is already in use.
678 If \a id < 0, the action ID is generated automatically.
680 If action has been already added previously, its ID is just returned.
682 The \a menu parameter represents the menu name - it could be a sequence
683 of strings, separated by '|' symbol. For example, "File|Edit" means
684 File->Edit submenu. If menu doesn't exist, it is created automatically.
686 Parameter \a idx defines the index of the menu item in the menu group which
687 is defined by the \a group. If \a idx < 0, the action is added to the
688 end of the menu group.
691 \param menu menu name(s)
692 \param id requested action ID
693 \param group menu group ID
694 \param idx action index (desired position in the menu group)
695 \return action ID or -1 if menu item could not be added
697 int CAM_Module::createMenu( QAction* a, const QString& menu, const int id, const int group, const int idx )
699 if ( !a || !menuMgr() )
702 ActionMgrLocker lock( menuMgr(), !myMenuShown );
704 int regId = registerAction( id, a );
705 int intId = menuMgr()->insert( a, menu, group, idx );
708 setMenuShown( a, false );
710 return intId != -1 ? regId : -1;
714 \brief Add menu item.
716 Insert action with \a id identifier to the menu manager.
717 It is assumed that action has been already registered.
719 Resulting action ID may differ from the requested one. This can happen if
720 requested ID is already in use.
722 If action has been already added previously, its ID is just returned.
724 Parameter \a idx defines the index of the menu item in the menu group which
725 is defined by the \a group. If \a idx < 0, the action is added to the
726 end of the menu group.
730 \param group menu group ID
731 \param idx action index (desired position in the menu group)
732 \return action ID or -1 if menu item could not be added
734 int CAM_Module::createMenu( const int id, const int menu, const int group, const int idx )
739 ActionMgrLocker lock( menuMgr(), !myMenuShown );
741 int intId = menuMgr()->insert( action( id ), menu, group, idx );
744 setMenuShown( action( id ), false );
746 return intId != -1 ? id : -1;
750 \brief Add menu item.
752 Insert action with \a id identifier to the menu manager.
753 It is assumed that action has been already registered.
755 Resulting action ID may differ from the requested one. This can happen if
756 requested ID is already in use.
758 If action has been already added previously, its ID is just returned.
760 The \a menu parameter represents the menu name - it could be a sequence
761 of strings, separated by '|' symbol. For example, "File|Edit" means
762 File->Edit submenu. If menu doesn't exist, it is created automatically.
764 Parameter \a idx defines the index of the menu item in the menu group which
765 is defined by the \a group. If \a idx < 0, the action is added to the
766 end of the menu group.
769 \param menu menu name(s)
770 \param group menu group ID
771 \param idx action index (desired position in the menu group)
772 \return action ID or -1 if menu item could not be added
774 int CAM_Module::createMenu( const int id, const QString& menu, const int group, const int idx )
779 ActionMgrLocker lock( menuMgr(), !myMenuShown );
781 int intId = menuMgr()->insert( action( id ), menu, group, idx );
784 setMenuShown( action( id ), false );
786 return intId != -1 ? id : -1;
790 \brief Show/hide all module's menus.
791 \param on if \c true, show menus, otherwise, hide all menus
794 void CAM_Module::setMenuShown( const bool on )
798 QtxActionMenuMgr* mMgr = menuMgr();
802 bool upd = mMgr->isUpdatesEnabled();
803 mMgr->setUpdatesEnabled( false );
805 QAction* sep = separator();
806 for ( QMap<int, QAction*>::Iterator it = myActionMap.begin(); it != myActionMap.end(); ++it )
808 if ( it.value() != sep )
809 mMgr->setShown( mMgr->actionId( it.value() ), on );
812 mMgr->setUpdatesEnabled( upd );
818 \brief Show/hide specified menu item.
820 \param on if \c true, show menu item, otherwise, hide it
822 void CAM_Module::setMenuShown( QAction* a, const bool on )
825 menuMgr()->setShown( menuMgr()->actionId( a ), on );
829 \brief Show/hide specified menu item.
830 \param id menu item ID
831 \param on if \c true, show menu item, otherwise, hide it
833 void CAM_Module::setMenuShown( const int id, const bool on )
835 setMenuShown( action( id ), on );
839 \brief Show/hide all module's toolbars.
840 \param on if \c true, show toolbars, otherwise, hide all toolbars
843 void CAM_Module::setToolShown( const bool on )
847 QtxActionToolMgr* tMgr = toolMgr();
851 bool upd = tMgr->isUpdatesEnabled();
852 tMgr->setUpdatesEnabled( false );
854 QAction* sep = separator();
855 for ( QMap<int, QAction*>::Iterator it = myActionMap.begin(); it != myActionMap.end(); ++it )
857 if ( it.value() != sep )
858 tMgr->setShown( tMgr->actionId( it.value() ), on );
861 tMgr->setUpdatesEnabled( upd );
867 \brief Show/hide specified toolbar item.
869 \param on if \c true, show toolbar item, otherwise, hide it
871 void CAM_Module::setToolShown( QAction* a, const bool on )
874 toolMgr()->setShown( toolMgr()->actionId( a ), on );
878 \brief Show/hide specified toolbar item.
879 \param id toolbar item ID
880 \param on if \c true, show toolbar item, otherwise, hide it
882 void CAM_Module::setToolShown( const int id, const bool on )
884 setToolShown( action( id ), on );
888 \brief Get action by specified \a id.
890 \return action or 0 if not found
892 QAction* CAM_Module::action( const int id ) const
895 if ( myActionMap.contains( id ) )
897 else if ( menuMgr() ) {
898 QMenu* m = menuMgr()->findMenu( id );
899 if ( m ) a = m->menuAction();
905 \brief Get action ID.
907 \return action ID or -1 if not found
909 int CAM_Module::actionId( const QAction* a ) const
912 for ( QMap<int, QAction*>::ConstIterator it = myActionMap.begin(); it != myActionMap.end() && id == -1; ++it )
914 if ( it.value() == a )
921 \brief Create new instance of QtxAction and register action with specified \a id.
923 Resulting action ID may differ from the requested one. This can happen if
924 requested ID is already in use.
926 If \a id < 0, the action ID is generated automatically.
928 \param id required action ID
929 \param text tooltip text
930 \param icon action icon
931 \param menu menu text
932 \param tip status bar tip
933 \param key keyboard accelerator
934 \param parent parent object
935 \param toggle if \c true, the action will be toggled
936 \param reciever action activation signal receiver object
937 \param member action activation signal receiver slot
939 QAction* CAM_Module::createAction( const int id, const QString& text, const QIcon& icon,
940 const QString& menu, const QString& tip, const int key,
941 QObject* parent, const bool toggle, QObject* reciever,
942 const char* member, const QString& shortcutAction )
944 QtxAction* a = new QtxAction( text, icon, menu, key, parent, toggle, shortcutAction );
945 a->setStatusTip( tip );
947 if ( reciever && member )
948 connect( a, SIGNAL( triggered( bool ) ), reciever, member );
950 registerAction( id, a );
956 \brief Create new action group.
957 \param id action group ID
958 \param exclusive \c true for exclusive action group
959 \return created action group
961 QtxActionGroup* CAM_Module::createActionGroup( const int id, const bool exclusive )
963 QtxActionGroup* a = qobject_cast<QtxActionGroup*>( action( id ) );
965 a = new QtxActionGroup( this );
966 registerAction( id, a );
968 a->setExclusive( exclusive );
973 \brief Register action in the internal action map.
975 If action has been already added previously, its ID is just returned.
976 If \a id < 0, the action ID is generated automatically.
978 \param id action required ID
982 int CAM_Module::registerAction( const int id, QAction* a )
985 for ( QMap<int, QAction*>::ConstIterator it = myActionMap.begin(); it != myActionMap.end() && ident == -1; ++it )
986 if ( it.value() == a )
992 static int generatedId = -1;
993 ident = id < 0 ? --generatedId : id;
995 myActionMap.insert( ident, a );
998 menuMgr()->registerAction( a );
1001 toolMgr()->registerAction( a );
1003 if ( application() && application()->desktop() )
1004 application()->desktop()->addAction( a );
1010 \brief Unregister action from the internal action map.
1013 \return \c true on success or \c false if action is in use
1015 bool CAM_Module::unregisterAction( const int id )
1017 return unregisterAction( action( id ) );
1021 \brief Unregister action from the internal action map.
1024 \return \c true on success or \c false if action is in use
1026 bool CAM_Module::unregisterAction( QAction* a )
1031 int id = menuMgr()->actionId( a );
1032 if ( id != -1 && menuMgr()->containsMenu( id, -1 ) )
1036 int id = toolMgr()->actionId( a );
1037 if ( id != -1 && toolMgr()->containsAction( id ) )
1041 menuMgr()->unRegisterAction( menuMgr()->actionId( a ) );
1043 toolMgr()->unRegisterAction( toolMgr()->actionId( a ) );
1048 \brief Create separator action.
1050 Separator action can be used in menus or toolbars.
1052 \return new separator action
1054 QAction* CAM_Module::separator()
1056 return QtxActionMgr::separator();
1060 \brief Update visibility state of the module objects.
1062 void CAM_Module::updateModuleVisibilityState() {
1067 \brief Activate GUI operation of module by its ID.
1068 This method is called from CAM_Application::startOperation().
1069 \param actionId is a numerical unique operation id.
1071 bool CAM_Module::activateOperation( int actionId )
1077 \brief Activate GUI operation of module by its ID.
1078 This method is called from CAM_Application::startOperation().
1079 \param actionId is a string unique operation id.
1081 bool CAM_Module::activateOperation( const QString& actionId )
1087 \brief Activate GUI operation of module by its ID and \a pluginName.
1088 This method is called from CAM_Application::startOperation().
1089 \param actionId is a string unique operation id.
1090 \param pluginName is a name of a plugin where the operation is implemented.
1092 bool CAM_Module::activateOperation( const QString& actionId, const QString& pluginName )
1099 \brief Connect data model of the module to the active study
1100 \param camStudy CAM study object
1102 void CAM_Module::connectToStudy( CAM_Study* camStudy )
1104 CAM_Application* app = camStudy ? dynamic_cast<CAM_Application*>( camStudy->application() ) : 0;
1108 CAM_DataModel* prev = 0;
1109 CAM_Application::ModuleList mods = app->modules();
1110 for( QList<CAM_Module*>::const_iterator it = mods.begin(); it != mods.end(); ++it )
1112 CAM_DataModel* dm = (*it)->dataModel();
1113 if( (*it) == this && !camStudy->containsDataModel( dm ) )
1116 camStudy->insertDataModel( (*it)->dataModel(), prev );
1118 camStudy->insertDataModel( (*it)->dataModel(), 0 );
1125 \fn void CAM_Module::contextMenuPopup( const QString& type, QMenu* menu, QString& title );
1126 \brief Create context popup menu.
1127 \param type popup menu context
1128 \param menu popup menu
1129 \param title popup menu title, which can be set by the module if required
1133 \fn void CAM_Module::updateCommandsStatus();
1134 \brief Update menu/toolbar actions.
1138 bool CAM_Module::abortAllOperations()