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