]> SALOME platform Git repositories - modules/gui.git/blobdiff - src/SUIT/SUIT_ViewManager.cxx
Salome HOME
Copyrights update
[modules/gui.git] / src / SUIT / SUIT_ViewManager.cxx
index a20ddb7b410e796b2bb4c6d8696d0af4ba4bb102..69288994b2cf10a6bacfdf19be8ab3714f6acb7d 100755 (executable)
@@ -1,3 +1,21 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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.
+// 
+// This library is distributed in the hope that it will be useful 
+// but WITHOUT ANY WARRANTY; without even the implied warranty of 
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public  
+// License along with this library; if not, write to the Free Software 
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/
+//
 #include "SUIT_ViewManager.h"
 
 #include "SUIT_Desktop.h"
 #include <windows.h>
 #endif
 
-//***************************************************************
+/*!\class SUIT_ViewManager.
+ * Class provide manipulation with view windows.
+ */
+
+/*!Constructor.*/
 SUIT_ViewManager::SUIT_ViewManager( SUIT_Study* theStudy,
                                     SUIT_Desktop* theDesktop,
                                     SUIT_ViewModel* theViewModel )
@@ -31,16 +53,17 @@ myStudy( NULL )
     connect( myStudy, SIGNAL( destroyed() ), this, SLOT( onDeleteStudy() ) );
 }
 
-//***************************************************************
+/*!Destructor.*/
 SUIT_ViewManager::~SUIT_ViewManager()
 {
-  if (myViewModel) {
-    myViewModel->setViewManager(0);
+  if ( myViewModel )
+  {
+    myViewModel->setViewManager( 0 );
     delete myViewModel;
   }
 }
 
-//***************************************************************
+/*!Sets view model \a theViewModel to view manager.*/
 void SUIT_ViewManager::setViewModel(SUIT_ViewModel* theViewModel) 
 {
   if (myViewModel && myViewModel != theViewModel) {
@@ -52,14 +75,14 @@ void SUIT_ViewManager::setViewModel(SUIT_ViewModel* theViewModel)
     myViewModel->setViewManager(this);
 }
 
-//***************************************************************
+/*!Sets view name for view window \a theView.*/
 void SUIT_ViewManager::setViewName(SUIT_ViewWindow* theView)
 {
   int aPos = myViews.find(theView);
   theView->setCaption(myTitle + QString(":%1").arg(aPos+1));
 }
 
-//***************************************************************
+/*! Creates View, adds it into list of views and returns just created view window*/
 SUIT_ViewWindow* SUIT_ViewManager::createViewWindow()
 {
   SUIT_ViewWindow* aView = myViewModel->createView(myDesktop);
@@ -86,13 +109,15 @@ SUIT_ViewWindow* SUIT_ViewManager::createViewWindow()
   return aView;
 }
 
-//***************************************************************
+/*!Create view window.*/
 void SUIT_ViewManager::createView()
 {
   createViewWindow();
 }
 
-//***************************************************************
+/*!Insert view window to view manager.
+ *\retval false - if something wrong, else true.
+ */
 bool SUIT_ViewManager::insertView(SUIT_ViewWindow* theView)
 {
   unsigned int aSize = myViews.size();
@@ -141,15 +166,17 @@ bool SUIT_ViewManager::insertView(SUIT_ViewWindow* theView)
   return false;
 }
 
-
-//***************************************************************
+/*!Emit delete view. Remove view window \a theView from view manager.
+*/
 void SUIT_ViewManager::onDeleteView(SUIT_ViewWindow* theView)
 {
   emit deleteView(theView);
   removeView(theView);
 }
 
-//***************************************************************
+/*!Remove view window \a theView from view manager.
+ *And close the last view, if it has \a theView.
+*/
 void SUIT_ViewManager::removeView(SUIT_ViewWindow* theView) 
 {
   theView->disconnect(this);
@@ -161,16 +188,26 @@ void SUIT_ViewManager::removeView(SUIT_ViewWindow* theView)
     emit lastViewClosed(this);
 }
 
-//***************************************************************
+/*!
+  Show or hide all views (view windows)
+*/
+void SUIT_ViewManager::setShown( const bool on )
+{
+  for ( uint i = 0; i < myViews.count(); i++ )
+    myViews.at( i )->setShown( on );
+}
+
+/*!Emit on \a theEvent mouse pressed in \a theView.*/
 void SUIT_ViewManager::onMousePressed(SUIT_ViewWindow* theView, QMouseEvent* theEvent)
 {
   emit mousePress(theView, theEvent);
 }
 
-//***************************************************************
+/*!Emit activated for view \a view.
+*/
 void SUIT_ViewManager::onWindowActivated(SUIT_ViewWindow* view)
 {
-  if (view && myActiveView != view) {
+  if (view) {
     unsigned int aSize = myViews.size();
     for (uint i = 0; i < aSize; i++) {
       if (myViews[i] && myViews[i] == view) {
@@ -182,7 +219,8 @@ void SUIT_ViewManager::onWindowActivated(SUIT_ViewWindow* view)
   }
 }
 
-//***************************************************************
+/*!Close all views.
+*/
 void SUIT_ViewManager::closeAllViews()
 {
   unsigned int aSize = myViews.size();
@@ -192,33 +230,37 @@ void SUIT_ViewManager::closeAllViews()
   }
 }
 
-
-//***************************************************************
+/*!
+ *\retval QString - type of view model.
+ */
 QString  SUIT_ViewManager::getType() const 
 { 
   return (!myViewModel)? "": myViewModel->getType(); 
 }
 
-//***************************************************************
+/*!
+ *\retval SUIT_Study* - current study.
+ */
 SUIT_Study* SUIT_ViewManager::study() const
 {
     return myStudy;
 }
 
-//***************************************************************
+/*!
+ * Sets stydy to NULL.
+ */
 void SUIT_ViewManager::onDeleteStudy()
 {
     myStudy = NULL;
 }
 
-//***************************************************************
 void SUIT_ViewManager::onContextMenuRequested( QContextMenuEvent* e )
 {
-  // invoke method of SUIT_PopupClient, which notifies about popup
+  /*! invoke method of SUIT_PopupClient, which notifies about popup*/
   contextMenuRequest( e );
 }
 
-//***************************************************************
+/*!Context menu popup for \a popup.*/
 void SUIT_ViewManager::contextMenuPopup( QPopupMenu* popup )
 {
   SUIT_ViewModel* vm = getViewModel();