From: stv Date: Thu, 22 Feb 2007 11:54:00 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: For_HDF~26 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4ad5898187043b0562b31dddb65f317fe12ea5c3;p=modules%2Fgui.git *** empty log message *** --- diff --git a/src/STD/STD_Application.cxx b/src/STD/STD_Application.cxx index 2ec191bc2..d216e258b 100755 --- a/src/STD/STD_Application.cxx +++ b/src/STD/STD_Application.cxx @@ -53,8 +53,10 @@ extern "C" STD_EXPORT SUIT_Application* createApplication() /*!Constructor.*/ STD_Application::STD_Application() : SUIT_Application(), +myExitConfirm( true ), myEditEnabled( true ), myActiveViewMgr( 0 ) + { setDesktop( new STD_MDIDesktop() ); } @@ -65,6 +67,18 @@ STD_Application::~STD_Application() clearViewManagers(); } +/*! \retval requirement of exit confirmation*/ +bool STD_Application::exitConfirmation() const +{ + return myExitConfirm; +} + +/*! Set the requirement of exit confirmation*/ +void STD_Application::setExitConfirmation( const bool on ) +{ + myExitConfirm = on; +} + /*! \retval QString "StdApplication"*/ QString STD_Application::applicationName() const { @@ -535,8 +549,10 @@ bool STD_Application::onSaveAsDoc() /*!Closing session.*/ void STD_Application::onExit() { - int aAnswer = SUIT_MessageBox::info2( desktop(), tr( "INF_DESK_EXIT" ), tr( "QUE_DESK_EXIT" ), - tr( "BUT_OK" ), tr( "BUT_CANCEL" ), 1, 2, 2 ); + int aAnswer = 1; + if ( exitConfirmation() ) + aAnswer = SUIT_MessageBox::info2( desktop(), tr( "INF_DESK_EXIT" ), tr( "QUE_DESK_EXIT" ), + tr( "BUT_OK" ), tr( "BUT_CANCEL" ), 1, 2, 2 ); if ( aAnswer == 1 ) SUIT_Session::session()->closeSession(); } @@ -745,9 +761,6 @@ void STD_Application::onHelpAbout() void STD_Application::createEmptyStudy() { SUIT_Application::createEmptyStudy(); - - SUIT_ViewManager* vm = new SUIT_ViewManager( activeStudy(), desktop(), new SUIT_ViewModel() ); - addViewManager( vm ); } /*!Sets active manager to \vm, if \vm in view managers list.*/ diff --git a/src/STD/STD_Application.h b/src/STD/STD_Application.h index d9fcce5d7..9830a0845 100755 --- a/src/STD/STD_Application.h +++ b/src/STD/STD_Application.h @@ -89,6 +89,9 @@ public: virtual void contextMenuPopup( const QString&, QMenu*, QString& ) {} + bool exitConfirmation() const; + void setExitConfirmation( const bool ); + signals: /*!emit that view manager added*/ void viewManagerAdded( SUIT_ViewManager* ); @@ -156,6 +159,7 @@ private: SUIT_ViewManager* myActiveViewMgr; private: + bool myExitConfirm; bool myEditEnabled; bool myClosePermanently; }; diff --git a/src/SUIT/SUIT_ViewManager.cxx b/src/SUIT/SUIT_ViewManager.cxx index 0693ea086..2302e245f 100755 --- a/src/SUIT/SUIT_ViewManager.cxx +++ b/src/SUIT/SUIT_ViewManager.cxx @@ -87,7 +87,7 @@ void SUIT_ViewManager::setTitle( const QString& theTitle ) return; myTitle = theTitle; - for ( uint i = 0; i < myViews.count(); i++ ) + for ( int i = 0; i < (int)myViews.count(); i++ ) setViewName( myViews[i] ); } @@ -216,9 +216,11 @@ bool SUIT_ViewManager::insertView(SUIT_ViewWindow* theView) connect(theView, SIGNAL(contextMenuRequested( QContextMenuEvent * )), this, SLOT (onContextMenuRequested( QContextMenuEvent * ))); - for (uint i = 0; i < aSize; i++) { - if (myViews[i]==0) { - myViews.insert(i, theView); + for ( uint i = 0; i < aSize; i++ ) + { + if ( myViews[i] == 0 ) + { + myViews[i] = theView; return true; } } @@ -272,7 +274,7 @@ void SUIT_ViewManager::removeView( SUIT_ViewWindow* theView ) */ void SUIT_ViewManager::setDestructiveClose( const bool on ) { - for ( uint i = 0; i < myViews.count(); i++ ) + for ( int i = 0; i < (int)myViews.count(); i++ ) myViews[i]->setDestructiveClose( on ); } @@ -282,7 +284,7 @@ void SUIT_ViewManager::setDestructiveClose( const bool on ) bool SUIT_ViewManager::isVisible() const { bool res = false; - for ( uint i = 0; i < myViews.count() && !res; i++ ) + for ( int i = 0; i < (int)myViews.count() && !res; i++ ) res = myViews[i]->isVisibleTo( myViews[i]->parentWidget() ); return res; } @@ -292,7 +294,7 @@ bool SUIT_ViewManager::isVisible() const */ void SUIT_ViewManager::setShown( const bool on ) { - for ( uint i = 0; i < myViews.count(); i++ ) + for ( int i = 0; i < (int)myViews.count(); i++ ) myViews.at( i )->setShown( on ); } @@ -322,7 +324,7 @@ void SUIT_ViewManager::onWindowActivated(SUIT_ViewWindow* view) */ void SUIT_ViewManager::closeAllViews() { - for ( uint i = 0; i < myViews.size(); i++ ) + for ( int i = 0; i < (int)myViews.size(); i++ ) delete myViews[i]; myViews.clear(); } @@ -358,7 +360,7 @@ void SUIT_ViewManager::onContextMenuRequested( QContextMenuEvent* e ) } /*!Context menu popup for \a popup.*/ -void SUIT_ViewManager::contextMenuPopup( QPopupMenu* popup ) +void SUIT_ViewManager::contextMenuPopup( QMenu* popup ) { SUIT_ViewModel* vm = getViewModel(); if ( vm ) diff --git a/src/SUIT/SUIT_ViewManager.h b/src/SUIT/SUIT_ViewManager.h index 4b3ea0f85..0baeb780e 100755 --- a/src/SUIT/SUIT_ViewManager.h +++ b/src/SUIT/SUIT_ViewManager.h @@ -31,7 +31,7 @@ class SUIT_Study; class SUIT_Desktop; class SUIT_ViewModel; -class QPopupMenu; +class QMenu; #ifdef WIN32 #pragma warning( disable:4251 ) @@ -47,7 +47,7 @@ public: virtual ~SUIT_ViewManager(); virtual QString popupClientType() const { return getType(); } - virtual void contextMenuPopup( QPopupMenu* ); + virtual void contextMenuPopup( QMenu* ); void setViewModel(SUIT_ViewModel* theViewModel); SUIT_ViewModel* getViewModel() { return myViewModel; } diff --git a/src/SUIT/SUIT_ViewModel.h b/src/SUIT/SUIT_ViewModel.h index 2cf1e6f47..16a38ac73 100755 --- a/src/SUIT/SUIT_ViewModel.h +++ b/src/SUIT/SUIT_ViewModel.h @@ -46,25 +46,25 @@ public: typedef QMap StatesMap; typedef QMap ButtonsMap; - SUIT_ViewModel(); - virtual ~SUIT_ViewModel(); + SUIT_ViewModel(); + virtual ~SUIT_ViewModel(); - virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop); + virtual SUIT_ViewWindow* createView( SUIT_Desktop* theDesktop ); - virtual void setViewManager(SUIT_ViewManager* theViewManager) { myViewManager = theViewManager; } - SUIT_ViewManager* getViewManager() const { return myViewManager; } + virtual void setViewManager(SUIT_ViewManager* theViewManager) { myViewManager = theViewManager; } + SUIT_ViewManager* getViewManager() const { return myViewManager; } virtual QString getType() const { return "SUIT_ViewModel"; } - virtual void contextMenuPopup(QPopupMenu*) {} + virtual void contextMenuPopup( QMenu* ) {} static void setHotButton( HotOperation theOper, Qt::KeyboardModifier theState, - Qt::MouseButton theButton ); + Qt::MouseButton theButton ); static void getHotButton( HotOperation theOper, Qt::KeyboardModifier& theState, - Qt::MouseButton& theButton ); + Qt::MouseButton& theButton ); protected: - SUIT_ViewManager* myViewManager; + SUIT_ViewManager* myViewManager; public: static StatesMap myStateMap;