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$ 00028 // 00029 // G.Barrand 00030 00031 #ifndef G4VINTERACTORMANAGER_HH 00032 #define G4VINTERACTORMANAGER_HH 00033 00034 #include "globals.hh" 00035 #include <vector> 00036 00037 typedef void* G4Interactor; 00038 typedef G4bool (*G4DispatchFunction)(void*); 00039 typedef void (*G4SecondaryLoopAction)(); 00040 00041 // Class description : 00042 // 00043 // G4VInteractorManager : a base class to isolate common things 00044 // to various GUI "toolkits" like WIndows, Xt. 00045 // The word "interactor" is for "piece of user interface" or 00046 // "widget" (which means nothing). Then a GUI "toolkit" could be 00047 // defined as a manager of interactors. 00048 // 00049 // Class description - end : 00050 00051 class G4VInteractorManager { 00052 public: 00053 G4VInteractorManager (); 00054 virtual ~G4VInteractorManager (); 00055 void SetArguments (int,char**); 00056 char** GetArguments (int*); 00057 void SetMainInteractor (G4Interactor); 00058 G4Interactor GetMainInteractor (); 00059 void AddDispatcher (G4DispatchFunction); 00060 void RemoveDispatcher (G4DispatchFunction); 00061 void AddSecondaryLoopPreAction (G4SecondaryLoopAction); 00062 void AddSecondaryLoopPostAction (G4SecondaryLoopAction); 00063 void AddShell (G4Interactor); 00064 void RemoveShell (G4Interactor); 00065 void EnableSecondaryLoop (); 00066 void DisableSecondaryLoop (); 00067 void SecondaryLoopPreActions (); 00068 void SecondaryLoopPostActions (); 00069 void RequireExitSecondaryLoop (int); 00070 void DispatchEvent (void*); 00071 void SecondaryLoop (); 00072 int GetExitSecondaryLoopCode (); 00073 void PutStringInResourceDatabase (char*); 00074 virtual G4bool Inited () = 0; 00075 virtual void* GetEvent () = 0; 00076 virtual void FlushAndWaitExecution () = 0; 00077 void SetParentInteractor (G4Interactor); 00078 G4Interactor GetParentInteractor (); 00079 void SetCreatedInteractor (G4Interactor); 00080 G4Interactor GetCreatedInteractor (); 00081 void SetCreationString (char*); 00082 char* GetCreationString (); 00083 private: 00084 int argc; 00085 char** argv; 00086 G4Interactor mainInteractor; 00087 std::vector<G4DispatchFunction> dispatchers; 00088 std::vector<G4SecondaryLoopAction> preActions; 00089 std::vector<G4SecondaryLoopAction> postActions; 00090 std::vector<G4Interactor> shells; 00091 G4bool secondaryLoopEnabled; 00092 G4bool alreadyInSecondaryLoop; 00093 int exitSecondaryLoop; 00094 G4Interactor parentInteractor; 00095 G4Interactor createdInteractor; 00096 char* creationString; 00097 }; 00098 00099 #define OGL_EXIT_CODE 1 00100 #define OIV_EXIT_CODE 2 00101 #define XO_EXIT_CODE 3 00102 00103 #endif