Salome HOME
Merge remote-tracking branch 'origin/vsr/fix_single_study_pb' into pre/fix_single_study
[modules/gui.git] / src / CAM / CAM_Module.cxx
index 9983c43d269fbfae149c887e83edac81b78b48c2..0f0d55708f40b0bd585532f6f594eac72d7d4012 100755 (executable)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -27,6 +27,7 @@
 #include "CAM_Study.h"
 
 #include <QtxAction.h>
+#include <QtxActionGroup.h>
 #include <QtxActionMenuMgr.h>
 #include <QtxActionToolMgr.h>
 
@@ -34,6 +35,8 @@
 #include <SUIT_Session.h>
 #include <SUIT_ResourceMgr.h>
 
+#include <QMenu>
+
 /*!
   \class CAM_Module
   \brief Base implementation of the module in the CAM application architecture.
@@ -874,6 +877,10 @@ QAction* CAM_Module::action( const int id ) const
   QAction* a = 0;
   if ( myActionMap.contains( id ) )
     a = myActionMap[id];
+  else if ( menuMgr() ) {
+    QMenu* m = menuMgr()->findMenu( id );
+    if ( m ) a = m->menuAction();
+  }
   return a;
 }
 
@@ -928,6 +935,23 @@ QAction* CAM_Module::createAction( const int id, const QString& text, const QIco
   return a;
 }
 
+/*!
+  \brief Create new action group.
+  \param id action group ID
+  \param exclusive \c true for exclusive action group
+  \return created action group
+*/
+QtxActionGroup* CAM_Module::createActionGroup( const int id, const bool exclusive )
+{
+  QtxActionGroup* a = qobject_cast<QtxActionGroup*>( action( id ) );
+  if ( !a ) {
+    a = new QtxActionGroup( this );
+    registerAction( id, a );
+  }
+  a->setExclusive( exclusive );
+  return a;
+}
+
 /*!
   \brief Register action in the internal action map.
 
@@ -1022,6 +1046,37 @@ void CAM_Module::updateModuleVisibilityState() {
 
 }
 
+/*!
+  \brief Activate GUI operation of module by its ID.
+  This method is called from CAM_Application::startOperation().
+  \param actionId is a numerical unique operation id.
+*/
+bool CAM_Module::activateOperation( int actionId )
+{
+  return false;
+}
+
+/*!
+  \brief Activate GUI operation of module by its ID.
+  This method is called from CAM_Application::startOperation().
+  \param actionId is a string unique operation id.
+*/
+bool CAM_Module::activateOperation( const QString& actionId )
+{
+  return false;
+}
+
+/*!
+  \brief Activate GUI operation of module by its ID and \a pluginName.
+  This method is called from CAM_Application::startOperation().
+  \param actionId is a string unique operation id.
+  \param pluginName is a name of a plugin where the operation is implemented.
+*/
+bool CAM_Module::activateOperation( const QString& actionId, const QString& pluginName )
+{
+  return false;
+}
+
 
 /*!
   \brief Connect data model of the module to the active study