source: trunk/source/interfaces/html/G4Win32_8cc-source.html @ 818

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

r581@mac-90108: laurentgarnier | 2007-08-17 17:30:26 +0200
deplacement de frame

  • Property svn:mime-type set to text/html
File size: 11.4 KB
Line 
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>G4Win32.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&nbsp;Page</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
8<h1>G4Win32.cc</h1><a href="G4Win32_8cc.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">//</span>
900002 <span class="comment">// ********************************************************************</span>
1000003 <span class="comment">// * License and Disclaimer                                           *</span>
1100004 <span class="comment">// *                                                                  *</span>
1200005 <span class="comment">// * The  Geant4 software  is  copyright of the Copyright Holders  of *</span>
1300006 <span class="comment">// * the Geant4 Collaboration.  It is provided  under  the terms  and *</span>
1400007 <span class="comment">// * conditions of the Geant4 Software License,  included in the file *</span>
1500008 <span class="comment">// * LICENSE and available at  http://cern.ch/geant4/license .  These *</span>
1600009 <span class="comment">// * include a list of copyright holders.                             *</span>
1700010 <span class="comment">// *                                                                  *</span>
1800011 <span class="comment">// * Neither the authors of this software system, nor their employing *</span>
1900012 <span class="comment">// * institutes,nor the agencies providing financial support for this *</span>
2000013 <span class="comment">// * work  make  any representation or  warranty, express or implied, *</span>
2100014 <span class="comment">// * regarding  this  software system or assume any liability for its *</span>
2200015 <span class="comment">// * use.  Please see the license in the file  LICENSE  and URL above *</span>
2300016 <span class="comment">// * for the full disclaimer and the limitation of liability.         *</span>
2400017 <span class="comment">// *                                                                  *</span>
2500018 <span class="comment">// * This  code  implementation is the result of  the  scientific and *</span>
2600019 <span class="comment">// * technical work of the GEANT4 collaboration.                      *</span>
2700020 <span class="comment">// * By using,  copying,  modifying or  distributing the software (or *</span>
2800021 <span class="comment">// * any work based  on the software)  you  agree  to acknowledge its *</span>
2900022 <span class="comment">// * use  in  resulting  scientific  publications,  and indicate your *</span>
3000023 <span class="comment">// * acceptance of all terms of the Geant4 Software license.          *</span>
3100024 <span class="comment">// ********************************************************************</span>
3200025 <span class="comment">//</span>
3300026 <span class="comment">//</span>
3400027 <span class="comment">// $Id: G4Win32.cc,v 1.9 2006/06/29 19:10:26 gunter Exp $</span>
3500028 <span class="comment">// GEANT4 tag $Name: geant4-08-01-patch-01 $</span>
3600029 <span class="comment">//</span>
3700030 <span class="comment">// G.Barrand</span>
3800031
3900032 <span class="preprocessor">#if defined(G4INTY_BUILD_WIN32) || defined(G4INTY_USE_WIN32)</span>
4000033 <span class="preprocessor"></span>
4100034 <span class="comment">// this :</span>
4200035 <span class="preprocessor">#include "<a class="code" href="G4Win32_8hh.html">G4Win32.hh</a>"</span>
4300036
4400037 <span class="preprocessor">#include "G4ios.hh"</span>
4500038
46<a name="l00039"></a><a class="code" href="G4Win32_8cc.html#a0">00039</a> <span class="keyword">static</span> <span class="keywordtype">char</span> <a class="code" href="G4Win32_8cc.html#a0">className</a>[] = <span class="stringliteral">"G4Win32"</span>;
4700040
48<a name="l00041"></a><a class="code" href="classG4Win32.html#v0">00041</a> <a class="code" href="classG4Win32.html">G4Win32</a>* <a class="code" href="classG4Win32.html#v0">G4Win32::instance</a>  = NULL;
4900042
50<a name="l00043"></a><a class="code" href="G4Win32_8cc.html#a1">00043</a> <span class="keyword">static</span> G4bool    <a class="code" href="G4Win32_8cc.html#a1">Win32Inited</a>   = FALSE;
51<a name="l00044"></a><a class="code" href="G4Win32_8cc.html#a2">00044</a> <span class="keyword">static</span> HWND      <a class="code" href="G4Win32_8cc.html#a2">topWindow</a>     = NULL;
5200045 <span class="comment">/***************************************************************************/</span>
53<a name="l00046"></a><a class="code" href="classG4Win32.html#e0">00046</a> <a class="code" href="classG4Win32.html">G4Win32</a>* <a class="code" href="classG4Win32.html#e0">G4Win32::getInstance</a> (
5400047 )
5500048 <span class="comment">/***************************************************************************/</span>
5600050 {
5700051   <span class="keywordflow">if</span> (<a class="code" href="classG4Win32.html#v0">instance</a>==NULL) {
5800052     <a class="code" href="classG4Win32.html#v0">instance</a> = <span class="keyword">new</span> <a class="code" href="classG4Win32.html#d0">G4Win32</a>();
5900053   }
6000054   <span class="keywordflow">return</span> <a class="code" href="classG4Win32.html#v0">instance</a>;
6100055 }
6200056 <span class="comment">/***************************************************************************/</span>
63<a name="l00057"></a><a class="code" href="classG4Win32.html#d0">00057</a> <a class="code" href="classG4Win32.html#d0">G4Win32::G4Win32</a> (
6400058 )
6500059 <span class="comment">/***************************************************************************/</span>
6600061 {
6700062   <span class="keywordflow">if</span>(<a class="code" href="G4Win32_8cc.html#a1">Win32Inited</a>==FALSE) { <span class="comment">// Should be Done once.</span>
6800063
6900064     WNDCLASS         wc;
7000065     wc.style         = CS_HREDRAW | CS_VREDRAW;
7100066     wc.lpfnWndProc   = (WNDPROC)DefWindowProc;
7200067     wc.cbClsExtra    = 0;
7300068     wc.cbWndExtra    = 0;
7400069     wc.hInstance     = ::GetModuleHandle(NULL);
7500070     wc.hIcon         = LoadIcon  (NULL,IDI_APPLICATION);
7600071     wc.hCursor       = LoadCursor(NULL,IDC_ARROW);
7700072     wc.hbrBackground = GetStockBrush(BLACK_BRUSH);
7800073     wc.lpszMenuName  = <a class="code" href="G4Win32_8cc.html#a0">className</a>;
7900074     wc.lpszClassName = <a class="code" href="G4Win32_8cc.html#a0">className</a>;
8000075     ::RegisterClass  (&amp;wc);
8100076     
8200077     <a class="code" href="G4Win32_8cc.html#a2">topWindow</a>   = ::CreateWindow(<a class="code" href="G4Win32_8cc.html#a0">className</a>,<a class="code" href="G4Win32_8cc.html#a0">className</a>,
8300078                                  WS_OVERLAPPEDWINDOW,
8400079                                  CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
8500080                                  NULL, NULL,
8600081                                  ::GetModuleHandle(NULL),
8700082                                  NULL);
8800083     
8900084     <span class="keywordflow">if</span>(<a class="code" href="G4Win32_8cc.html#a2">topWindow</a>==NULL) {
9000085       G4cout &lt;&lt; <span class="stringliteral">"G4Win32 : Unable to create Win32 window."</span> &lt;&lt; G4endl;
9100086     }
9200087
9300088     <a class="code" href="G4Win32_8cc.html#a1">Win32Inited</a> = TRUE;
9400089   }
9500090
9600091   <a class="code" href="classG4VInteractorManager.html#a6">AddDispatcher</a>((<a class="code" href="G4VInteractorManager_8hh.html#a1">G4DispatchFunction</a>)<a class="code" href="classG4Win32.html#e1">G4Win32::dispatchWin32Event</a>);
9700092   <a class="code" href="classG4VInteractorManager.html#a4">SetMainInteractor</a>(<a class="code" href="G4Win32_8cc.html#a2">topWindow</a>);
9800093 }
9900094 <span class="comment">/***************************************************************************/</span>
100<a name="l00095"></a><a class="code" href="classG4Win32.html#a3">00095</a> <a class="code" href="classG4Win32.html#a3">G4Win32::~G4Win32</a> (
10100096 )
10200097 <span class="comment">/***************************************************************************/</span>
10300099 {
10400100   <span class="keywordflow">if</span>(<span class="keyword">this</span>==<a class="code" href="classG4Win32.html#v0">instance</a>) {
10500101     <a class="code" href="classG4Win32.html#v0">instance</a> = NULL;
10600102   }
10700103 }
10800104 <span class="comment">/***************************************************************************/</span>
109<a name="l00105"></a><a class="code" href="classG4Win32.html#a0">00105</a> G4bool <a class="code" href="classG4Win32.html#a0">G4Win32::Inited</a> (
11000106 )
11100107 <span class="comment">/***************************************************************************/</span>
11200109 {
11300110   <span class="keywordflow">return</span> <a class="code" href="G4Win32_8cc.html#a1">Win32Inited</a>;
11400111 }
11500112 <span class="comment">/***************************************************************************/</span>
116<a name="l00113"></a><a class="code" href="classG4Win32.html#a1">00113</a> <span class="keywordtype">void</span>* <a class="code" href="classG4Win32.html#a1">G4Win32::GetEvent</a> (
11700114 )
11800115 <span class="comment">/***************************************************************************/</span>
11900117 {
12000118   <span class="keyword">static</span> MSG event;
12100119   BOOL status = ::GetMessage(&amp;event, NULL, 0, 0);
12200120   <span class="keywordflow">if</span>(status==FALSE) <span class="keywordflow">return</span> NULL;
12300121   <span class="keywordflow">return</span> &amp;event;
12400122 }
12500123 <span class="comment">/***************************************************************************/</span>
126<a name="l00124"></a><a class="code" href="classG4Win32.html#a2">00124</a> <span class="keywordtype">void</span> <a class="code" href="classG4Win32.html#a2">G4Win32::FlushAndWaitExecution</a> (
12700125 )
12800126 <span class="comment">/***************************************************************************/</span>
12900128 {
13000129   MSG event;
13100130   <span class="keywordflow">while</span> ( ::PeekMessage(&amp;event, NULL, 0, 0, PM_REMOVE) ) {
13200131     ::TranslateMessage(&amp;event);
13300132     ::DispatchMessage (&amp;event);
13400133   }
13500134 }
13600135 <span class="comment">/***************************************************************************/</span>
137<a name="l00136"></a><a class="code" href="classG4Win32.html#e1">00136</a> G4bool <a class="code" href="classG4Win32.html#e1">G4Win32::dispatchWin32Event</a>  (
13800137  <span class="keywordtype">void</span>* a_event
13900138 )
14000139 <span class="comment">/***************************************************************************/</span>
14100141 {
14200142   ::TranslateMessage((MSG*)a_event);
14300143   ::DispatchMessage ((MSG*)a_event);
14400144   <span class="keywordflow">return</span> TRUE;
14500145 }
14600146
14700147 <span class="preprocessor">#endif //HAS_WIN32</span>
14800148 <span class="preprocessor"></span>
149</pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Jun 22 11:07:02 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>
Note: See TracBrowser for help on using the repository browser.