Geant4  10.02.p03
G4InteractorMessenger Class Reference

#include <G4InteractorMessenger.hh>

Inheritance diagram for G4InteractorMessenger:
Collaboration diagram for G4InteractorMessenger:

Public Member Functions

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

Private Attributes

G4VInteractiveSessionsession
 
G4UIdirectoryinteractorDirectory
 
G4UIcommandaddMenu
 
G4UIcommandaddButton
 
G4UIcommandaddIcon
 
G4UIcommandsys
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (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
 
G4String baseDirName
 
G4bool commandsShouldBeInMaster
 

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  interactorDirectory = new G4UIdirectory("/gui/");
51  interactorDirectory->SetGuidance("UI interactors commands.");
52 
53  // /gui/addMenu :
54  addMenu = new G4UIcommand("/gui/addMenu",this);
55  addMenu->SetGuidance("Add a menu to menu bar.");
56  parameter = new G4UIparameter("Name",'s',false);
57  parameter->SetDefaultValue("dummy");
58  addMenu->SetParameter (parameter);
59  parameter = new G4UIparameter("Label",'s',false);
60  parameter->SetDefaultValue("dummy");
61  addMenu->SetParameter (parameter);
62 
63  // /gui/addButton :
64  addButton = new G4UIcommand("/gui/addButton",this);
65  addButton->SetGuidance("Add a button to menu.");
66  parameter = new G4UIparameter("Menu",'s',false);
67  parameter->SetDefaultValue("dummy");
68  addButton->SetParameter (parameter);
69  parameter = new G4UIparameter("Label",'s',false);
70  parameter->SetDefaultValue("dummy");
71  addButton->SetParameter (parameter);
72  parameter = new G4UIparameter("Command",'s',false);
73  parameter->SetDefaultValue("");
74  addButton->SetParameter (parameter);
75 
76  // /gui/addIcon :
77  addIcon = new G4UIcommand("/gui/addIcon",this);
79  ("Add a non-checkable icon to the Icon toolbar.");
81  ("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");
83  ("A command given without parameters will display a window that will allow one to choose the parameters (if needed) for this command.");
85  ("E.g: /gui/addIcon \"Change background color\" user_icon /vis/viewer/set/background ../Images/background.xpm");
87  ("Special cases for the Icon parameter:");
89  (" - open: Open an open-file-selector that can run the Command with File as argument.");
91  (" - save: Open a save-file-selector that can run the Command with File as argument.");
93  (" - move/rotate/pick/zoom_in/zoom_out: Theses icons are radio-button icons that can change cursor action.");
95  (" - wireframe/solid/hidden_line_removal/hidden_line_and_surface_removal: These icons are radio-button icons that can change drawing style.");
97  (" - perspective/ortho: These icons are radio-button icons that can change projection style.");
98 
99  parameter = new G4UIparameter("Label",'s',false);
100  parameter->SetDefaultValue("");
101  addIcon->SetParameter (parameter);
102 
103  parameter = new G4UIparameter("Icon",'s',false);
104  parameter->SetDefaultValue("");
105  parameter->SetParameterCandidates
106  ("open save move rotate pick zoom_in zoom_out wireframe solid hidden_line_removal hidden_line_and_surface_removal perspective ortho user_icon");
107  addIcon->SetParameter (parameter);
108 
109  parameter = new G4UIparameter("Command",'s',true);
110  parameter->SetDefaultValue("no_command");
111  addIcon->SetParameter (parameter);
112 
113  parameter = new G4UIparameter("File",'s',true);
114  parameter->SetDefaultValue("no_file");
115  addIcon->SetParameter (parameter);
116 
117  // /gui/system :
118  sys = new G4UIcommand("/gui/system",this);
119  sys->SetGuidance("Send a command to the system.");
120  parameter = new G4UIparameter("Command",'s',false);
121  parameter->SetDefaultValue("");
122  sys->SetParameter (parameter);
123 
124 }
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
void SetParameterCandidates(const char *theString)
void SetDefaultValue(const char *theDefaultValue)
G4UIdirectory * interactorDirectory
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
Here is the call graph for this function:

◆ ~G4InteractorMessenger()

G4InteractorMessenger::~G4InteractorMessenger ( )
virtual

Definition at line 126 of file G4InteractorMessenger.cc.

127 {
128  delete addButton;
129  delete addIcon;
130  delete addMenu;
131  delete interactorDirectory;
132 }
G4UIdirectory * interactorDirectory

Member Function Documentation

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 134 of file G4InteractorMessenger.cc.

138 {
139  int paramn = command->GetParameterEntries();
140  G4String* params = new G4String [paramn];
141  if(GetValues(newValue,paramn,params)==true) {
142  if(command==addMenu) {
143  session->AddMenu((const char*)params[0],(const char*)params[1]);
144  } else if(command==addButton) {
145  session->AddButton((const char*)params[0],(const char*)params[1],(const char*)params[2]);
146  } else if(command==addIcon) {
147  session->AddIcon((const char*)params[0],(const char*)params[1],(const char*)params[2],(const char*)params[3]);
148  } else if(command==sys) {
149  system((const char*)params[0]);
150  }
151  }
152  delete [] params;
153 }
virtual void AddMenu(const char *, const char *)
virtual void AddButton(const char *, const char *, const char *)
static G4bool GetValues(G4String, int, G4String *)
system("rm -rf microbeam.root")
G4int GetParameterEntries() const
Definition: G4UIcommand.hh:143
virtual void AddIcon(const char *, const char *, const char *, const char *)
G4VInteractiveSession * session
Here is the call graph for this function:

Member Data Documentation

◆ addButton

G4UIcommand* G4InteractorMessenger::addButton
private

Definition at line 47 of file G4InteractorMessenger.hh.

◆ addIcon

G4UIcommand* G4InteractorMessenger::addIcon
private

Definition at line 48 of file G4InteractorMessenger.hh.

◆ addMenu

G4UIcommand* G4InteractorMessenger::addMenu
private

Definition at line 46 of file G4InteractorMessenger.hh.

◆ interactorDirectory

G4UIdirectory* G4InteractorMessenger::interactorDirectory
private

Definition at line 45 of file G4InteractorMessenger.hh.

◆ session

G4VInteractiveSession* G4InteractorMessenger::session
private

Definition at line 44 of file G4InteractorMessenger.hh.

◆ sys

G4UIcommand* G4InteractorMessenger::sys
private

Definition at line 49 of file G4InteractorMessenger.hh.


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