]>
Commit | Line | Data |
---|---|---|
07430f40 | 1 | // $Id$ |
2 | // Category: global | |
3 | // | |
4 | // Author: I. Hrivnacova | |
5 | // | |
6 | // Class TG4UICmdWithAComplexString | |
7 | // -------------------------------- | |
8 | // See the class description in the header file. | |
2817d3e2 | 9 | |
10 | #include "TG4UICmdWithAComplexString.h" | |
11 | ||
12 | #include <g4std/strstream> | |
13 | ||
14 | TG4UICmdWithAComplexString::TG4UICmdWithAComplexString( | |
15 | G4String commandPath, G4UImessenger* messenger) | |
16 | : G4UIcommand(commandPath, messenger) | |
17 | { | |
18 | // The command string with full path directory | |
19 | // and the pointer to the messenger must be given. | |
20 | // --- | |
21 | ||
22 | G4UIparameter* first = new G4UIparameter('s'); | |
23 | SetParameter(first); | |
24 | G4UIparameter* second = new G4UIparameter('s'); | |
25 | SetParameter(second); | |
26 | G4UIparameter* third = new G4UIparameter('s'); | |
27 | SetParameter(third); | |
28 | } | |
29 | ||
30 | TG4UICmdWithAComplexString::~TG4UICmdWithAComplexString() { | |
31 | // | |
32 | } | |
33 | ||
34 | // public methods | |
35 | ||
36 | void TG4UICmdWithAComplexString::SetParameterName(G4String name, | |
37 | G4bool omittable) | |
38 | { | |
39 | // Set the parameter names for the parameters. | |
40 | // The "omittable" is set only for the first parameter, | |
41 | // for the second and third it is always true. | |
42 | // The "currentAsDefault" flag is valid only if "omittable" is true. | |
43 | // If this flag is true, the current values are used as the default values | |
44 | // when user ommits the parameters. If this flag is false, the values | |
45 | // given by the next SetDefaultValue() method are used. | |
46 | // --- | |
47 | ||
48 | G4UIparameter* first = GetParameter(0); | |
49 | first->SetParameterName(name); | |
50 | first->SetOmittable(omittable); | |
51 | first->SetCurrentAsDefault(false); | |
52 | ||
53 | G4UIparameter* second = GetParameter(1); | |
54 | G4String secondName = name + "_cont1"; | |
55 | second->SetParameterName(secondName); | |
56 | second->SetOmittable(true); | |
57 | second->SetCurrentAsDefault(false); | |
58 | ||
59 | G4UIparameter* third = GetParameter(2); | |
60 | G4String thirdName = name + "_cont2"; | |
61 | third->SetParameterName(thirdName); | |
62 | third->SetOmittable(true); | |
63 | third->SetCurrentAsDefault(false); | |
64 | } | |
65 | ||
66 | void TG4UICmdWithAComplexString::SetDefaultValue(G4String defaultValue) | |
67 | { | |
68 | // Sets the default values of the parameters. | |
69 | // These default values are used when user of this command ommits | |
70 | // some of the parameter values, and "ommitable" is true and | |
71 | // "currentAsDefault" is false. | |
72 | ||
73 | G4UIparameter* first = GetParameter(0); | |
74 | first->SetDefaultValue(defaultValue); | |
75 | ||
76 | G4UIparameter* second = GetParameter(1); | |
77 | second->SetDefaultValue(" "); | |
78 | ||
79 | G4UIparameter* third = GetParameter(2); | |
80 | third->SetDefaultValue(" "); | |
81 | } | |
82 | ||
83 | G4String TG4UICmdWithAComplexString::GetNewStringValue(G4String paramString) | |
84 | { | |
85 | // Returns the parameter string | |
86 | // --- | |
87 | ||
88 | return paramString; | |
89 | } | |
90 |