/*!Constructor.*/
STD_Application::STD_Application()
: SUIT_Application(),
+myExitConfirm( true ),
myEditEnabled( true ),
myActiveViewMgr( 0 )
+
{
setDesktop( new STD_MDIDesktop() );
}
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
{
/*!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();
}
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.*/
virtual void contextMenuPopup( const QString&, QMenu*, QString& ) {}
+ bool exitConfirmation() const;
+ void setExitConfirmation( const bool );
+
signals:
/*!emit that view manager added*/
void viewManagerAdded( SUIT_ViewManager* );
SUIT_ViewManager* myActiveViewMgr;
private:
+ bool myExitConfirm;
bool myEditEnabled;
bool myClosePermanently;
};
return;
myTitle = theTitle;
- for ( uint i = 0; i < myViews.count(); i++ )
+ for ( int i = 0; i < (int)myViews.count(); i++ )
setViewName( myViews[i] );
}
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;
}
}
*/
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 );
}
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;
}
*/
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 );
}
*/
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();
}
}
/*!Context menu popup for \a popup.*/
-void SUIT_ViewManager::contextMenuPopup( QPopupMenu* popup )
+void SUIT_ViewManager::contextMenuPopup( QMenu* popup )
{
SUIT_ViewModel* vm = getViewModel();
if ( vm )
class SUIT_Desktop;
class SUIT_ViewModel;
-class QPopupMenu;
+class QMenu;
#ifdef WIN32
#pragma warning( disable:4251 )
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; }
typedef QMap<HotOperation, Qt::KeyboardModifier> StatesMap;
typedef QMap<HotOperation, Qt::MouseButton> 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;