Salome HOME
Merge remote branch 'origin/V7_dev'
[modules/gui.git] / src / SUIT / SUIT_Application.cxx
index 61276cbaa4b695769112ea0368bdebdb512071e3..95a42da89a584a20d00b7e136ecee0569e194cf0 100755 (executable)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  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
@@ -85,8 +85,8 @@ SUIT_Desktop* SUIT_Application::desktop()
 }
 
 /*!
-   \return FALSE if application can not be closed (because of non saved data for example).
-   This method called by SUIT_Session whin closing of application was requested.
+   \return \c false if application can not be closed (because of non saved data for example).
+   This method called by SUIT_Session when closing of application was requested.
 */
 bool SUIT_Application::isPossibleToClose( bool& )
 {
@@ -278,6 +278,7 @@ void SUIT_Application::setDesktop( SUIT_Desktop* desk )
   myDesktop = desk;
   if ( myDesktop ) {
     connect( myDesktop, SIGNAL( activated() ), this, SLOT( onDesktopActivated() ) );
+//    connect( myDesktop, SIGNAL( moved() ), this, SLOT( onDesktopMoved() ) );
     // Force desktop activation (NPAL16628)
     QApplication::postEvent(myDesktop, new QEvent(QEvent::WindowActivate));
   }
@@ -315,14 +316,15 @@ void SUIT_Application::setActiveStudy( SUIT_Study* study )
 /*!
   Creates new toolbar
   \return identificator of new toolbar in tool manager
-  \param name - name of new toolbar
+  \param title - title of new toolbar
+  \param name - name (identifier) of new toolbar
 */
-int SUIT_Application::createTool( const QString& name )
+int SUIT_Application::createTool( const QString& title, const QString& name )
 {
   if ( !desktop() || !desktop()->toolMgr() )
     return -1;
 
-  return desktop()->toolMgr()->createToolBar( name );
+  return desktop()->toolMgr()->createToolBar( title, name );
 }
 
 /*!
@@ -504,7 +506,7 @@ int SUIT_Application::createMenu( const int id, const QString& menu, const int g
 /*!
   Show/hide menu item corresponding to action
   \param a - action
-  \param on - if it is true, the item will be shown, otherwise it will be hidden
+  \param on - if it is \c true, the item will be shown, otherwise it will be hidden
 */
 void SUIT_Application::setMenuShown( QAction* a, const bool on )
 {
@@ -519,7 +521,7 @@ void SUIT_Application::setMenuShown( QAction* a, const bool on )
 /*!
   Show/hide menu item corresponding to action
   \param id - identificator of action in menu manager
-  \param on - if it is true, the item will be shown, otherwise it will be hidden
+  \param on - if it is \c true, the item will be shown, otherwise it will be hidden
 */
 void SUIT_Application::setMenuShown( const int id, const bool on )
 {
@@ -529,7 +531,7 @@ void SUIT_Application::setMenuShown( const int id, const bool on )
 /*!
   Show/hide tool button corresponding to action
   \param a - action
-  \param on - if it is true, the button will be shown, otherwise it will be hidden
+  \param on - if it is \c true, the button will be shown, otherwise it will be hidden
 */
 void SUIT_Application::setToolShown( QAction* a, const bool on )
 {
@@ -544,7 +546,7 @@ void SUIT_Application::setToolShown( QAction* a, const bool on )
 /*!
   Show/hide menu item corresponding to action
   \param id - identificator of action in tool manager
-  \param on - if it is true, the button will be shown, otherwise it will be hidden
+  \param on - if it is \c true, the button will be shown, otherwise it will be hidden
 */
 void SUIT_Application::setToolShown( const int id, const bool on )
 {
@@ -554,7 +556,7 @@ void SUIT_Application::setToolShown( const int id, const bool on )
 /*!
   Show/hide both menu item and tool button corresponding to action
   \param a - action
-  \param on - if it is true, the item will be shown, otherwise it will be hidden
+  \param on - if it is \c true, the item will be shown, otherwise it will be hidden
 */
 void SUIT_Application::setActionShown( QAction* a, const bool on )
 {
@@ -565,7 +567,7 @@ void SUIT_Application::setActionShown( QAction* a, const bool on )
 /*!
   Show/hide both menu item and tool button corresponding to action
   \param id - identificator in both menu manager and tool manager
-  \param on - if it is true, the item will be shown, otherwise it will be hidden
+  \param on - if it is \c true, the item will be shown, otherwise it will be hidden
 */
 void SUIT_Application::setActionShown( const int id, const bool on )
 {
@@ -620,7 +622,7 @@ QList<int> SUIT_Application::actionIds() const
   \param tip - tool tip
   \param key - shortcut
   \param parent - parent object
-  \param toggle - if it is TRUE the action will be a toggle action, otherwise it will be a command action
+  \param toggle - if it is \c true the action will be a toggle action, otherwise it will be a command action
   \param reciever - object that contains slot
   \param member - slot to be called when action is activated
 */
@@ -628,6 +630,28 @@ QAction* SUIT_Application::createAction( const int id, const QString& text, cons
                                          const QString& menu, const QString& tip, const int key,
                                          QObject* parent, const bool toggle, QObject* reciever, 
                                         const char* member, const QString& shortcutAction )
+{
+  return createAction( id, text, icon, menu, tip, QKeySequence(key), parent, toggle, reciever, member, shortcutAction );
+}
+
+/*!
+  Creates action and registers it both in menu manager and tool manager
+  \return new instance of action
+  \param id - proposed SUIT identificator
+  \param text - description
+  \param icon - icon for toolbar
+  \param menu - menu text
+  \param tip - tool tip
+  \param key - shortcut
+  \param parent - parent object
+  \param toggle - if it is TRUE the action will be a toggle action, otherwise it will be a command action
+  \param reciever - object that contains slot
+  \param member - slot to be called when action is activated
+*/
+QAction* SUIT_Application::createAction( const int id, const QString& text, const QIcon& icon,
+                                         const QString& menu, const QString& tip, const QKeySequence& key,
+                                         QObject* parent, const bool toggle, QObject* reciever, 
+                                        const char* member, const QString& shortcutAction )
 {
   QtxAction* a = new QtxAction( text, icon, menu, key, parent, toggle, shortcutAction );
   a->setStatusTip( tip );
@@ -688,6 +712,13 @@ void SUIT_Application::onDesktopActivated()
   emit activated( this );
 }
 
+/*!
+  SLOT: it is called when desktop is moved
+*/
+/*void SUIT_Application::onDesktopMoved()
+{
+  emit moving();
+}*/
 /*!
   SLOT: is used for Help browsing
 */