| [1058] | 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | //
|
|---|
| [1117] | 27 | // $Id: G4UIExecutive.icc,v 1.4 2009/05/28 06:13:03 kmura Exp $
|
|---|
| [1058] | 28 | // GEANT4 tag $Name: $
|
|---|
| 29 | //
|
|---|
| 30 | // ====================================================================
|
|---|
| 31 | // G4UIExecutive.icc
|
|---|
| 32 | //
|
|---|
| 33 | // ====================================================================
|
|---|
| 34 | #include "G4UIsession.hh"
|
|---|
| 35 | #include "G4UImanager.hh"
|
|---|
| 36 |
|
|---|
| 37 | #if defined(G4UI_USE_TCSH)
|
|---|
| 38 | #include "G4UIterminal.hh"
|
|---|
| 39 | #include "G4UItcsh.hh"
|
|---|
| 40 |
|
|---|
| 41 | #elif defined(G4UI_USE_XM)
|
|---|
| 42 | #include "G4UIXm.hh"
|
|---|
| 43 |
|
|---|
| 44 | #elif defined(G4UI_USE_WIN32)
|
|---|
| 45 | #include "G4UIWin32.hh"
|
|---|
| 46 |
|
|---|
| 47 | #elif defined(G4UI_USE_QT)
|
|---|
| 48 | #include "G4UIQt.hh"
|
|---|
| 49 | #include "G4Qt.hh"
|
|---|
| 50 |
|
|---|
| 51 | #else
|
|---|
| 52 | #include "G4UIterminal.hh"
|
|---|
| 53 | #include "G4UIcsh.hh"
|
|---|
| 54 |
|
|---|
| 55 | #endif
|
|---|
| 56 |
|
|---|
| 57 | /////////////////////////////////////////////////////
|
|---|
| [1117] | 58 | #if defined(G4UI_USE_XM) || defined(G4UI_USE_QT)
|
|---|
| [1058] | 59 | G4UIExecutive::G4UIExecutive(G4int argc, char** argv)
|
|---|
| 60 | #else
|
|---|
| 61 | G4UIExecutive::G4UIExecutive(G4int, char**)
|
|---|
| 62 | #endif
|
|---|
| [1117] | 63 | : session(0), shell(0),isGUI(false)
|
|---|
| [1058] | 64 | /////////////////////////////////////////////////////
|
|---|
| 65 | {
|
|---|
| 66 | #if defined(G4UI_USE_TCSH)
|
|---|
| 67 | shell = new G4UItcsh;
|
|---|
| 68 | session = new G4UIterminal(shell);
|
|---|
| 69 |
|
|---|
| 70 | #elif defined(G4UI_USE_XM)
|
|---|
| 71 | session = new G4UIXm(argc, argv);
|
|---|
| [1117] | 72 | isGUI = true;
|
|---|
| [1058] | 73 |
|
|---|
| 74 | #elif defined(G4UI_USE_WIN32)
|
|---|
| 75 | session = new G4UIWin32();
|
|---|
| 76 |
|
|---|
| 77 | #elif defined(G4UI_USE_QT)
|
|---|
| [1210] | 78 | // G4int argc2 = 0;
|
|---|
| 79 | // char** argv2 = 0;
|
|---|
| 80 | session = new G4UIQt(argc, argv);
|
|---|
| 81 | // session = new G4UIQt(argc2, argv2);
|
|---|
| [1117] | 82 | isGUI = true;
|
|---|
| [1058] | 83 |
|
|---|
| 84 | #else
|
|---|
| 85 | shell = new G4UIcsh;
|
|---|
| 86 | session = new G4UIterminal(shell);
|
|---|
| 87 |
|
|---|
| 88 | #endif
|
|---|
| 89 | }
|
|---|
| 90 |
|
|---|
| 91 | ///////////////////////////////
|
|---|
| 92 | G4UIExecutive::~G4UIExecutive()
|
|---|
| 93 | ///////////////////////////////
|
|---|
| 94 | {
|
|---|
| 95 | }
|
|---|
| 96 |
|
|---|
| [1117] | 97 | //////////////////////////////////////////
|
|---|
| 98 | inline G4bool G4UIExecutive::IsGUI() const
|
|---|
| 99 | //////////////////////////////////////////
|
|---|
| 100 | {
|
|---|
| 101 | return isGUI;
|
|---|
| 102 | }
|
|---|
| 103 |
|
|---|
| 104 | /////////////////////////////////////////////////////
|
|---|
| 105 | inline G4UIsession* G4UIExecutive::GetSession() const
|
|---|
| 106 | /////////////////////////////////////////////////////
|
|---|
| 107 | {
|
|---|
| 108 | return session;
|
|---|
| 109 | }
|
|---|
| 110 |
|
|---|
| [1058] | 111 | ////////////////////////////////////////////////////////////
|
|---|
| 112 | inline void G4UIExecutive::SetPrompt(const G4String& prompt)
|
|---|
| 113 | ////////////////////////////////////////////////////////////
|
|---|
| 114 | {
|
|---|
| 115 | if(shell) shell-> SetPrompt(prompt);
|
|---|
| 116 | }
|
|---|
| 117 |
|
|---|
| 118 | //////////////////////////////////////////////////////////////
|
|---|
| 119 | inline void G4UIExecutive::SetLsColor(TermColorIndex dirColor,
|
|---|
| 120 | TermColorIndex cmdColor)
|
|---|
| 121 | //////////////////////////////////////////////////////////////
|
|---|
| 122 | {
|
|---|
| 123 | if(shell) shell-> SetLsColor(dirColor, cmdColor);
|
|---|
| 124 | }
|
|---|
| 125 |
|
|---|
| 126 | /////////////////////////////////////////
|
|---|
| 127 | inline void G4UIExecutive::SessionStart()
|
|---|
| 128 | /////////////////////////////////////////
|
|---|
| 129 | {
|
|---|
| 130 | session-> SessionStart();
|
|---|
| 131 | delete session;
|
|---|
| 132 | }
|
|---|
| 133 |
|
|---|