From: sln Date: Tue, 20 May 2008 08:59:06 +0000 (+0000) Subject: NPAL19051: X-Git-Tag: TG_ELNO_visualization_28May2008~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=40276dd2dc364314570ac89144baa4be85838e76;p=modules%2Fgui.git NPAL19051: CloseId, CloseAllId, GroupAllId, identifiers are added in enumeration for corresponding items of ?Windows? menu. onCloseWindow(), onCloseAllWindow(), onGroupAllWindow() slots are added too. --- diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index dabd105f7..e13bc421a 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -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( desktop() ); + if( !desk ) + return; + + QPtrList 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( desktop() ); + if( !desk ) + return; + + QtxWorkstack* wgStack = desk->workstack(); + if ( wgStack ) + wgStack->stack(); +} + /*! \return if the library of module exists \param moduleTitle - title of module diff --git a/src/LightApp/LightApp_Application.h b/src/LightApp/LightApp_Application.h index fb83e0608..77ca00855 100644 --- a/src/LightApp/LightApp_Application.h +++ b/src/LightApp/LightApp_Application.h @@ -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: