3 #include "TG4UICmdWithAComplexString.h"
5 #include <g4std/strstream>
7 TG4UICmdWithAComplexString::TG4UICmdWithAComplexString(
8 G4String commandPath, G4UImessenger* messenger)
9 : G4UIcommand(commandPath, messenger)
11 // The command string with full path directory
12 // and the pointer to the messenger must be given.
15 G4UIparameter* first = new G4UIparameter('s');
17 G4UIparameter* second = new G4UIparameter('s');
19 G4UIparameter* third = new G4UIparameter('s');
23 TG4UICmdWithAComplexString::~TG4UICmdWithAComplexString() {
29 void TG4UICmdWithAComplexString::SetParameterName(G4String name,
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.
41 G4UIparameter* first = GetParameter(0);
42 first->SetParameterName(name);
43 first->SetOmittable(omittable);
44 first->SetCurrentAsDefault(false);
46 G4UIparameter* second = GetParameter(1);
47 G4String secondName = name + "_cont1";
48 second->SetParameterName(secondName);
49 second->SetOmittable(true);
50 second->SetCurrentAsDefault(false);
52 G4UIparameter* third = GetParameter(2);
53 G4String thirdName = name + "_cont2";
54 third->SetParameterName(thirdName);
55 third->SetOmittable(true);
56 third->SetCurrentAsDefault(false);
59 void TG4UICmdWithAComplexString::SetDefaultValue(G4String defaultValue)
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.
66 G4UIparameter* first = GetParameter(0);
67 first->SetDefaultValue(defaultValue);
69 G4UIparameter* second = GetParameter(1);
70 second->SetDefaultValue(" ");
72 G4UIparameter* third = GetParameter(2);
73 third->SetDefaultValue(" ");
76 G4String TG4UICmdWithAComplexString::GetNewStringValue(G4String paramString)
78 // Returns the parameter string