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

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

r573@mac-90108: laurentgarnier | 2007-06-05 16:12:24 +0200
remise a jour

  • Property svn:mime-type set to text/cpp
File size: 5.2 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.11 2007/05/29 11:10:28 $
28// GEANT4 tag $Name: geant4-08-01 $
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#define NewString(str)  \
42 ((str) != NULL ? (strcpy((char*)malloc((unsigned)strlen(str) + 1), str)) : NULL)
43
44//static void XWidgetIconify                 (Widget);
45//static void XWidgetUniconify               (Widget);
46//static void XDisplaySetWindowToNormalState (Display*,Window);
47
48G4Qt* G4Qt::instance    = NULL;
49
50static G4bool QtInited  = FALSE;
51//static int    argn      = 0;
52//static char** args      = NULL;
53// static QtAppContext appContext = NULL;
54static QMainWindow *mainWidget = NULL;
55
56/***************************************************************************/
57G4Qt* G4Qt::getInstance (
58)
59/***************************************************************************/
60/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
61{
62  return G4Qt::getInstance (0,NULL,(char*)"Geant4");
63}
64/***************************************************************************/
65G4Qt* G4Qt::getInstance (
66 int    a_argn
67,char** a_args
68,char*  a_class
69)
70/***************************************************************************/
71/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
72{
73  if (instance==NULL) {
74    instance = new G4Qt(a_argn,a_args,a_class);
75  }
76  return instance;
77}
78/***************************************************************************/
79G4Qt::G4Qt (
80 int    a_argn
81,char** a_args
82,char*  a_class
83)
84/***************************************************************************/
85/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
86{
87  if(QtInited==FALSE) {  //Qt should be Inited once !
88
89    new QApplication (a_argn, a_args);
90    mainWidget = new QMainWindow();
91
92    if(mainWidget==NULL) {
93      G4cout        << "G4Qt : Unable to init Qt." << G4endl;
94    }
95    QtInited  = TRUE;
96    mainWidget->show();
97    qApp->exec();
98  }
99//  AddDispatcher     ((G4DispatchFunction)QtDispatchEvent); // FIXME
100}
101/***************************************************************************/
102G4Qt::~G4Qt (
103)
104/***************************************************************************/
105/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
106{
107  if(this==instance) {
108    instance = NULL;
109  }
110}
111/***************************************************************************/
112G4bool G4Qt::Inited (
113)
114/***************************************************************************/
115/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
116{
117  return QtInited;
118}
119/***************************************************************************/
120void* G4Qt::GetEvent (
121)
122/***************************************************************************/
123/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
124{
125//FIXME
126   G4cout        << "G4Qt : Rien compris a cette fonction G4Qt::GetEvent." << G4endl;
127//  static XEvent  event;
128//  if(appContext==NULL) return NULL;
129//  if(mainApp==NULL) return NULL;
130//  QtAppNextEvent (appContext, &event);
131//  return         &event;
132}
133/***************************************************************************/
134void G4Qt::FlushAndWaitExecution (
135)
136/***************************************************************************/
137/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
138{
139//FIXME
140   G4cout        << "G4Qt : Rien compris a cette fonction G4Qt::FlushAndWaitExecution." << G4endl;
141//  if(mainApp==NULL) return;
142//  XSync(QtDisplay(mainApp),False);
143}
144
145#endif
146
147
148
Note: See TracBrowser for help on using the repository browser.