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

G4Qt.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: G4Qt.cc,v 1.11 2007/05/29 11:10:28 $
00028 // GEANT4 tag $Name: geant4-08-01 $
00029 //
00030 // L. Garnier
00031 
00032 #if defined(G4INTY_BUILD_QT) || defined(G4INTY_USE_QT)
00033 
00034 #include <stdlib.h>
00035 #include <string.h>
00036 
00037 #include "G4ios.hh"
00038 
00039 #include "G4Qt.hh"
00040 
00041 #define NewString(str)  \
00042  ((str) != NULL ? (strcpy((char*)malloc((unsigned)strlen(str) + 1), str)) : NULL)
00043 
00044 //static void XWidgetIconify                 (Widget);
00045 //static void XWidgetUniconify               (Widget);
00046 //static void XDisplaySetWindowToNormalState (Display*,Window);
00047 
00048 G4Qt* G4Qt::instance    = NULL;
00049 
00050 static G4bool QtInited  = FALSE;
00051 //static int    argn      = 0;
00052 //static char** args      = NULL;
00053 // static QtAppContext appContext = NULL;
00054 //static QApplication app = NULL;
00055 
00056 /***************************************************************************/
00057 G4Qt* G4Qt::getInstance (
00058 ) 
00059 /***************************************************************************/
00061 {
00062   return G4Qt::getInstance (0,NULL,(char*)"Geant4");
00063 }
00064 /***************************************************************************/
00065 G4Qt* G4Qt::getInstance (
00066  int    a_argn
00067 ,char** a_args
00068 ,char*  a_class
00069 ) 
00070 /***************************************************************************/
00072 {
00073   if (instance==NULL) {
00074     instance = new G4Qt(a_argn,a_args,a_class);
00075   }
00076   return instance;
00077 }
00078 /***************************************************************************/
00079 G4Qt::G4Qt (
00080  int    a_argn
00081 ,char** a_args
00082 ,char*  a_class
00083 )
00084 /***************************************************************************/
00086 {
00087   if(QtInited==FALSE) {  //Qt should be Inited once !
00088 
00089     new QApplication (a_argn, a_args);
00090 
00091     if(qApp==NULL) {
00092       G4cout        << "G4Qt : Unable to init Qt." << G4endl;
00093     }
00094     QtInited  = TRUE;
00095     SetMainInteractor (qApp);
00096   }
00097   SetArguments      (a_argn,a_args);
00098   //  AddDispatcher     ((G4DispatchFunction)XtDispatchEvent);
00099 }
00100 /***************************************************************************/
00101 G4Qt::~G4Qt (
00102 ) 
00103 /***************************************************************************/
00105 {
00106   if(this==instance) {
00107     instance = NULL;
00108   }
00109 }
00110 /***************************************************************************/
00111 G4bool G4Qt::Inited (
00112 )
00113 /***************************************************************************/
00115 {
00116   return QtInited;
00117 }
00118 /***************************************************************************/
00122 void* G4Qt::GetEvent (
00123 ) 
00124 /***************************************************************************/
00126 {
00127 //FIXME
00128 //   G4cout        << "G4Qt : Rien compris a cette fonction G4Qt::GetEvent." << G4endl;
00129 //  static XEvent  event;
00130 //  if(appContext==NULL) return NULL;
00131 //  if(mainApp==NULL) return NULL;
00132 //  QtAppNextEvent (appContext, &event);
00133 //  return         &event;
00134   printf("*");
00135 }
00136 /***************************************************************************/
00137 void G4Qt::FlushAndWaitExecution (
00138 )
00139 /***************************************************************************/
00141 {
00142 //FIXME
00143    G4cout        << "G4Qt : Rien compris a cette fonction G4Qt::FlushAndWaitExecution." << G4endl;
00144 //  if(mainApp==NULL) return;
00145 //  XSync(QtDisplay(mainApp),False);
00146 }
00147 
00148 #endif
00149 
00150 
00151 

Generated on Fri Jun 22 11:07:01 2007 by doxygen 1.3.4