1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/
19 #ifndef SUIT_SESSION_H
20 #define SUIT_SESSION_H
24 #include "SUIT_Application.h"
25 #include "SUIT_ResourceMgr.h"
29 #include <qptrvector.h>
30 #include <qstringlist.h>
33 #define LIB_HANDLE HINSTANCE
35 #define LIB_HANDLE void*
38 class SUIT_ResourceMgr;
39 class SUIT_ExceptionHandler;
42 #pragma warning( disable:4251 )
45 The class Sesssion manages launching of Applications. Application must be returned \n
46 by static function "createApplication" in external library. The Library must be loaded with \n
47 loadLibrary method and after that application can be started.
49 class SUIT_EXPORT SUIT_Session: public QObject
54 typedef LIB_HANDLE AppLib;
56 enum { ASK = 0, SAVE, DONT_SAVE } CloseMode;
57 enum { FROM_GUI = 0, FROM_CORBA_SESSION } ExitStatus;
61 virtual ~SUIT_Session();
63 static SUIT_Session* session();
65 SUIT_Application* startApplication( const QString&, int = 0, char** = 0 );
67 QPtrList<SUIT_Application> applications() const;
68 SUIT_Application* activeApplication() const;
70 SUIT_ResourceMgr* resourceMgr() const;
72 void closeSession( int mode = ASK );
74 SUIT_ExceptionHandler* handler() const;
77 void applicationClosed( SUIT_Application* );
80 virtual SUIT_ResourceMgr* createResourceMgr( const QString& ) const;
83 void onApplicationClosed( SUIT_Application* );
84 void onApplicationActivated( SUIT_Application* );
87 typedef QPtrList<SUIT_Application> AppList;
88 typedef QMap<QString, AppLib> AppLibMap;
89 typedef QPtrListIterator<SUIT_Application> AppListIterator;
92 QString lastError() const;
93 AppLib loadLibrary( const QString&, QString& );
94 QString applicationName( const QString& ) const;
97 SUIT_ResourceMgr* myResMgr;
100 SUIT_Application* myActiveApp;
102 SUIT_ExceptionHandler* myHandler;
103 static SUIT_Session* mySession;