00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id: G4VInteractorManager.hh,v 1.9 2006/06/29 19:10:08 gunter Exp $ 00028 // GEANT4 tag $Name: geant4-08-01-patch-01 $ 00029 // 00030 // G.Barrand 00031 00032 #ifndef G4VINTERACTORMANAGER_HH 00033 #define G4VINTERACTORMANAGER_HH 00034 00035 #include "globals.hh" 00036 #include <vector> 00037 00038 typedef void* G4Interactor; 00039 typedef G4bool (*G4DispatchFunction)(void*); 00040 typedef void (*G4SecondaryLoopAction)(); 00041 00042 // Class description : 00043 // 00044 // G4VInteractorManager : a base class to isolate common things 00045 // to various GUI "toolkits" like WIndows, Xt. 00046 // The word "interactor" is for "piece of user interface" or 00047 // "widget" (which means nothing). Then a GUI "toolkit" could be 00048 // defined as a manager of interactors. 00049 // 00050 // Class description - end : 00051 00052 class G4VInteractorManager { 00053 public: 00054 G4VInteractorManager (); 00055 virtual ~G4VInteractorManager (); 00056 void SetArguments (int,char**); 00057 char** GetArguments (int*); 00058 void SetMainInteractor (G4Interactor); 00059 G4Interactor GetMainInteractor (); 00060 void AddDispatcher (G4DispatchFunction); 00061 void RemoveDispatcher (G4DispatchFunction); 00062 void AddSecondaryLoopPreAction (G4SecondaryLoopAction); 00063 void AddSecondaryLoopPostAction (G4SecondaryLoopAction); 00064 void AddShell (G4Interactor); 00065 void RemoveShell (G4Interactor); 00066 void EnableSecondaryLoop (); 00067 void DisableSecondaryLoop (); 00068 void SecondaryLoopPreActions (); 00069 void SecondaryLoopPostActions (); 00070 void RequireExitSecondaryLoop (int); 00071 void DispatchEvent (void*); 00072 void SecondaryLoop (); 00073 int GetExitSecondaryLoopCode (); 00074 void PutStringInResourceDatabase (char*); 00075 virtual G4bool Inited () = 0; 00076 virtual void* GetEvent () = 0; 00077 virtual void FlushAndWaitExecution () = 0; 00078 void SetParentInteractor (G4Interactor); 00079 G4Interactor GetParentInteractor (); 00080 void SetCreatedInteractor (G4Interactor); 00081 G4Interactor GetCreatedInteractor (); 00082 void SetCreationString (char*); 00083 char* GetCreationString (); 00084 private: 00085 int argc; 00086 char** argv; 00087 G4Interactor mainInteractor; 00088 std::vector<G4DispatchFunction> dispatchers; 00089 std::vector<G4SecondaryLoopAction> preActions; 00090 std::vector<G4SecondaryLoopAction> postActions; 00091 std::vector<G4Interactor> shells; 00092 G4bool secondaryLoopEnabled; 00093 G4bool alreadyInSecondaryLoop; 00094 int exitSecondaryLoop; 00095 G4Interactor parentInteractor; 00096 G4Interactor createdInteractor; 00097 char* creationString; 00098 }; 00099 00100 #define OGL_EXIT_CODE 1 00101 #define OIV_EXIT_CODE 2 00102 #define XO_EXIT_CODE 3 00103 00104 #endif