source: trunk/geant4/interfaces/common/src/G4Qt.cc @ 593

Last change on this file since 593 was 593, checked in by garnier, 17 years ago

r627@mac-90108: laurentgarnier | 2007-11-09 07:57:42 +0100
modif dans les includes directives

  • Property svn:mime-type set to text/cpp
File size: 5.3 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26//
27// $Id: G4Qt.cc,v 1.3 2007/11/08 17:00:09 lgarnier Exp $
28// GEANT4 tag $Name:  $
29//
30// L. Garnier
31
32#if defined(G4INTY_BUILD_QT) || defined(G4INTY_USE_QT)
33
34#include <stdlib.h>
35#include <string.h>
36
37#include "G4ios.hh"
38
39#include "G4Qt.hh"
40
41#include <QtGui/QApplication.h>
42
43
44#define NewString(str)  \
45 ((str) != NULL ? (strcpy((char*)malloc((unsigned)strlen(str) + 1), str)) : NULL)
46
47//static void XWidgetIconify                 (Widget);
48//static void XWidgetUniconify               (Widget);
49//static void XDisplaySetWindowToNormalState (Display*,Window);
50
51G4Qt* G4Qt::instance    = NULL;
52
53static G4bool QtInited  = FALSE;
54//static int    argn      = 0;
55//static char** args      = NULL;
56// static QtAppContext appContext = NULL;
57//static QApplication app = NULL;
58
59/***************************************************************************/
60G4Qt* G4Qt::getInstance (
61)
62/***************************************************************************/
63/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
64{
65  return G4Qt::getInstance (0,NULL,(char*)"Geant4");
66}
67/***************************************************************************/
68G4Qt* G4Qt::getInstance (
69 int    a_argn
70,char** a_args
71,char*  a_class
72)
73/***************************************************************************/
74/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
75{
76  if (instance==NULL) {
77    instance = new G4Qt(a_argn,a_args,a_class);
78  }
79  return instance;
80}
81/***************************************************************************/
82G4Qt::G4Qt (
83 int    a_argn
84,char** a_args
85,char*  a_class
86)
87/***************************************************************************/
88/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
89{
90  printf("G4Qt::G4Qt try to inited Qt\n");
91  if(QtInited==FALSE) {  //Qt should be Inited once !
92    printf("G4Qt::G4Qt inited Qt\n");
93
94    new QApplication (a_argn, a_args);
95
96    if(qApp==NULL) {
97      G4cout        << "G4Qt : Unable to init Qt." << G4endl;
98    }
99    QtInited  = TRUE;
100    SetMainInteractor (qApp);
101  }
102  SetArguments      (a_argn,a_args);
103  //  AddDispatcher     ((G4DispatchFunction)XtDispatchEvent);
104}
105/***************************************************************************/
106G4Qt::~G4Qt (
107)
108/***************************************************************************/
109/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
110{
111  if(this==instance) {
112    instance = NULL;
113  }
114}
115/***************************************************************************/
116G4bool G4Qt::Inited (
117)
118/***************************************************************************/
119/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
120{
121  return QtInited;
122}
123/***************************************************************************/
124/**
125  Si j'ai bien compris, cette fonction ne sert à rien
126 */
127void* G4Qt::GetEvent (
128)
129/***************************************************************************/
130/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
131{
132//FIXME
133//   G4cout        << "G4Qt : Rien compris a cette fonction G4Qt::GetEvent." << G4endl;
134//  static XEvent  event;
135//  if(appContext==NULL) return NULL;
136//  if(mainApp==NULL) return NULL;
137//  QtAppNextEvent (appContext, &event);
138//  return         &event;
139  printf("*");
140  return 0;
141}
142/***************************************************************************/
143void G4Qt::FlushAndWaitExecution (
144)
145/***************************************************************************/
146/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
147{
148  printf("G4Qt::FlushAndWaitExecution ::  Flush ....\n");
149  if(!qApp) return;
150  qApp->processEvents();
151}
152
153#endif
154
155
156
Note: See TracBrowser for help on using the repository browser.