Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# G4InteractorMessenger Class Reference

`#include <G4InteractorMessenger.hh>`

Collaboration diagram for G4InteractorMessenger:

[legend]
List of all members.

## Public Member Functions
| G4InteractorMessenger (G4VInteractiveSession *session)
virtual | ~G4InteractorMessenger ()
void | SetNewValue (G4UIcommand *command, G4String newValue)
## Private Attributes
G4VInteractiveSession * | session
G4UIdirectory * | interactorDirectory
G4UIcommand * | addMenu
G4UIcommand * | addButton
G4UIcommand * | sys

## Constructor & Destructor Documentation

G4InteractorMessenger::G4InteractorMessenger | ( | G4VInteractiveSession * | session | ) |

| Definition at line 42 of file G4InteractorMessenger.cc. References addButton, addMenu, interactorDirectory, session, and sys.
    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/system :
    00077   sys = new G4UIcommand("/gui/system",this);
    00078   sys->SetGuidance("Send a command to the system.");
    00079   parameter = new G4UIparameter("Command",'s',false);
    00080   parameter->SetDefaultValue("");
    00081   sys->SetParameter (parameter);
    00082
    00083 }

G4InteractorMessenger::~G4InteractorMessenger | ( |  | ) | `[virtual]`

| Definition at line 85 of file G4InteractorMessenger.cc. References addButton, addMenu, and interactorDirectory.
    00086 {
    00087   delete addButton;
    00088   delete addMenu;
    00089   delete interactorDirectory;
    00090 }

## Member Function Documentation

void G4InteractorMessenger::SetNewValue | ( | G4UIcommand * | command,
|  | G4String | newValue
| ) |

| Definition at line 92 of file G4InteractorMessenger.cc. References G4VInteractiveSession::AddButton(), addButton, G4VInteractiveSession::AddMenu(), addMenu, GetValues(), session, and sys.
    00096 {
    00097   int paramn = command->GetParameterEntries();
    00098   G4String* params = new G4String [paramn];
    00099   if(GetValues(newValue,paramn,params)==true) {
    00100     if(command==addMenu) {
    00101       session->AddMenu((const char*)params[0],(const char*)params[1]);
    00102     } else if(command==addButton) {
    00103       session->AddButton((const char*)params[0],(const char*)params[1],(const char*)params[2]);
    00104     } else if(command==sys) {
    00105       system((const char*)params[0]);
    00106     }
    00107   }
    00108   delete [] params;
    00109 }

Here is the call graph for this function:

## Member Data Documentation

G4UIcommand* G4InteractorMessenger::addButton`[private]`

| Definition at line 47 of file G4InteractorMessenger.hh. Referenced by G4InteractorMessenger(), SetNewValue(), and ~G4InteractorMessenger().

G4UIcommand* G4InteractorMessenger::addMenu`[private]`

| Definition at line 46 of file G4InteractorMessenger.hh. Referenced by G4InteractorMessenger(), SetNewValue(), and ~G4InteractorMessenger().

G4UIdirectory* G4InteractorMessenger::interactorDirectory`[private]`

| Definition at line 45 of file G4InteractorMessenger.hh. Referenced by G4InteractorMessenger(), and ~G4InteractorMessenger().

G4VInteractiveSession* G4InteractorMessenger::session`[private]`

| Definition at line 44 of file G4InteractorMessenger.hh. Referenced by G4InteractorMessenger(), and SetNewValue().

G4UIcommand* G4InteractorMessenger::sys`[private]`

| Definition at line 48 of file G4InteractorMessenger.hh. Referenced by G4InteractorMessenger(), and SetNewValue().

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

- G4InteractorMessenger.hh
- G4InteractorMessenger.cc