From 9fa29542cb628b3e0b09ed137b0c3a8755069150 Mon Sep 17 00:00:00 2001 From: stv Date: Wed, 1 Feb 2012 11:17:13 +0000 Subject: [PATCH] Optional flags added in view manager. --- src/SUIT/SUIT_ViewManager.cxx | 24 ++++++++++++++++++++---- src/SUIT/SUIT_ViewManager.h | 10 ++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/SUIT/SUIT_ViewManager.cxx b/src/SUIT/SUIT_ViewManager.cxx index dc4d518e2..c171f522c 100755 --- a/src/SUIT/SUIT_ViewManager.cxx +++ b/src/SUIT/SUIT_ViewManager.cxx @@ -44,7 +44,8 @@ SUIT_ViewManager::SUIT_ViewManager( SUIT_Study* theStudy, : QObject( 0 ), myDesktop( theDesktop ), myTitle( "Default: %M - viewer %V" ), -myStudy( NULL ) +myStudy( NULL ), +myFlags( None ) { myViewModel = 0; myActiveView = 0; @@ -140,7 +141,7 @@ QString SUIT_ViewManager::prepareTitle( const QString& title, const int mId, con /*! 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); + SUIT_ViewWindow* aView = myViewModel->createView( myDesktop ); if ( !insertView( aView ) ){ delete aView; @@ -151,21 +152,36 @@ SUIT_ViewWindow* SUIT_ViewManager::createViewWindow() aView->setWindowIcon( QIcon( myIcon ) ); aView->setViewManager( this ); - myDesktop->addWindow( aView ); + bool extView = myFlags & ExternalViews; + + if ( myDesktop && !extView ) + myDesktop->addWindow( aView ); //it is done automatically during creation of view emit viewCreated( aView ); + if ( myDesktop && !extView ) + aView->show(); + // Special treatment for the case when is the first one in this view manager // -> call onWindowActivated() directly, because somebody may always want // to use getActiveView() - aView->show(); if ( !myActiveView ) onWindowActivated( aView ); return aView; } +int SUIT_ViewManager::flags() const +{ + return myFlags; +} + +void SUIT_ViewManager::setFlags( int f ) +{ + myFlags = f; +} + /*! Get identifier */ int SUIT_ViewManager::getId() const { diff --git a/src/SUIT/SUIT_ViewManager.h b/src/SUIT/SUIT_ViewManager.h index 220c824f5..a9ab7a496 100755 --- a/src/SUIT/SUIT_ViewManager.h +++ b/src/SUIT/SUIT_ViewManager.h @@ -45,6 +45,11 @@ class SUIT_ViewWindow; class SUIT_EXPORT SUIT_ViewManager : public QObject, public SUIT_PopupClient { Q_OBJECT + +public: + enum { None = 0x000000, + ExternalViews = 0x000001 }; + public: SUIT_ViewManager( SUIT_Study*, SUIT_Desktop*, @@ -77,6 +82,9 @@ public: virtual void setShown( const bool ); virtual void setDestructiveClose( const bool ); + int flags() const; + void setFlags( int ); + int getId() const; public slots: @@ -137,6 +145,8 @@ protected: QString myTitle; SUIT_Study* myStudy; + int myFlags; + static QMap _ViewMgrId; }; -- 2.39.2