Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4InteractorMessenger Class Reference

#include <G4InteractorMessenger.hh>

+ Inheritance diagram for G4InteractorMessenger:

Public Member Functions

 G4InteractorMessenger (G4VInteractiveSession *session)
 
virtual ~G4InteractorMessenger ()
 
void SetNewValue (G4UIcommand *command, G4String newValue)
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()=default
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (const G4String &s)
 
G4long StoL (const G4String &s)
 
G4double StoD (const G4String &s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Detailed Description

Definition at line 37 of file G4InteractorMessenger.hh.

Constructor & Destructor Documentation

◆ G4InteractorMessenger()

G4InteractorMessenger::G4InteractorMessenger ( G4VInteractiveSession session)

Definition at line 42 of file G4InteractorMessenger.cc.

45{
46 session = a_session;
47
48 G4UIparameter* parameter;
49
50 // gui commands should *not* be broadcast to workers
51 G4bool propagateToWorkers;
52 interactorDirectory = new G4UIdirectory("/gui/",propagateToWorkers=false);
53 interactorDirectory->SetGuidance("UI interactors commands.");
54
55 // /gui/addMenu :
56 addMenu = new G4UIcommand("/gui/addMenu",this);
57 addMenu->SetGuidance("Add a menu to menu bar.");
58 parameter = new G4UIparameter("Name",'s',false);
59 parameter->SetDefaultValue("dummy");
60 addMenu->SetParameter (parameter);
61 parameter = new G4UIparameter("Label",'s',false);
62 parameter->SetDefaultValue("dummy");
63 addMenu->SetParameter (parameter);
64
65 // /gui/addButton :
66 addButton = new G4UIcommand("/gui/addButton",this);
67 addButton->SetGuidance("Add a button to menu.");
68 parameter = new G4UIparameter("Menu",'s',false);
69 parameter->SetDefaultValue("dummy");
70 addButton->SetParameter (parameter);
71 parameter = new G4UIparameter("Label",'s',false);
72 parameter->SetDefaultValue("dummy");
73 addButton->SetParameter (parameter);
74 parameter = new G4UIparameter("Command",'s',false);
75 parameter->SetDefaultValue("");
76 addButton->SetParameter (parameter);
77
78 // /gui/defaultIcons :
79 defaultIcons = new G4UIcommand("/gui/defaultIcons",this);
80 defaultIcons->SetGuidance("Set the Geant4 defaults icons in Qt driver.");
81 defaultIcons->SetGuidance("By default, Geant4 icons are enable.");
82
83 parameter = new G4UIparameter("bool",'b',true);
84 parameter->SetDefaultValue("true");
85 defaultIcons->SetParameter (parameter);
86
87 // /gui/addIcon :
88 addIcon = new G4UIcommand("/gui/addIcon",this);
89 addIcon->SetGuidance
90 ("Add a non-checkable icon to the Icon toolbar.");
91 addIcon->SetGuidance
92 ("If the Icon parameter is set to \"user_icon\", you should provide the icon file in xpm format, otherwise you have to choose one of the candidate icons");
93 addIcon->SetGuidance
94 ("A command given without parameters will display a window that will allow one to choose the parameters (if needed) for this command.");
95 addIcon->SetGuidance
96 ("E.g: /gui/addIcon \"Change background color\" user_icon /vis/viewer/set/background ../Images/background.xpm");
97 addIcon->SetGuidance
98 ("Special cases for the Icon parameter:");
99 addIcon->SetGuidance
100 (" - open: Open an open-file-selector that can run the Command with File as argument.");
101 addIcon->SetGuidance
102 (" - save: Open a save-file-selector that can run the Command with File as argument.");
103 addIcon->SetGuidance
104 (" - move/rotate/pick/zoom_in/zoom_out: Theses icons are radio-button icons that can change cursor action.");
105 addIcon->SetGuidance
106 (" - wireframe/solid/hidden_line_removal/hidden_line_and_surface_removal: These icons are radio-button icons that can change drawing style.");
107 addIcon->SetGuidance
108 (" - perspective/ortho: These icons are radio-button icons that can change projection style.");
109
110 parameter = new G4UIparameter("Label",'s',false);
111 parameter->SetDefaultValue("");
112 addIcon->SetParameter (parameter);
113
114 parameter = new G4UIparameter("Icon",'s',false);
115 parameter->SetDefaultValue("");
116 parameter->SetParameterCandidates
117 ("open save move rotate pick zoom_in zoom_out wireframe solid hidden_line_removal hidden_line_and_surface_removal perspective ortho exit user_icon");
118 addIcon->SetParameter (parameter);
119
120 parameter = new G4UIparameter("Command",'s',true);
121 parameter->SetDefaultValue("no_command");
122 addIcon->SetParameter (parameter);
123
124 parameter = new G4UIparameter("File",'s',true);
125 parameter->SetDefaultValue("no_file");
126 addIcon->SetParameter (parameter);
127
128 // /gui/system :
129 sys = new G4UIcommand("/gui/system",this);
130 sys->SetGuidance("Send a command to the system.");
131 parameter = new G4UIparameter("Command",'s',false);
132 parameter->SetDefaultValue("");
133 sys->SetParameter (parameter);
134
135 // /gui/outputStyle :
136 outputStyle = new G4UIcommand("/gui/outputStyle",this);
137 outputStyle->SetGuidance("Set output style.");
138 outputStyle->SetGuidance("Highlights commands if requested and if /control/verbose > 0.");
139 parameter = new G4UIparameter("destination",'s',true); // Omitable
140 parameter->SetParameterCandidates("cout cerr warnings errors all");
141 parameter->SetDefaultValue("all");
142 outputStyle->SetParameter (parameter);
143 parameter = new G4UIparameter("type",'s',true); // Omitable
144 parameter->SetParameterCandidates("fixed proportional");
145 parameter->SetDefaultValue("fixed");
146 outputStyle->SetParameter (parameter);
147 parameter = new G4UIparameter("highlight",'s',true); // Omitable
148 parameter->SetParameterCandidates("highlight no-highlight");
149 parameter->SetDefaultValue("highlight");
150 outputStyle->SetParameter (parameter);
151
152 // /gui/nativeMenuBar :
153 nativeMenu = new G4UIcommand("/gui/nativeMenuBar",this);
154 nativeMenu->SetGuidance("Allow native menu bar in Geant4 Qt driver.");
155 nativeMenu->SetGuidance("By default, enable.");
156
157 parameter = new G4UIparameter("bool",'b',true);
158 parameter->SetDefaultValue("true");
159 nativeMenu->SetParameter (parameter);
160 // /gui/clearMenu
161 clearMenu = new G4UIcommand("/gui/clearMenu",this);
162 clearMenu->SetGuidance("Clear menu bar, remove all user defined menu entries.");
163}
bool G4bool
Definition: G4Types.hh:86
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:147
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:157
void SetDefaultValue(const char *theDefaultValue)
void SetParameterCandidates(const char *theString)

◆ ~G4InteractorMessenger()

G4InteractorMessenger::~G4InteractorMessenger ( )
virtual

Definition at line 165 of file G4InteractorMessenger.cc.

166{
167 delete clearMenu;
168 delete nativeMenu;
169 delete outputStyle;
170 delete sys;
171 delete defaultIcons;
172 delete addIcon;
173 delete addButton;
174 delete addMenu;
175 delete interactorDirectory;
176}

Member Function Documentation

◆ SetNewValue()

void G4InteractorMessenger::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 178 of file G4InteractorMessenger.cc.

182{
183 G4int paramn = (G4int)command->GetParameterEntries();
184 G4String* params = new G4String [paramn];
185 if(GetValues(newValue,paramn,params)==true) {
186 if(command==addMenu) {
187 session->AddMenu((const char*)params[0],(const char*)params[1]);
188 } else if(command==addButton) {
189 session->AddButton((const char*)params[0],(const char*)params[1],(const char*)params[2]);
190 } else if(command==addIcon) {
191 session->AddIcon((const char*)params[0],(const char*)params[1],(const char*)params[2],(const char*)params[3]);
192 } else if(command==defaultIcons) {
193 session->DefaultIcons(command->ConvertToBool(newValue));
194 } else if(command==sys) {
195 G4int rc = system((const char*)params[0]);
196 if ( rc < 0 ){ }
197 } else if(command==outputStyle) {
198 session->OutputStyle((const char*)params[0],(const char*)params[1],(const char*)params[2]);
199 } else if(command==nativeMenu) {
200 session->NativeMenu(command->ConvertToBool(newValue));
201 } else if(command==clearMenu) {
202 session->ClearMenu();
203 }
204 }
205 delete [] params;
206}
int G4int
Definition: G4Types.hh:85
std::size_t GetParameterEntries() const
Definition: G4UIcommand.hh:139
static G4bool ConvertToBool(const char *st)
Definition: G4UIcommand.cc:549

The documentation for this class was generated from the following files: