]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
NPAL19051:
authorsln <sln@opencascade.com>
Tue, 20 May 2008 08:59:06 +0000 (08:59 +0000)
committersln <sln@opencascade.com>
Tue, 20 May 2008 08:59:06 +0000 (08:59 +0000)
CloseId, CloseAllId, GroupAllId, identifiers are added in enumeration for corresponding items of ?Windows? menu.
onCloseWindow(), onCloseAllWindow(), onGroupAllWindow() slots are added too.

src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_Application.h

index dabd105f7033ac90e0e15f3011121ffe62244d67..e13bc421a5a6e3df56227461416eb39714a3ed7f 100644 (file)
@@ -604,8 +604,20 @@ void LightApp_Application::createActions()
   // New window
   int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, MenuWindowId, 100 );
   int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 );
-  createMenu( separator(), windowMenu, -1, 1 );
 
+  createAction( CloseId, tr( "TOT_CLOSE" ), QIconSet(), tr( "MEN_DESK_CLOSE" ), tr( "PRP_CLOSE" ),
+                SHIFT+Key_C, desk, false, this, SLOT( onCloseWindow() ) );
+  createMenu( CloseId, windowMenu, 0, -1 );
+
+  createAction( CloseAllId, tr( "TOT_CLOSE_ALL" ), QIconSet(), tr( "MEN_DESK_CLOSE_ALL" ), tr( "PRP_CLOSE_ALL" ),
+                0, desk, false, this, SLOT( onCloseAllWindow() ) );
+  createMenu( CloseAllId, windowMenu, 0, -1 );
+
+  createAction( GroupAllId, tr( "TOT_GROUP_ALL" ), QIconSet(), tr( "MEN_DESK_GROUP_ALL" ), tr( "PRP_GROUP_ALL" ),
+                0, desk, false, this, SLOT( onGroupAllWindow() ) );
+  createMenu( GroupAllId, windowMenu, 0, -1 );
+
+  createMenu( separator(), windowMenu, -1, 0 );
 
 #ifndef DISABLE_GLVIEWER
   createActionForViewer( NewGLViewId, newWinMenu, QString::number( 0 ), ALT+Key_G );
@@ -2511,6 +2523,53 @@ void LightApp_Application::onRenameWindow()
     w->setCaption( name );
 }
 
+/*!
+  Closes active window of desktop
+*/
+void LightApp_Application::onCloseWindow()
+{
+  if( !desktop() )
+    return;
+
+  QWidget* w = desktop()->activeWindow();
+  if( !w )
+    return;
+
+  w->close();
+}
+
+/*!
+  Closes all windows of desktop
+*/
+void LightApp_Application::onCloseAllWindow()
+{
+  STD_TabDesktop* desk = dynamic_cast<STD_TabDesktop*>( desktop() );
+  if( !desk )
+    return;
+
+  QPtrList<SUIT_ViewWindow> wndList = desk->windows();
+  SUIT_ViewWindow* it;
+  for ( it = wndList.first(); it; it = wndList.next() )
+  {
+    if ( it )  
+      it->close();
+  }
+}
+
+/*!
+  Groups all windows of desktop
+*/
+void LightApp_Application::onGroupAllWindow()
+{
+  STD_TabDesktop* desk = dynamic_cast<STD_TabDesktop*>( desktop() );
+  if( !desk )
+    return;
+
+  QtxWorkstack* wgStack = desk->workstack();
+  if ( wgStack )
+    wgStack->stack();
+}
+
 /*!
   \return if the library of module exists
   \param moduleTitle - title of module
index fb83e0608bc59bc5c4fda3b86f5662e28a984be4..77ca0085506191ff874952efa3514228a919b8c4 100644 (file)
@@ -74,6 +74,7 @@ public:
   enum { MenuWindowId = 6 };
 
   enum { RenameId = CAM_Application::UserID,
+         CloseId, CloseAllId, GroupAllId,
 
 #ifndef DISABLE_GLVIEWER
          NewGLViewId ,
@@ -233,6 +234,9 @@ private slots:
   void                                onMRUActivated( QString );
   void                                onPreferenceChanged( QString&, QString&, QString& );
   void                                onRenameWindow();
+  void                                onCloseWindow();
+  void                                onCloseAllWindow();
+  void                                onGroupAllWindow();
   void                                onVisibilityChanged( bool );
 
 protected: