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 | // |
---|
27 | // $Id: G4UIExecutive.icc,v 1.7 2010/05/28 08:12:27 kmura Exp $ |
---|
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_QT) |
---|
38 | #include "G4UIQt.hh" |
---|
39 | #include "G4Qt.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_TCSH) |
---|
48 | #include "G4UIterminal.hh" |
---|
49 | #include "G4UItcsh.hh" |
---|
50 | |
---|
51 | #else |
---|
52 | #include "G4UIterminal.hh" |
---|
53 | #include "G4UIcsh.hh" |
---|
54 | |
---|
55 | #endif |
---|
56 | |
---|
57 | #define DISCARD_PARAMETER(p) (void)p |
---|
58 | |
---|
59 | ///////////////////////////////////////////////////// |
---|
60 | G4UIExecutive::G4UIExecutive(G4int argc, char** argv) |
---|
61 | : session(0), shell(0),isGUI(false) |
---|
62 | ///////////////////////////////////////////////////// |
---|
63 | { |
---|
64 | #if defined(G4UI_USE_QT) |
---|
65 | session = new G4UIQt(argc, argv); |
---|
66 | isGUI = true; |
---|
67 | |
---|
68 | #elif defined(G4UI_USE_XM) |
---|
69 | session = new G4UIXm(argc, argv); |
---|
70 | isGUI = true; |
---|
71 | |
---|
72 | #elif defined(G4UI_USE_WIN32) |
---|
73 | DISCARD_PARAMETER(argc); |
---|
74 | DISCARD_PARAMETER(argv); |
---|
75 | |
---|
76 | session = new G4UIWin32(); |
---|
77 | |
---|
78 | #elif defined(G4UI_USE_TCSH) |
---|
79 | DISCARD_PARAMETER(argc); |
---|
80 | DISCARD_PARAMETER(argv); |
---|
81 | |
---|
82 | shell = new G4UItcsh; |
---|
83 | session = new G4UIterminal(shell); |
---|
84 | |
---|
85 | #else |
---|
86 | DISCARD_PARAMETER(argc); |
---|
87 | DISCARD_PARAMETER(argv); |
---|
88 | |
---|
89 | shell = new G4UIcsh; |
---|
90 | session = new G4UIterminal(shell); |
---|
91 | |
---|
92 | #endif |
---|
93 | } |
---|
94 | |
---|
95 | /////////////////////////////// |
---|
96 | G4UIExecutive::~G4UIExecutive() |
---|
97 | /////////////////////////////// |
---|
98 | { |
---|
99 | } |
---|
100 | |
---|
101 | ////////////////////////////////////////// |
---|
102 | inline G4bool G4UIExecutive::IsGUI() const |
---|
103 | ////////////////////////////////////////// |
---|
104 | { |
---|
105 | return isGUI; |
---|
106 | } |
---|
107 | |
---|
108 | ///////////////////////////////////////////////////// |
---|
109 | inline G4UIsession* G4UIExecutive::GetSession() const |
---|
110 | ///////////////////////////////////////////////////// |
---|
111 | { |
---|
112 | return session; |
---|
113 | } |
---|
114 | |
---|
115 | //////////////////////////////////////////////////////////// |
---|
116 | inline void G4UIExecutive::SetPrompt(const G4String& prompt) |
---|
117 | //////////////////////////////////////////////////////////// |
---|
118 | { |
---|
119 | if(shell) shell-> SetPrompt(prompt); |
---|
120 | } |
---|
121 | |
---|
122 | ////////////////////////////////////////////////////////////// |
---|
123 | inline void G4UIExecutive::SetLsColor(TermColorIndex dirColor, |
---|
124 | TermColorIndex cmdColor) |
---|
125 | ////////////////////////////////////////////////////////////// |
---|
126 | { |
---|
127 | if(shell) shell-> SetLsColor(dirColor, cmdColor); |
---|
128 | } |
---|
129 | |
---|
130 | ///////////////////////////////////////// |
---|
131 | inline void G4UIExecutive::SessionStart() |
---|
132 | ///////////////////////////////////////// |
---|
133 | { |
---|
134 | session-> SessionStart(); |
---|
135 | delete session; |
---|
136 | } |
---|
137 | |
---|