+// 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 )
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) {
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);
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();
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);
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) {
}
}
-//***************************************************************
+/*!Close all views.
+*/
void SUIT_ViewManager::closeAllViews()
{
unsigned int aSize = myViews.size();
}
}
-
-//***************************************************************
+/*!
+ *\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();