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

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