Commit 43b0c7f9 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit Committed by Kitware Robot

Merge topic '18856-fullscreen-improvements'

b688ddaf fullscreen mode hides decorations
807c918f remove obsolete code
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: Cory Quammen's avatarCory Quammen (Kitware) <cory.quammen@kitware.com>
Merge-request: !3165
parents d5622732 b688ddaf
Pipeline #133853 running with stage
......@@ -44,6 +44,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "pqSelectionManager.h"
#include "pqServerManagerModel.h"
#include "pqSetName.h"
#include "pqTabbedMultiViewWidget.h"
#include "pqUndoStack.h"
#include "vtkDataObject.h"
#include "vtkNew.h"
......@@ -330,6 +331,16 @@ void pqPipelineContextMenuBehavior::buildMenu(pqDataRepresentation* repr, unsign
// when nothing was picked we show the "link camera" menu.
this->Menu->addAction("Link Camera...", view, SLOT(linkToOtherView()));
if (auto tmvwidget = qobject_cast<pqTabbedMultiViewWidget*>(
pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET")))
{
auto actn = this->Menu->addAction("Show Frame Decorations");
actn->setCheckable(true);
actn->setChecked(tmvwidget->decorationsVisibility());
QObject::connect(
actn, &QAction::triggered, tmvwidget, &pqTabbedMultiViewWidget::setDecorationsVisibility);
}
}
//-----------------------------------------------------------------------------
......
......@@ -98,7 +98,15 @@ void pqViewMenuManager::buildMenu()
QAction* fullscreen = this->Menu->addAction("Full Screen");
fullscreen->setObjectName("actionFullScreen");
fullscreen->setShortcut(QKeySequence("F11"));
QObject::connect(fullscreen, SIGNAL(triggered()), viewManager, SLOT(toggleFullScreen()));
QObject::connect(
fullscreen, &QAction::triggered, viewManager, &pqTabbedMultiViewWidget::toggleFullScreen);
auto showDecorations = this->Menu->addAction("Show Frame Decorations");
showDecorations->setCheckable(true);
showDecorations->setChecked(viewManager->decorationsVisibility());
QObject::connect(showDecorations, &QAction::triggered, viewManager,
&pqTabbedMultiViewWidget::setDecorationsVisibility);
this->ShowFrameDecorationsAction = showDecorations;
}
QAction* lockDockWidgetsAction = this->Menu->addAction("Toggle Lock Panels");
......@@ -146,4 +154,11 @@ void pqViewMenuManager::updateMenu()
this->Menu->insertAction(
/*before*/ this->DockPanelSeparators[1], dock_widget->toggleViewAction());
}
pqTabbedMultiViewWidget* viewManager = qobject_cast<pqTabbedMultiViewWidget*>(
pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET"));
if (viewManager && this->ShowFrameDecorationsAction)
{
this->ShowFrameDecorationsAction->setChecked(viewManager->decorationsVisibility());
}
}
......@@ -74,6 +74,7 @@ protected:
QPointer<QMenu> Menu;
QPointer<QMenu> ToolbarsMenu;
QPointer<QAction> DockPanelSeparators[2];
QPointer<QAction> ShowFrameDecorationsAction;
private:
Q_DISABLE_COPY(pqViewMenuManager)
......
......@@ -170,8 +170,6 @@ set(classes
pqTriggerOnIdleHelper
pqUndoStackBuilder
pqVCRController
pqViewContextMenuHandler
pqViewContextMenuManager
pqViewFrame
pqViewFrameActionsInterface
pqViewManager
......
......@@ -198,7 +198,6 @@ public:
this->PreviewSize = size;
if (size.isEmpty())
{
this->setDecorationsVisibility(true);
this->Container->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
this->Container->layout()->setSpacing(PARAVIEW_DEFAULT_LAYOUT_SPACING);
......@@ -207,7 +206,6 @@ public:
}
else
{
this->setDecorationsVisibility(false);
this->Container->layout()->setSpacing(this->PreviewSpacing);
auto palette = this->Container->palette();
palette.setColor(QPalette::Window, this->PreviewColor);
......@@ -221,22 +219,30 @@ public:
vtkSMSaveScreenshotProxy::ComputeMagnification(tsize, csize);
this->Container->setMaximumSize(csize[0], csize[1]);
}
this->updateDecorations();
}
void setDecorationsVisibility(bool val)
{
this->DecorationsVisibility = val;
this->updateDecorations();
}
bool decorationsVisibility() const { return this->DecorationsVisibility; }
void updateDecorations()
{
// we show decorations if explicitly requested *and* we're not in preview mode.
const bool showDecorations = this->DecorationsVisibility && this->PreviewSize.isEmpty();
for (auto iter = this->ViewFrames.begin(); iter != this->ViewFrames.end(); ++iter)
{
if (iter.value() != nullptr)
{
iter.value()->setDecorationsVisibility(val);
iter.value()->setDecorationsVisibility(showDecorations);
}
}
}
bool decorationsVisibility() const { return this->DecorationsVisibility; }
void lockViewSize(const QSize& size)
{
this->LockedSize = size.isEmpty() ? QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX) : size;
......@@ -779,7 +785,17 @@ void pqMultiViewWidget::destroyAllViews()
}
//-----------------------------------------------------------------------------
#if !defined(VTK_LEGACY_REMOVE)
void pqMultiViewWidget::setDecorationsVisible(bool val)
{
VTK_LEGACY_REPLACED_BODY(pqMultiViewWidget::setDecorationsVisible, "ParaView 5.7",
pqMultiViewWidget::setDecorationsVisibility);
this->setDecorationsVisibility(val);
}
#endif
//-----------------------------------------------------------------------------
void pqMultiViewWidget::setDecorationsVisibility(bool val)
{
auto& internals = (*this->Internals);
internals.setDecorationsVisibility(val);
......@@ -787,9 +803,19 @@ void pqMultiViewWidget::setDecorationsVisible(bool val)
}
//-----------------------------------------------------------------------------
#if !defined(VTK_LEGACY_REMOVE)
bool pqMultiViewWidget::isDecorationsVisible() const
{
const auto& internals = (*this->Internals);
VTK_LEGACY_REPLACED_BODY(pqMultiViewWidget::isDecorationsVisible, "ParaView 5.7",
pqMultiViewWidget::decorationsVisibility);
return this->decorationsVisibility();
}
#endif
//-----------------------------------------------------------------------------
bool pqMultiViewWidget::decorationsVisibility() const
{
auto& internals = (*this->Internals);
return internals.decorationsVisibility();
}
......
......@@ -33,6 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define pqMultiViewWidget_h
#include "pqComponentsModule.h"
#include "vtkSetGet.h" // for VTK_LEGACY
#include <QWidget>
class pqProxy;
......@@ -55,10 +56,11 @@ class vtkSMViewProxy;
*/
class PQCOMPONENTS_EXPORT pqMultiViewWidget : public QWidget
{
Q_OBJECT
Q_OBJECT;
typedef QWidget Superclass;
Q_PROPERTY(bool decorationsVisibility READ isDecorationsVisible WRITE setDecorationsVisible NOTIFY
decorationsVisibilityChanged)
Q_PROPERTY(bool decorationsVisibility READ decorationsVisibility WRITE setDecorationsVisibility
NOTIFY decorationsVisibilityChanged);
public:
pqMultiViewWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
~pqMultiViewWidget() override;
......@@ -73,7 +75,7 @@ public:
/**
* Returns whether window decorations and splitter handles are visible.
*/
bool isDecorationsVisible() const;
bool decorationsVisibility() const;
/**
* Returns list of views assigned to frames in this widget.
......@@ -113,6 +115,16 @@ public:
*/
QSize preview(const QSize& previewSize = QSize());
/**
* @deprecated use `decorationsVisibility` instead.
*/
VTK_LEGACY(bool isDecorationsVisible() const);
/**
* @deprecated, use `setDecorationsVisibility` instead.
*/
VTK_LEGACY(void setDecorationsVisible(bool val));
signals:
/**
* fired when a frame in this widget becomes active.
......@@ -148,12 +160,14 @@ public slots:
*/
void makeFrameActive();
//@{
/**
* Set the visibility for frame decorations and splitter handles.
*/
void setDecorationsVisible(bool);
void showDecorations() { this->setDecorationsVisible(true); }
void hideDecorations() { this->setDecorationsVisible(false); }
* Set the visibility for frame decorations and splitter handles.
*/
void setDecorationsVisibility(bool);
void showDecorations() { this->setDecorationsVisibility(true); }
void hideDecorations() { this->setDecorationsVisibility(false); }
//@}
/**
* Locks the maximum size for each view-frame to the given size.
......
......@@ -202,6 +202,8 @@ QSize pqTabbedMultiViewWidget::pqTabWidget::preview(const QSize& nsize)
//-----------------------------------------------------------------------------
class pqTabbedMultiViewWidget::pqInternals
{
bool DecorationsVisibility = true;
public:
QPointer<pqTabWidget> TabWidget;
QMultiMap<pqServer*, QPointer<pqMultiViewWidget> > TabWidgets;
......@@ -240,6 +242,42 @@ public:
delete this->NewTabWidget;
}
}
void setDecorationsVisibility(bool val)
{
this->TabWidget->setTabBarVisibility(val);
this->DecorationsVisibility = val;
for (int cc = 0, max = this->TabWidget->count(); cc < max; ++cc)
{
if (auto mvwidget = qobject_cast<pqMultiViewWidget*>(this->TabWidget->widget(cc)))
{
mvwidget->setDecorationsVisibility(val);
}
}
}
bool decorationsVisibility() const { return this->DecorationsVisibility; }
/// adds a vtkSMViewLayoutProxy to a new tab.
void addTab(vtkSMViewLayoutProxy* vlayout, pqTabbedMultiViewWidget* self)
{
const int count = this->TabWidget->count();
auto widget = new pqMultiViewWidget();
widget->setObjectName(QString("MultiViewWidget%1").arg(count));
widget->setLayoutManager(vlayout);
widget->setDecorationsVisibility(this->decorationsVisibility());
// ensure that the tab current when the pqMultiViewWidget becomes
// active.
QObject::connect(widget, &pqMultiViewWidget::frameActivated,
[this, widget]() { this->TabWidget->setCurrentWidget(widget); });
int tab_index = this->TabWidget->addAsTab(widget, self);
this->TabWidget->setCurrentIndex(tab_index);
auto server =
pqApplicationCore::instance()->getServerManagerModel()->findServer(vlayout->GetSession());
this->TabWidgets.insert(server, widget);
}
};
//-----------------------------------------------------------------------------
......@@ -327,23 +365,24 @@ bool pqTabbedMultiViewWidget::tabVisibility() const
//-----------------------------------------------------------------------------
void pqTabbedMultiViewWidget::toggleFullScreen()
{
auto& internals = (*this->Internals);
if (this->Internals->FullScreenWindow)
{
this->Internals->FullScreenWindow->layout()->removeWidget(this->Internals->TabWidget);
this->layout()->addWidget(this->Internals->TabWidget);
delete this->Internals->FullScreenWindow;
internals.FullScreenWindow->layout()->removeWidget(this->Internals->TabWidget);
this->layout()->addWidget(internals.TabWidget);
delete internals.FullScreenWindow;
}
else
{
QWidget* fullScreenWindow = new QWidget(this, Qt::Window);
this->Internals->FullScreenWindow = fullScreenWindow;
internals.FullScreenWindow = fullScreenWindow;
fullScreenWindow->setObjectName("FullScreenWindow");
this->layout()->removeWidget(this->Internals->TabWidget);
this->layout()->removeWidget(internals.TabWidget);
QGridLayout* glayout = new QGridLayout(fullScreenWindow);
glayout->setSpacing(0);
glayout->setMargin(0);
glayout->addWidget(this->Internals->TabWidget, 0, 0);
glayout->addWidget(internals.TabWidget, 0, 0);
fullScreenWindow->showFullScreen();
fullScreenWindow->show();
......@@ -352,6 +391,9 @@ void pqTabbedMultiViewWidget::toggleFullScreen()
QShortcut* f11 = new QShortcut(Qt::Key_F11, fullScreenWindow);
QObject::connect(f11, SIGNAL(activated()), this, SLOT(toggleFullScreen()));
}
// when we enter full screen, let's hide decorations by default.
internals.setDecorationsVisibility(internals.FullScreenWindow == nullptr);
}
//-----------------------------------------------------------------------------
......@@ -553,18 +595,8 @@ void pqTabbedMultiViewWidget::createTab(pqServer* server)
//-----------------------------------------------------------------------------
void pqTabbedMultiViewWidget::createTab(vtkSMViewLayoutProxy* vlayout)
{
pqMultiViewWidget* widget = new pqMultiViewWidget(this);
QObject::connect(widget, SIGNAL(frameActivated()), this, SLOT(frameActivated()));
int count = this->Internals->TabWidget->count();
widget->setObjectName(QString("MultiViewWidget%1").arg(count));
widget->setLayoutManager(vlayout);
int tab_index = this->Internals->TabWidget->addAsTab(widget, this);
this->Internals->TabWidget->setCurrentIndex(tab_index);
pqServer* server =
pqApplicationCore::instance()->getServerManagerModel()->findServer(vlayout->GetSession());
this->Internals->TabWidgets.insert(server, widget);
auto& internals = (*this->Internals);
internals.addTab(vlayout, this);
}
//-----------------------------------------------------------------------------
......@@ -616,12 +648,22 @@ bool pqTabbedMultiViewWidget::eventFilter(QObject* obj, QEvent* evt)
//-----------------------------------------------------------------------------
void pqTabbedMultiViewWidget::toggleWidgetDecoration()
{
pqMultiViewWidget* widget =
qobject_cast<pqMultiViewWidget*>(this->Internals->TabWidget->currentWidget());
if (widget)
{
widget->setDecorationsVisible(!widget->isDecorationsVisible());
}
auto& internals = (*this->Internals);
this->setDecorationsVisibility(!internals.decorationsVisibility());
}
//-----------------------------------------------------------------------------
void pqTabbedMultiViewWidget::setDecorationsVisibility(bool val)
{
auto& internals = (*this->Internals);
internals.setDecorationsVisibility(val);
}
//-----------------------------------------------------------------------------
bool pqTabbedMultiViewWidget::decorationsVisibility() const
{
auto& internals = (*this->Internals);
return internals.decorationsVisibility();
}
//-----------------------------------------------------------------------------
......@@ -672,16 +714,6 @@ void pqTabbedMultiViewWidget::reset()
}
}
//-----------------------------------------------------------------------------
void pqTabbedMultiViewWidget::frameActivated()
{
pqMultiViewWidget* widget = qobject_cast<pqMultiViewWidget*>(this->sender());
if (widget)
{
this->Internals->TabWidget->setCurrentWidget(widget);
}
}
//-----------------------------------------------------------------------------
void pqTabbedMultiViewWidget::onStateLoaded()
{
......
......@@ -85,6 +85,11 @@ public:
*/
vtkSMViewLayoutProxy* layoutProxy() const;
/**
* Returns whether frame decorations are shown.
*/
bool decorationsVisibility() const;
signals:
/**
* fired when lockViewSize() is called.
......@@ -97,6 +102,16 @@ public slots:
virtual void createTab(vtkSMViewLayoutProxy*);
virtual void closeTab(int);
//@{
/**
* When set to false, all decorations including title frames, separators,
* tab-bars are hidden.
*/
void setDecorationsVisibility(bool);
void showDecorations() { this->setDecorationsVisibility(true); }
void hideDecorations() { this->setDecorationsVisibility(false); }
//@}
/**
* toggles fullscreen state.
*/
......@@ -152,12 +167,6 @@ protected slots:
*/
virtual void currentTabChanged(int);
/**
* called when a frame in pqMultiViewWidget is activated. Ensures that that
* widget is visible.
*/
virtual void frameActivated();
/**
* verifies that all views loaded from state are indeed assigned to some view
* layout, or we just assign them to one.
......
/*=========================================================================
Program: ParaView
Module: pqViewContextMenuHandler.cxx
Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.2.
See License_v1.2.txt for the full ParaView license.
A copy of this license can be obtained by contacting
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065
USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
/// \file pqViewContextMenuHandler.cxx
/// \date 9/19/2007
#include "pqViewContextMenuHandler.h"
pqViewContextMenuHandler::pqViewContextMenuHandler(QObject* parentObject)
: QObject(parentObject)
{
}
/*=========================================================================
Program: ParaView
Module: pqViewContextMenuHandler.h
Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.2.
See License_v1.2.txt for the full ParaView license.
A copy of this license can be obtained by contacting
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065
USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
/**
* \file pqViewContextMenuHandler.h
* \date 9/19/2007
*/
#ifndef _pqViewContextMenuHandler_h
#define _pqViewContextMenuHandler_h
#include "pqComponentsModule.h"
#include <QObject>
class pqView;
/**
* \class pqViewContextMenuHandler
* \brief
* The pqViewContextMenuHandler class is used to setup and cleanup
* the context menu for a view of a given type.
*/
class PQCOMPONENTS_EXPORT pqViewContextMenuHandler : public QObject
{
Q_OBJECT
public:
/**
* \brief
* Constructs a view context menu handler.
* \param parent The parent object.
*/
pqViewContextMenuHandler(QObject* parent = 0);
~pqViewContextMenuHandler() override {}
/**
* \brief
* Sets up the context menu for the given view.
*
* The pqViewContextMenuManager maps the view type to the correct
* handler and calls this method to set up the context menu.
*
* \param view The view to set up.
*/
virtual void setupContextMenu(pqView* view) = 0;
/**
* \brief
* Cleans up the context menu for the given view.
* \param view The view to clean up.
*/
virtual void cleanupContextMenu(pqView* view) = 0;
};
#endif
/*=========================================================================
Program: ParaView
Module: pqViewContextMenuManager.cxx
Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.2.
See License_v1.2.txt for the full ParaView license.
A copy of this license can be obtained by contacting
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065
USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
/// \file pqViewContextMenuManager.cxx
/// \date 9/19/2007
#include "pqViewContextMenuManager.h"
#include "pqView.h"
#include "pqViewContextMenuHandler.h"
#include <QMap>
#include <QString>
class pqViewContextMenuManagerInternal
{
public:
pqViewContextMenuManagerInternal();
~pqViewContextMenuManagerInternal() {}
QMap<QString, pqViewContextMenuHandler*> Handlers;
};
//----------------------------------------------------------------------------
pqViewContextMenuManagerInternal::pqViewContextMenuManagerInternal()
: Handlers()
{
}
//----------------------------------------------------------------------------
pqViewContextMenuManager::pqViewContextMenuManager(QObject* parentObject)
: QObject(parentObject)
{
this->Internal = new pqViewContextMenuManagerInternal();
}
pqViewContextMenuManager::~pqViewContextMenuManager()
{
delete this->Internal;
}
bool pqViewContextMenuManager::registerHandler(
const QString& viewType, pqViewContextMenuHandler* handler)
{
if (!handler)
{
return false;
}
// Make sure the view type doesn't already have a handler.
QMap<QString, pqViewContextMenuHandler*>::Iterator iter = this->Internal->Handlers.find(viewType);
if (iter != this->Internal->Handlers.end())
{
return false;
}
this->Internal->Handlers.insert(viewType, handler);
return true;
}
void pqViewContextMenuManager::unregisterHandler(pqViewContextMenuHandler* handler)
{
if (!handler)
{
return;
}
// Find all the view types with the given handler.
QMap<QString, pqViewContextMenuHandler*>::Iterator iter = this->Internal->Handlers.begin();
while (iter != this->Internal->Handlers.end())
{
if (*iter == handler)
{
iter = this->Internal->Handlers.erase(iter);
}
else
{
++iter;
}
}
}
bool pqViewContextMenuManager::isRegistered(pqViewContextMenuHandler* handler) const
{
QMap<QString, pqViewContextMenuHandler*>::ConstIterator iter = this->Internal->Handlers.begin();
for (; iter != this->Internal->Handlers.end(); ++iter)
{
if (*iter == handler)
{
return true;
}
}
return false;
}
pqViewContextMenuHandler* pqViewContextMenuManager::getHandler(const QString& viewType) const
{
QMap<QString, pqViewContextMenuHandler*>::ConstIterator iter =
this->Internal->Handlers.find(viewType);
if (iter != this->Internal->Handlers.end())
{
return *iter;
}
return 0;
}
void pqViewContextMenuManager::setupContextMenu(pqView* view)
{
QMap<QString, pqViewContextMenuHandler*>::Iterator iter =
this->Internal->Handlers.find(view->getViewType());
if (iter != this->Internal->Handlers.end())
{
(*iter)->setupContextMenu(view);
}
}
void pqViewContextMenuManager::cleanupContextMenu(pqView* view)
{
QMap<QString, pqViewContextMenuHandler*>::Iterator iter =
this->Internal->Handlers.find(view->getViewType());
if (iter != this->Internal->Handlers.end())
{
(*iter)->cleanupContextMenu(view);
}
}
/*=========================================================================
Program: ParaView
Module: pqViewContextMenuManager.h
Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.2.
See License_v1.2.txt for the full ParaView license.