G4OpenInventorXtExtended.cc

Go to the documentation of this file.
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: G4OpenInventorXt.cc,v 1.5 2010-05-26 14:30:46 allison Exp $
00028 // GEANT4 tag $Name: not supported by cvs2svn $
00029 //
00030 // 
00031 // Jeff Kallenbach 01 Aug 1996
00032 // OpenInventor graphics system factory.
00033 // Frederick Jones and TJR  October 2012
00034 // Extended driver based on G4OpenInventorXt.hh
00035 // Uses G4OpenInventorXtExaminerViewer.
00036 
00037 #ifdef G4VIS_BUILD_OIX_DRIVER
00038 
00039 // this :
00040 #include "G4OpenInventorXtExtended.hh"
00041 
00042 #include <Inventor/Xt/SoXt.h>
00043 
00044 #include "G4Xt.hh"
00045 #include "G4OpenInventorSceneHandler.hh"
00046 #include "G4OpenInventorXtExtendedViewer.hh"
00047 
00048 G4OpenInventorXtExtended::G4OpenInventorXtExtended ()
00049 :G4OpenInventor("OpenInventorXtExtended","OIXE",G4VGraphicsSystem::threeD)
00050 ,fInited(false)
00051 {
00052 }
00053 
00054 void G4OpenInventorXtExtended::Initialize()
00055 {
00056   if(fInited) return; //Done
00057 
00058   SetInteractorManager (G4Xt::getInstance ());
00059   GetInteractorManager () -> 
00060     RemoveDispatcher((G4DispatchFunction)XtDispatchEvent);  
00061   GetInteractorManager () -> 
00062     AddDispatcher   ((G4DispatchFunction)SoXt::dispatchEvent);
00063 
00064   Widget top = (Widget)GetInteractorManager()->GetMainInteractor();
00065 
00066   if(getenv("XENVIRONMENT")==NULL) {
00067     XrmDatabase database = XrmGetDatabase(XtDisplay(top));
00068     if(database!=NULL) {
00069       XrmPutLineResource(&database,"*topShadowColor:white");
00070       XrmPutLineResource(&database,"*bottomShadowColor:black");
00071       XrmPutLineResource(&database,"*foreground:black");
00072       XrmPutLineResource(&database,"*background:lightgrey");
00073       XrmPutLineResource(&database,"*borderColor:lightgrey");
00074       XrmPutLineResource(&database,"*fontList:-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1");
00075       XrmPutLineResource(&database,"*help_popup.title:Help");
00076       XrmPutLineResource(&database,"*helpCancel.labelString:Cancel");
00077       XrmPutLineResource(&database,"*helpText.editMode:multi_line_edit");
00078       XrmPutLineResource(&database,"*helpText.columns:60");
00079       XrmPutLineResource(&database,"*helpText.rows:20");
00080       XrmPutLineResource(&database,"*helpText.background:white");
00081       XrmPutLineResource(&database,"*helpText.fontList:*courier*-r-*--14-*");
00082       XrmPutLineResource(&database,"*helpText.maxLength:8000");
00083     }
00084   }
00085 
00086   if(!SoXt::getTopLevelWidget()) SoXt::init(top);
00087 
00088   InitNodes();
00089 
00090   fInited = true;
00091 }
00092 
00093 G4OpenInventorXtExtended::~G4OpenInventorXtExtended () {}
00094 G4VViewer* G4OpenInventorXtExtended::CreateViewer (G4VSceneHandler& scene, const G4String& name) 
00095 {
00096   Initialize();
00097   G4OpenInventorSceneHandler* pScene = (G4OpenInventorSceneHandler*)&scene;
00098   return new G4OpenInventorXtExtendedViewer (*pScene, name);
00099 }
00100 
00101 
00102 #endif

Generated on Mon May 27 17:49:12 2013 for Geant4 by  doxygen 1.4.7