[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) |
---|
| 78 | session = new G4UIQt(argc, argv); |
---|
[1117] | 79 | isGUI = true; |
---|
[1058] | 80 | |
---|
| 81 | #else |
---|
| 82 | shell = new G4UIcsh; |
---|
| 83 | session = new G4UIterminal(shell); |
---|
| 84 | |
---|
| 85 | #endif |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | /////////////////////////////// |
---|
| 89 | G4UIExecutive::~G4UIExecutive() |
---|
| 90 | /////////////////////////////// |
---|
| 91 | { |
---|
| 92 | } |
---|
| 93 | |
---|
[1117] | 94 | ////////////////////////////////////////// |
---|
| 95 | inline G4bool G4UIExecutive::IsGUI() const |
---|
| 96 | ////////////////////////////////////////// |
---|
| 97 | { |
---|
| 98 | return isGUI; |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | ///////////////////////////////////////////////////// |
---|
| 102 | inline G4UIsession* G4UIExecutive::GetSession() const |
---|
| 103 | ///////////////////////////////////////////////////// |
---|
| 104 | { |
---|
| 105 | return session; |
---|
| 106 | } |
---|
| 107 | |
---|
[1058] | 108 | //////////////////////////////////////////////////////////// |
---|
| 109 | inline void G4UIExecutive::SetPrompt(const G4String& prompt) |
---|
| 110 | //////////////////////////////////////////////////////////// |
---|
| 111 | { |
---|
| 112 | if(shell) shell-> SetPrompt(prompt); |
---|
| 113 | } |
---|
| 114 | |
---|
| 115 | ////////////////////////////////////////////////////////////// |
---|
| 116 | inline void G4UIExecutive::SetLsColor(TermColorIndex dirColor, |
---|
| 117 | TermColorIndex cmdColor) |
---|
| 118 | ////////////////////////////////////////////////////////////// |
---|
| 119 | { |
---|
| 120 | if(shell) shell-> SetLsColor(dirColor, cmdColor); |
---|
| 121 | } |
---|
| 122 | |
---|
| 123 | ///////////////////////////////////////// |
---|
| 124 | inline void G4UIExecutive::SessionStart() |
---|
| 125 | ///////////////////////////////////////// |
---|
| 126 | { |
---|
| 127 | session-> SessionStart(); |
---|
| 128 | delete session; |
---|
| 129 | } |
---|
| 130 | |
---|