00001
00002
00003
00004
00005 #include "GaudiKernel/DeclareFactoryEntries.h"
00006 #include "GaudiKernel/Bootstrap.h"
00007 #include "GaudiKernel/System.h"
00008
00009
00010
00011 #ifdef G4UI_USE_WO
00012 #include "G4UIWo.hh"
00013 #endif // G4UI_USE_WO
00015 #ifdef G4UI_USE_XM
00016 #include "G4UIXm.hh"
00017 #endif // G4UI_USE_XM
00019 #ifdef G4UI_USE_XAW
00020 #include "G4UIXaw.hh"
00021 #endif // G4UI_USE_XAW
00023 #include "G4UIterminal.hh"
00024 #ifndef WIN32
00025 #include "G4UItcsh.hh"
00026 #include "G4UIcsh.hh"
00027 #include "G4UIGAG.hh"
00028 #endif // not WIN32
00029
00030
00031 #include "GiGaUIsession.h"
00032
00033
00034
00041
00042
00043
00044 DECLARE_TOOL_FACTORY( GiGaUIsession );
00045
00046
00054
00055 GiGaUIsession::GiGaUIsession
00056 ( const std::string& type ,
00057 const std::string& name ,
00058 const IInterface* parent )
00059 : GiGaBase ( type, name , parent )
00060 , m_sessions ( )
00061 , m_session ( 0 )
00062 {
00063
00064 #ifndef WIN32
00065 m_sessions.push_back( "tcsh" ) ;
00066 #endif
00067 m_sessions.push_back( "Xm" ) ;
00068 m_sessions.push_back( "Wo" ) ;
00069 #ifndef WIN32
00070 m_sessions.push_back( "GAG" ) ;
00071 #endif
00072 m_sessions.push_back( "Xaw" ) ;
00073 m_sessions.push_back( "terminal" ) ;
00075 declareInterface <IGiGaUIsession> (this);
00077 declareProperty( "Sessions" , m_sessions );
00078 };
00079
00080
00081
00083
00084 GiGaUIsession::~GiGaUIsession() {};
00085
00086
00087
00094
00095 StatusCode GiGaUIsession::initialize ()
00096 {
00097
00098 StatusCode sc = GiGaBase::initialize();
00099 if( sc.isFailure() ){ return Error("Error from base class GiGaBase" , sc ) ; }
00100
00101 for( Sessions::const_iterator session = m_sessions.begin() ;
00102 m_sessions.end() != session && 0 == m_session ; ++session )
00103 {
00104 if ( "Wo" == *session )
00105 {
00106 #ifdef G4UI_USE_WO
00107 m_session = new G4UIWo ( System::argc() , System::argv() ) ;
00108 #endif
00109 }
00110 else if ( "Xm" == *session )
00111 {
00112 #ifdef G4UI_USE_XM
00113 m_session = new G4UIXm ( System::argc() , System::argv() ) ;
00114 #endif
00115 }
00116 else if ( "Xaw" == *session )
00117 {
00118 #ifdef G4UI_USE_XAW
00119 m_session = new G4UIXaw ( System::argc() , System::argv() ) ;
00120 #endif
00121 }
00122 #ifndef WIN32
00123 else if ( "GAG" == *session )
00124 { m_session = new G4UIGAG () ; }
00125 else if ( "tcsh" == *session )
00126 { m_session = new G4UIterminal( new G4UItcsh () ) ; }
00127 else if ( "csh" == *session )
00128 { m_session = new G4UIterminal( new G4UIcsh () ) ; }
00129 #endif
00130 else if ( "terminal" == *session )
00131 { m_session = new G4UIterminal () ; }
00132 }
00133
00134 if( 0 == m_session ) { Warning("UI session is not created!"); }
00135
00136 return StatusCode::SUCCESS ;
00137 };
00138
00139
00144
00145 G4UIsession* GiGaUIsession::session () const
00146 {
00147 if( 0 == m_session ){ Warning("G4UISession* points to NULL!") ; }
00148 return m_session ;
00149 };
00150
00151
00152
00153
00154