Salome HOME
Merge from V6_main 11/02/2013
[modules/gui.git] / src / CAM / CAM_Module.cxx
index 9983c43d269fbfae149c887e83edac81b78b48c2..4901a9a42ee75e4f503c4677525658c6c7d28221 100755 (executable)
@@ -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.