#include <G4InteractorMessenger.hh>
Inheritance diagram for G4InteractorMessenger:
Public Member Functions | |
G4InteractorMessenger (G4VInteractiveSession *session) | |
virtual | ~G4InteractorMessenger () |
void | SetNewValue (G4UIcommand *command, G4String newValue) |
Definition at line 37 of file G4InteractorMessenger.hh.
G4InteractorMessenger::G4InteractorMessenger | ( | G4VInteractiveSession * | session | ) |
Definition at line 42 of file G4InteractorMessenger.cc.
References G4UIparameter::SetDefaultValue(), G4UIcommand::SetGuidance(), G4UIcommand::SetParameter(), and G4UIparameter::SetParameterCandidates().
00045 { 00046 session = a_session; 00047 00048 G4UIparameter* parameter; 00049 00050 interactorDirectory = new G4UIdirectory("/gui/"); 00051 interactorDirectory->SetGuidance("UI interactors commands."); 00052 00053 // /gui/addMenu : 00054 addMenu = new G4UIcommand("/gui/addMenu",this); 00055 addMenu->SetGuidance("Add a menu to menu bar."); 00056 parameter = new G4UIparameter("Name",'s',false); 00057 parameter->SetDefaultValue("dummy"); 00058 addMenu->SetParameter (parameter); 00059 parameter = new G4UIparameter("Label",'s',false); 00060 parameter->SetDefaultValue("dummy"); 00061 addMenu->SetParameter (parameter); 00062 00063 // /gui/addButton : 00064 addButton = new G4UIcommand("/gui/addButton",this); 00065 addButton->SetGuidance("Add a button to menu."); 00066 parameter = new G4UIparameter("Menu",'s',false); 00067 parameter->SetDefaultValue("dummy"); 00068 addButton->SetParameter (parameter); 00069 parameter = new G4UIparameter("Label",'s',false); 00070 parameter->SetDefaultValue("dummy"); 00071 addButton->SetParameter (parameter); 00072 parameter = new G4UIparameter("Command",'s',false); 00073 parameter->SetDefaultValue(""); 00074 addButton->SetParameter (parameter); 00075 00076 // /gui/addIcon : 00077 addIcon = new G4UIcommand("/gui/addIcon",this); 00078 addIcon->SetGuidance 00079 ("Add a non-checkable icon to the Icon toolbar."); 00080 addIcon->SetGuidance 00081 ("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"); 00082 addIcon->SetGuidance 00083 ("A command given without parameters will display a window that will allow one to choose the parameters (if needed) for this command."); 00084 addIcon->SetGuidance 00085 ("E.g: /gui/addIcon \"Change background color\" user_icon /vis/viewer/set/background ../Images/background.xpm"); 00086 addIcon->SetGuidance 00087 ("Special cases for the Icon parameter:"); 00088 addIcon->SetGuidance 00089 (" - open: Open an open-file-selector that can run the Command with File as argument."); 00090 addIcon->SetGuidance 00091 (" - save: Open a save-file-selector that can run the Command with File as argument."); 00092 addIcon->SetGuidance 00093 (" - move/rotate/pick/zoom_in/zoom_out: Theses icons are radio-button icons that can change cursor action."); 00094 addIcon->SetGuidance 00095 (" - wireframe/solid/hidden_line_removal/hidden_line_and_surface_removal: These icons are radio-button icons that can change drawing style."); 00096 addIcon->SetGuidance 00097 (" - perspective/ortho: These icons are radio-button icons that can change projection style."); 00098 00099 parameter = new G4UIparameter("Label",'s',false); 00100 parameter->SetDefaultValue(""); 00101 addIcon->SetParameter (parameter); 00102 00103 parameter = new G4UIparameter("Icon",'s',false); 00104 parameter->SetDefaultValue(""); 00105 parameter->SetParameterCandidates 00106 ("open save move rotate pick zoom_in zoom_out wireframe solid hidden_line_removal hidden_line_and_surface_removal perspective ortho user_icon"); 00107 addIcon->SetParameter (parameter); 00108 00109 parameter = new G4UIparameter("Command",'s',true); 00110 parameter->SetDefaultValue("no_command"); 00111 addIcon->SetParameter (parameter); 00112 00113 parameter = new G4UIparameter("File",'s',true); 00114 parameter->SetDefaultValue("no_file"); 00115 addIcon->SetParameter (parameter); 00116 00117 // /gui/system : 00118 sys = new G4UIcommand("/gui/system",this); 00119 sys->SetGuidance("Send a command to the system."); 00120 parameter = new G4UIparameter("Command",'s',false); 00121 parameter->SetDefaultValue(""); 00122 sys->SetParameter (parameter); 00123 00124 }
G4InteractorMessenger::~G4InteractorMessenger | ( | ) | [virtual] |
Definition at line 126 of file G4InteractorMessenger.cc.
00127 { 00128 delete addButton; 00129 delete addIcon; 00130 delete addMenu; 00131 delete interactorDirectory; 00132 }
void G4InteractorMessenger::SetNewValue | ( | G4UIcommand * | command, | |
G4String | newValue | |||
) | [virtual] |
Reimplemented from G4UImessenger.
Definition at line 134 of file G4InteractorMessenger.cc.
References G4VInteractiveSession::AddButton(), G4VInteractiveSession::AddIcon(), G4VInteractiveSession::AddMenu(), and G4UIcommand::GetParameterEntries().
00138 { 00139 int paramn = command->GetParameterEntries(); 00140 G4String* params = new G4String [paramn]; 00141 if(GetValues(newValue,paramn,params)==true) { 00142 if(command==addMenu) { 00143 session->AddMenu((const char*)params[0],(const char*)params[1]); 00144 } else if(command==addButton) { 00145 session->AddButton((const char*)params[0],(const char*)params[1],(const char*)params[2]); 00146 } else if(command==addIcon) { 00147 session->AddIcon((const char*)params[0],(const char*)params[1],(const char*)params[2],(const char*)params[3]); 00148 } else if(command==sys) { 00149 system((const char*)params[0]); 00150 } 00151 } 00152 delete [] params; 00153 }