1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
2 | <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> |
---|
3 | <title>G4Qt.cc Source File</title> |
---|
4 | <link href="doxygen.css" rel="stylesheet" type="text/css"> |
---|
5 | </head><body> |
---|
6 | <!-- Generated by Doxygen 1.3.4 --> |
---|
7 | <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a></div> |
---|
8 | <h1>G4Qt.cc</h1><a href="G4Qt_8cc.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">//</span> |
---|
9 | 00002 <span class="comment">// ********************************************************************</span> |
---|
10 | 00003 <span class="comment">// * License and Disclaimer *</span> |
---|
11 | 00004 <span class="comment">// * *</span> |
---|
12 | 00005 <span class="comment">// * The Geant4 software is copyright of the Copyright Holders of *</span> |
---|
13 | 00006 <span class="comment">// * the Geant4 Collaboration. It is provided under the terms and *</span> |
---|
14 | 00007 <span class="comment">// * conditions of the Geant4 Software License, included in the file *</span> |
---|
15 | 00008 <span class="comment">// * LICENSE and available at http://cern.ch/geant4/license . These *</span> |
---|
16 | 00009 <span class="comment">// * include a list of copyright holders. *</span> |
---|
17 | 00010 <span class="comment">// * *</span> |
---|
18 | 00011 <span class="comment">// * Neither the authors of this software system, nor their employing *</span> |
---|
19 | 00012 <span class="comment">// * institutes,nor the agencies providing financial support for this *</span> |
---|
20 | 00013 <span class="comment">// * work make any representation or warranty, express or implied, *</span> |
---|
21 | 00014 <span class="comment">// * regarding this software system or assume any liability for its *</span> |
---|
22 | 00015 <span class="comment">// * use. Please see the license in the file LICENSE and URL above *</span> |
---|
23 | 00016 <span class="comment">// * for the full disclaimer and the limitation of liability. *</span> |
---|
24 | 00017 <span class="comment">// * *</span> |
---|
25 | 00018 <span class="comment">// * This code implementation is the result of the scientific and *</span> |
---|
26 | 00019 <span class="comment">// * technical work of the GEANT4 collaboration. *</span> |
---|
27 | 00020 <span class="comment">// * By using, copying, modifying or distributing the software (or *</span> |
---|
28 | 00021 <span class="comment">// * any work based on the software) you agree to acknowledge its *</span> |
---|
29 | 00022 <span class="comment">// * use in resulting scientific publications, and indicate your *</span> |
---|
30 | 00023 <span class="comment">// * acceptance of all terms of the Geant4 Software license. *</span> |
---|
31 | 00024 <span class="comment">// ********************************************************************</span> |
---|
32 | 00025 <span class="comment">//</span> |
---|
33 | 00026 <span class="comment">//</span> |
---|
34 | 00027 <span class="comment">// $Id: G4Qt.cc,v 1.11 2007/05/29 11:10:28 $</span> |
---|
35 | 00028 <span class="comment">// GEANT4 tag $Name: geant4-08-01 $</span> |
---|
36 | 00029 <span class="comment">//</span> |
---|
37 | 00030 <span class="comment">// L. Garnier</span> |
---|
38 | 00031 |
---|
39 | 00032 <span class="preprocessor">#if defined(G4INTY_BUILD_QT) || defined(G4INTY_USE_QT)</span> |
---|
40 | 00033 <span class="preprocessor"></span> |
---|
41 | 00034 <span class="preprocessor">#include <stdlib.h></span> |
---|
42 | 00035 <span class="preprocessor">#include <string.h></span> |
---|
43 | 00036 |
---|
44 | 00037 <span class="preprocessor">#include "G4ios.hh"</span> |
---|
45 | 00038 |
---|
46 | 00039 <span class="preprocessor">#include "<a class="code" href="G4Qt_8hh.html">G4Qt.hh</a>"</span> |
---|
47 | 00040 |
---|
48 | 00041 <span class="preprocessor">#define NewString(str) \</span> |
---|
49 | 00042 <span class="preprocessor"> ((str) != NULL ? (strcpy((char*)malloc((unsigned)strlen(str) + 1), str)) : NULL)</span> |
---|
50 | 00043 <span class="preprocessor"></span> |
---|
51 | 00044 <span class="comment">//static void XWidgetIconify (Widget);</span> |
---|
52 | 00045 <span class="comment">//static void XWidgetUniconify (Widget);</span> |
---|
53 | 00046 <span class="comment">//static void XDisplaySetWindowToNormalState (Display*,Window);</span> |
---|
54 | 00047 |
---|
55 | <a name="l00048"></a><a class="code" href="classG4Qt.html#v0">00048</a> <a class="code" href="classG4Qt.html">G4Qt</a>* <a class="code" href="classG4Qt.html#v0">G4Qt::instance</a> = NULL; |
---|
56 | 00049 |
---|
57 | <a name="l00050"></a><a class="code" href="G4Qt_8cc.html#a0">00050</a> <span class="keyword">static</span> G4bool <a class="code" href="G4Qt_8cc.html#a0">QtInited</a> = FALSE; |
---|
58 | 00051 <span class="comment">//static int argn = 0;</span> |
---|
59 | 00052 <span class="comment">//static char** args = NULL;</span> |
---|
60 | 00053 <span class="comment">// static QtAppContext appContext = NULL;</span> |
---|
61 | 00054 <span class="comment">//static QApplication app = NULL;</span> |
---|
62 | 00055 |
---|
63 | 00056 <span class="comment">/***************************************************************************/</span> |
---|
64 | <a name="l00057"></a><a class="code" href="classG4Qt.html#e0">00057</a> <a class="code" href="classG4Qt.html">G4Qt</a>* <a class="code" href="classG4Qt.html#e0">G4Qt::getInstance</a> ( |
---|
65 | 00058 ) |
---|
66 | 00059 <span class="comment">/***************************************************************************/</span> |
---|
67 | 00061 { |
---|
68 | 00062 <span class="keywordflow">return</span> <a class="code" href="classG4Qt.html#e0">G4Qt::getInstance</a> (0,NULL,(<span class="keywordtype">char</span>*)<span class="stringliteral">"Geant4"</span>); |
---|
69 | 00063 } |
---|
70 | 00064 <span class="comment">/***************************************************************************/</span> |
---|
71 | <a name="l00065"></a><a class="code" href="classG4Qt.html#e1">00065</a> <a class="code" href="classG4Qt.html">G4Qt</a>* <a class="code" href="classG4Qt.html#e0">G4Qt::getInstance</a> ( |
---|
72 | 00066 <span class="keywordtype">int</span> a_argn |
---|
73 | 00067 ,<span class="keywordtype">char</span>** a_args |
---|
74 | 00068 ,<span class="keywordtype">char</span>* a_class |
---|
75 | 00069 ) |
---|
76 | 00070 <span class="comment">/***************************************************************************/</span> |
---|
77 | 00072 { |
---|
78 | 00073 <span class="keywordflow">if</span> (<a class="code" href="classG4Qt.html#v0">instance</a>==NULL) { |
---|
79 | 00074 <a class="code" href="classG4Qt.html#v0">instance</a> = <span class="keyword">new</span> <a class="code" href="classG4Qt.html#d0">G4Qt</a>(a_argn,a_args,a_class); |
---|
80 | 00075 } |
---|
81 | 00076 <span class="keywordflow">return</span> <a class="code" href="classG4Qt.html#v0">instance</a>; |
---|
82 | 00077 } |
---|
83 | 00078 <span class="comment">/***************************************************************************/</span> |
---|
84 | <a name="l00079"></a><a class="code" href="classG4Qt.html#d0">00079</a> <a class="code" href="classG4Qt.html#d0">G4Qt::G4Qt</a> ( |
---|
85 | 00080 <span class="keywordtype">int</span> a_argn |
---|
86 | 00081 ,<span class="keywordtype">char</span>** a_args |
---|
87 | 00082 ,<span class="keywordtype">char</span>* a_class |
---|
88 | 00083 ) |
---|
89 | 00084 <span class="comment">/***************************************************************************/</span> |
---|
90 | 00086 { |
---|
91 | 00087 <span class="keywordflow">if</span>(<a class="code" href="G4Qt_8cc.html#a0">QtInited</a>==FALSE) { <span class="comment">//Qt should be Inited once !</span> |
---|
92 | 00088 |
---|
93 | 00089 <span class="keyword">new</span> QApplication (a_argn, a_args); |
---|
94 | 00090 |
---|
95 | 00091 <span class="keywordflow">if</span>(qApp==NULL) { |
---|
96 | 00092 G4cout << <span class="stringliteral">"G4Qt : Unable to init Qt."</span> << G4endl; |
---|
97 | 00093 } |
---|
98 | 00094 <a class="code" href="G4Qt_8cc.html#a0">QtInited</a> = TRUE; |
---|
99 | 00095 <a class="code" href="classG4VInteractorManager.html#a4">SetMainInteractor</a> (qApp); |
---|
100 | 00096 } |
---|
101 | 00097 <a class="code" href="classG4VInteractorManager.html#a2">SetArguments</a> (a_argn,a_args); |
---|
102 | 00098 <span class="comment">// AddDispatcher ((G4DispatchFunction)XtDispatchEvent);</span> |
---|
103 | 00099 } |
---|
104 | 00100 <span class="comment">/***************************************************************************/</span> |
---|
105 | <a name="l00101"></a><a class="code" href="classG4Qt.html#a3">00101</a> <a class="code" href="classG4Qt.html#a3">G4Qt::~G4Qt</a> ( |
---|
106 | 00102 ) |
---|
107 | 00103 <span class="comment">/***************************************************************************/</span> |
---|
108 | 00105 { |
---|
109 | 00106 <span class="keywordflow">if</span>(<span class="keyword">this</span>==<a class="code" href="classG4Qt.html#v0">instance</a>) { |
---|
110 | 00107 <a class="code" href="classG4Qt.html#v0">instance</a> = NULL; |
---|
111 | 00108 } |
---|
112 | 00109 } |
---|
113 | 00110 <span class="comment">/***************************************************************************/</span> |
---|
114 | <a name="l00111"></a><a class="code" href="classG4Qt.html#a0">00111</a> G4bool <a class="code" href="classG4Qt.html#a0">G4Qt::Inited</a> ( |
---|
115 | 00112 ) |
---|
116 | 00113 <span class="comment">/***************************************************************************/</span> |
---|
117 | 00115 { |
---|
118 | 00116 <span class="keywordflow">return</span> <a class="code" href="G4Qt_8cc.html#a0">QtInited</a>; |
---|
119 | 00117 } |
---|
120 | 00118 <span class="comment">/***************************************************************************/</span> |
---|
121 | <a name="l00122"></a><a class="code" href="classG4Qt.html#a1">00122</a> <span class="keywordtype">void</span>* <a class="code" href="classG4Qt.html#a1">G4Qt::GetEvent</a> ( |
---|
122 | 00123 ) |
---|
123 | 00124 <span class="comment">/***************************************************************************/</span> |
---|
124 | 00126 { |
---|
125 | 00127 <span class="comment">//FIXME</span> |
---|
126 | 00128 <span class="comment">// G4cout << "G4Qt : Rien compris a cette fonction G4Qt::GetEvent." << G4endl;</span> |
---|
127 | 00129 <span class="comment">// static XEvent event;</span> |
---|
128 | 00130 <span class="comment">// if(appContext==NULL) return NULL;</span> |
---|
129 | 00131 <span class="comment">// if(mainApp==NULL) return NULL;</span> |
---|
130 | 00132 <span class="comment">// QtAppNextEvent (appContext, &event);</span> |
---|
131 | 00133 <span class="comment">// return &event;</span> |
---|
132 | 00134 printf(<span class="stringliteral">"*"</span>); |
---|
133 | 00135 } |
---|
134 | 00136 <span class="comment">/***************************************************************************/</span> |
---|
135 | <a name="l00137"></a><a class="code" href="classG4Qt.html#a2">00137</a> <span class="keywordtype">void</span> <a class="code" href="classG4Qt.html#a2">G4Qt::FlushAndWaitExecution</a> ( |
---|
136 | 00138 ) |
---|
137 | 00139 <span class="comment">/***************************************************************************/</span> |
---|
138 | 00141 { |
---|
139 | 00142 <span class="comment">//FIXME</span> |
---|
140 | 00143 G4cout << <span class="stringliteral">"G4Qt : Rien compris a cette fonction G4Qt::FlushAndWaitExecution."</span> << G4endl; |
---|
141 | 00144 <span class="comment">// if(mainApp==NULL) return;</span> |
---|
142 | 00145 <span class="comment">// XSync(QtDisplay(mainApp),False);</span> |
---|
143 | 00146 } |
---|
144 | 00147 |
---|
145 | 00148 <span class="preprocessor">#endif</span> |
---|
146 | 00149 <span class="preprocessor"></span> |
---|
147 | 00150 |
---|
148 | 00151 |
---|
149 | </pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Jun 22 11:07:01 2007 by |
---|
150 | <a href="http://www.doxygen.org/index.html"> |
---|
151 | <img src="doxygen.png" alt="doxygen" align="middle" border=0 > |
---|
152 | </a>1.3.4 </small></address> |
---|
153 | </body> |
---|
154 | </html> |
---|