Salome HOME
0022628: [CEA 1202] The default icon disposition is not correct in french and in...
[modules/gui.git] / src / CAM / CAM_Module.cxx
index 9983c43d269fbfae149c887e83edac81b78b48c2..2cba7bc1ed8f5f14137a37a04ceaee0a1bd26510 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.
@@ -393,17 +396,18 @@ QtxActionToolMgr* CAM_Module::toolMgr() const
 
   If the toolbar has been already created, its ID is just returned.
 
-  \param name toolbar name
+  \param title toolbar title
+  \param name toolbar name (identifier)
   \return toolbar ID or -1 if toolbar could not be created
 */
-int CAM_Module::createTool( const QString& name )
+int CAM_Module::createTool( const QString& title, const QString& name )
 {
   if ( !toolMgr() )
     return -1;
 
   ActionMgrLocker lock( toolMgr(), !myToolShown );
 
-  return toolMgr()->createToolBar( name, myToolShown );
+  return toolMgr()->createToolBar( title, name );
 }
 
 /*!
@@ -874,6 +878,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 +936,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 +1047,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