4 // Author: I. Hrivnacova
6 // Class TG4UICmdWithAComplexString
7 // --------------------------------
8 // See the class description in the header file.
10 #include "TG4UICmdWithAComplexString.h"
12 #include <g4std/strstream>
14 TG4UICmdWithAComplexString::TG4UICmdWithAComplexString(
15 G4String commandPath, G4UImessenger* messenger)
16 : G4UIcommand(commandPath, messenger)
18 // The command string with full path directory
19 // and the pointer to the messenger must be given.
22 G4UIparameter* first = new G4UIparameter('s');
24 G4UIparameter* second = new G4UIparameter('s');
26 G4UIparameter* third = new G4UIparameter('s');
30 TG4UICmdWithAComplexString::~TG4UICmdWithAComplexString() {
36 void TG4UICmdWithAComplexString::SetParameterName(G4String name,
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.
48 G4UIparameter* first = GetParameter(0);
49 first->SetParameterName(name);
50 first->SetOmittable(omittable);
51 first->SetCurrentAsDefault(false);
53 G4UIparameter* second = GetParameter(1);
54 G4String secondName = name + "_cont1";
55 second->SetParameterName(secondName);
56 second->SetOmittable(true);
57 second->SetCurrentAsDefault(false);
59 G4UIparameter* third = GetParameter(2);
60 G4String thirdName = name + "_cont2";
61 third->SetParameterName(thirdName);
62 third->SetOmittable(true);
63 third->SetCurrentAsDefault(false);
66 void TG4UICmdWithAComplexString::SetDefaultValue(G4String defaultValue)
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.
73 G4UIparameter* first = GetParameter(0);
74 first->SetDefaultValue(defaultValue);
76 G4UIparameter* second = GetParameter(1);
77 second->SetDefaultValue(" ");
79 G4UIparameter* third = GetParameter(2);
80 third->SetDefaultValue(" ");
83 G4String TG4UICmdWithAComplexString::GetNewStringValue(G4String paramString)
85 // Returns the parameter string