[571] | 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>G4UIWin32.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>G4UIWin32.cc</h1><a href="G4UIWin32_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: G4UIWin32.cc,v 1.13 2006/06/29 19:09:45 gunter Exp $</span> |
---|
| 35 | 00028 <span class="comment">// GEANT4 tag $Name: geant4-08-01-patch-01 $</span> |
---|
| 36 | 00029 <span class="comment">//</span> |
---|
| 37 | 00030 <span class="comment">// G.Barrand</span> |
---|
| 38 | 00031 |
---|
| 39 | 00032 <span class="comment">//#define DEBUG</span> |
---|
| 40 | 00033 |
---|
| 41 | 00034 <span class="preprocessor">#ifdef G4UI_BUILD_WIN32_SESSION</span> |
---|
| 42 | 00035 <span class="preprocessor"></span> |
---|
| 43 | 00036 <span class="comment">// this :</span> |
---|
| 44 | 00037 <span class="preprocessor">#include "<a class="code" href="G4UIWin32_8hh.html">G4UIWin32.hh</a>"</span> |
---|
| 45 | 00038 |
---|
| 46 | 00039 <span class="preprocessor">#include <string.h></span> |
---|
| 47 | 00040 |
---|
| 48 | 00041 <span class="preprocessor">#include <windows.h></span> |
---|
| 49 | 00042 <span class="preprocessor">#include <windowsx.h></span> |
---|
| 50 | 00043 <span class="preprocessor">#include <wingdi.h></span> |
---|
| 51 | 00044 |
---|
| 52 | 00045 <span class="preprocessor">#include <strstream></span> |
---|
| 53 | 00046 |
---|
| 54 | 00047 <span class="preprocessor">#include "G4UImanager.hh"</span> |
---|
| 55 | 00048 <span class="preprocessor">#include "G4StateManager.hh"</span> |
---|
| 56 | 00049 <span class="preprocessor">#include "G4UIcommandTree.hh"</span> |
---|
| 57 | 00050 <span class="preprocessor">#include "G4UIcommandStatus.hh"</span> |
---|
| 58 | 00051 <span class="preprocessor">#include "<a class="code" href="G4Win32_8hh.html">G4Win32.hh</a>"</span> |
---|
| 59 | 00052 |
---|
| 60 | 00053 <span class="preprocessor">#define TEXT_MAX_LINES 300</span> |
---|
| 61 | 00054 <span class="preprocessor"></span> |
---|
| 62 | <a name="l00055"></a><a class="code" href="classTextBuffer.html">00055</a> <span class="keyword">class </span><a class="code" href="classTextBuffer.html">TextBuffer</a> |
---|
| 63 | 00056 { |
---|
| 64 | 00057 <span class="keyword">public</span>: |
---|
| 65 | 00058 <a class="code" href="classTextBuffer.html#a0">TextBuffer</a>(); |
---|
| 66 | 00059 <a class="code" href="classTextBuffer.html#a1">~TextBuffer</a>(); |
---|
| 67 | 00060 |
---|
| 68 | <a name="l00061"></a><a class="code" href="classTextBuffer.html#a2">00061</a> <span class="keywordtype">int</span> <a class="code" href="classTextBuffer.html#a2">GetNumberOfLines</a> () { <span class="keywordflow">return</span> <a class="code" href="classTextBuffer.html#r2">linei</a>;} |
---|
| 69 | <a name="l00062"></a><a class="code" href="classTextBuffer.html#a3">00062</a> <span class="keywordtype">void</span> <a class="code" href="classTextBuffer.html#a3">SetHeightOfPage</a> (<span class="keywordtype">int</span> a_height) { <a class="code" href="classTextBuffer.html#r4">heightOfPage</a> = a_height; } |
---|
| 70 | 00063 <span class="keywordtype">void</span> <a class="code" href="classTextBuffer.html#a4">SetEndOfPage</a> (<span class="keywordtype">int</span> a_value); |
---|
| 71 | <a name="l00064"></a><a class="code" href="classTextBuffer.html#a5">00064</a> <span class="keywordtype">int</span> <a class="code" href="classTextBuffer.html#a5">GetEndOfPage</a> () { <span class="keywordflow">return</span> <a class="code" href="classTextBuffer.html#r3">endOfPage</a>; } |
---|
| 72 | 00065 |
---|
| 73 | 00066 <span class="keywordtype">void</span> <a class="code" href="classTextBuffer.html#a6">IncrementEndOfPage</a> (); |
---|
| 74 | 00067 <span class="keywordtype">void</span> <a class="code" href="classTextBuffer.html#a7">DecrementEndOfPage</a> (); |
---|
| 75 | 00068 <span class="keywordtype">void</span> <a class="code" href="classTextBuffer.html#a8">JumpDownEndOfPage</a> (); |
---|
| 76 | 00069 <span class="keywordtype">void</span> <a class="code" href="classTextBuffer.html#a9">JumpUpEndOfPage</a> (); |
---|
| 77 | 00070 G4bool <a class="code" href="classTextBuffer.html#a10">AppendString</a> (<span class="keywordtype">char</span>* a_string); |
---|
| 78 | 00071 <span class="keywordtype">void</span> <a class="code" href="classTextBuffer.html#a11">Draw</a> (HDC a_hdc,RECT* a_rect); |
---|
| 79 | 00072 |
---|
| 80 | 00073 <span class="keyword">private</span>: |
---|
| 81 | <a name="l00074"></a><a class="code" href="classTextBuffer.html#r0">00074</a> G4String* <a class="code" href="classTextBuffer.html#r0">lines</a>; |
---|
| 82 | <a name="l00075"></a><a class="code" href="classTextBuffer.html#r1">00075</a> <span class="keywordtype">int</span> <a class="code" href="classTextBuffer.html#r1">linen</a>; |
---|
| 83 | <a name="l00076"></a><a class="code" href="classTextBuffer.html#r2">00076</a> <span class="keywordtype">int</span> <a class="code" href="classTextBuffer.html#r2">linei</a>; |
---|
| 84 | <a name="l00077"></a><a class="code" href="classTextBuffer.html#r4">00077</a> <span class="keywordtype">int</span> <a class="code" href="classTextBuffer.html#r3">endOfPage</a>,<a class="code" href="classTextBuffer.html#r4">heightOfPage</a>; |
---|
| 85 | <a name="l00078"></a><a class="code" href="classTextBuffer.html#r5">00078</a> <span class="keywordtype">char</span> <a class="code" href="classTextBuffer.html#r5">spaces</a>[256]; |
---|
| 86 | 00079 }; |
---|
| 87 | 00080 |
---|
| 88 | <a name="l00081"></a><a class="code" href="classTextBuffer.html#a0">00081</a> <a class="code" href="classTextBuffer.html#a0">TextBuffer::TextBuffer</a>() |
---|
| 89 | 00082 : linei(0),linen(TEXT_MAX_LINES),endOfPage(0),heightOfPage(12) |
---|
| 90 | 00083 { |
---|
| 91 | 00084 <a class="code" href="classTextBuffer.html#r0">lines</a> = <span class="keyword">new</span> G4String[<a class="code" href="classTextBuffer.html#r1">linen</a>]; |
---|
| 92 | 00085 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> count=0;count<256;count++) <a class="code" href="classTextBuffer.html#r5">spaces</a>[count] = <span class="charliteral">' '</span>; |
---|
| 93 | 00086 } |
---|
| 94 | 00087 |
---|
| 95 | <a name="l00088"></a><a class="code" href="classTextBuffer.html#a1">00088</a> <a class="code" href="classTextBuffer.html#a1">TextBuffer::~TextBuffer</a>() |
---|
| 96 | 00089 { |
---|
| 97 | 00090 <span class="keyword">delete</span> [] <a class="code" href="classTextBuffer.html#r0">lines</a>; |
---|
| 98 | 00091 } |
---|
| 99 | 00092 |
---|
| 100 | <a name="l00093"></a><a class="code" href="classTextBuffer.html#a4">00093</a> <span class="keywordtype">void</span> <a class="code" href="classTextBuffer.html#a4">TextBuffer::SetEndOfPage</a> (<span class="keywordtype">int</span> a_value) |
---|
| 101 | 00094 { |
---|
| 102 | 00095 <span class="keywordflow">if</span>( (a_value<0) || (a_value>=<a class="code" href="classTextBuffer.html#r2">linei</a>)) { |
---|
| 103 | 00096 <a class="code" href="classTextBuffer.html#r3">endOfPage</a> = <a class="code" href="classTextBuffer.html#r2">linei</a>-1; |
---|
| 104 | 00097 } <span class="keywordflow">else</span> { |
---|
| 105 | 00098 <a class="code" href="classTextBuffer.html#r3">endOfPage</a> = a_value; |
---|
| 106 | 00099 } |
---|
| 107 | 00100 } |
---|
| 108 | 00101 |
---|
| 109 | <a name="l00102"></a><a class="code" href="classTextBuffer.html#a6">00102</a> <span class="keywordtype">void</span> <a class="code" href="classTextBuffer.html#a6">TextBuffer::IncrementEndOfPage</a> () |
---|
| 110 | 00103 { |
---|
| 111 | 00104 <a class="code" href="classTextBuffer.html#r3">endOfPage</a>++; |
---|
| 112 | 00105 <span class="keywordflow">if</span>(<a class="code" href="classTextBuffer.html#r3">endOfPage</a>>=<a class="code" href="classTextBuffer.html#r2">linei</a>) <a class="code" href="classTextBuffer.html#r3">endOfPage</a> = <a class="code" href="classTextBuffer.html#r2">linei</a>-1; |
---|
| 113 | 00106 } |
---|
| 114 | 00107 |
---|
| 115 | <a name="l00108"></a><a class="code" href="classTextBuffer.html#a7">00108</a> <span class="keywordtype">void</span> <a class="code" href="classTextBuffer.html#a7">TextBuffer::DecrementEndOfPage</a> () |
---|
| 116 | 00109 { |
---|
| 117 | 00110 <a class="code" href="classTextBuffer.html#r3">endOfPage</a>--; |
---|
| 118 | 00111 <span class="keywordflow">if</span>(<a class="code" href="classTextBuffer.html#r3">endOfPage</a><0) <a class="code" href="classTextBuffer.html#r3">endOfPage</a> = 0; |
---|
| 119 | 00112 } |
---|
| 120 | 00113 |
---|
| 121 | <a name="l00114"></a><a class="code" href="classTextBuffer.html#a8">00114</a> <span class="keywordtype">void</span> <a class="code" href="classTextBuffer.html#a8">TextBuffer::JumpDownEndOfPage</a> () |
---|
| 122 | 00115 { |
---|
| 123 | 00116 <a class="code" href="classTextBuffer.html#r3">endOfPage</a> += <a class="code" href="classTextBuffer.html#r4">heightOfPage</a>; |
---|
| 124 | 00117 <span class="keywordflow">if</span>(<a class="code" href="classTextBuffer.html#r3">endOfPage</a>>=<a class="code" href="classTextBuffer.html#r2">linei</a>) <a class="code" href="classTextBuffer.html#r3">endOfPage</a> = <a class="code" href="classTextBuffer.html#r2">linei</a>-1; |
---|
| 125 | 00118 } |
---|
| 126 | 00119 |
---|
| 127 | <a name="l00120"></a><a class="code" href="classTextBuffer.html#a9">00120</a> <span class="keywordtype">void</span> <a class="code" href="classTextBuffer.html#a9">TextBuffer::JumpUpEndOfPage</a> () |
---|
| 128 | 00121 { |
---|
| 129 | 00122 <a class="code" href="classTextBuffer.html#r3">endOfPage</a> -= <a class="code" href="classTextBuffer.html#r4">heightOfPage</a>; |
---|
| 130 | 00123 <span class="keywordflow">if</span>(<a class="code" href="classTextBuffer.html#r3">endOfPage</a><0) <a class="code" href="classTextBuffer.html#r3">endOfPage</a> = 0; |
---|
| 131 | 00124 } |
---|
| 132 | 00125 |
---|
| 133 | <a name="l00126"></a><a class="code" href="classTextBuffer.html#a10">00126</a> G4bool <a class="code" href="classTextBuffer.html#a10">TextBuffer::AppendString</a> (<span class="keywordtype">char</span>* a_string) |
---|
| 134 | 00127 { |
---|
| 135 | 00128 G4bool value = <span class="keyword">false</span>; |
---|
| 136 | 00129 <span class="keywordflow">if</span>( (a_string==NULL) || (a_string[0]==<span class="charliteral">'\0'</span>) ) <span class="keywordflow">return</span> value; |
---|
| 137 | 00130 <span class="keywordtype">int</span> length = strlen(a_string); |
---|
| 138 | 00131 <span class="keywordflow">if</span>(a_string[length-1]==<span class="charliteral">'\n'</span>) { |
---|
| 139 | 00132 <a class="code" href="classTextBuffer.html#r0">lines</a>[<a class="code" href="classTextBuffer.html#r2">linei</a>] += a_string; |
---|
| 140 | 00133 <a class="code" href="classTextBuffer.html#r0">lines</a>[<a class="code" href="classTextBuffer.html#r2">linei</a>] = <a class="code" href="classTextBuffer.html#r0">lines</a>[<a class="code" href="classTextBuffer.html#r2">linei</a>].strip(G4String::trailing,<span class="charliteral">'\n'</span>); |
---|
| 141 | 00134 <a class="code" href="classTextBuffer.html#r2">linei</a>++; |
---|
| 142 | 00135 value = <span class="keyword">true</span>; |
---|
| 143 | 00136 } <span class="keywordflow">else</span> { |
---|
| 144 | 00137 <a class="code" href="classTextBuffer.html#r0">lines</a>[<a class="code" href="classTextBuffer.html#r2">linei</a>] += a_string; |
---|
| 145 | 00138 } |
---|
| 146 | 00139 <span class="keywordflow">if</span>(<a class="code" href="classTextBuffer.html#r2">linei</a>>=<a class="code" href="classTextBuffer.html#r1">linen</a>) { |
---|
| 147 | 00140 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> count=0;count<<a class="code" href="classTextBuffer.html#r1">linen</a>;count++) { |
---|
| 148 | 00141 <a class="code" href="classTextBuffer.html#r0">lines</a>[count] = <span class="stringliteral">""</span>; |
---|
| 149 | 00142 } |
---|
| 150 | 00143 <a class="code" href="classTextBuffer.html#r2">linei</a> = 0; |
---|
| 151 | 00144 } |
---|
| 152 | 00145 <span class="keywordflow">if</span>(value==<span class="keyword">true</span>) <a class="code" href="classTextBuffer.html#r3">endOfPage</a> = <a class="code" href="classTextBuffer.html#r2">linei</a>-1; |
---|
| 153 | 00146 <span class="keywordflow">return</span> value; |
---|
| 154 | 00147 } |
---|
| 155 | 00148 |
---|
| 156 | <a name="l00149"></a><a class="code" href="classTextBuffer.html#a11">00149</a> <span class="keywordtype">void</span> <a class="code" href="classTextBuffer.html#a11">TextBuffer::Draw</a> (HDC a_hdc,RECT* a_rect) |
---|
| 157 | 00150 { |
---|
| 158 | 00151 TEXTMETRIC tm; |
---|
| 159 | 00152 GetTextMetrics (a_hdc,&tm); |
---|
| 160 | 00153 <span class="keywordtype">short</span> charWidth = (<span class="keywordtype">short</span>)tm.tmAveCharWidth; |
---|
| 161 | 00154 <span class="keywordtype">short</span> charHeight = (<span class="keywordtype">short</span>)(tm.tmHeight + tm.tmExternalLeading); |
---|
| 162 | 00155 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> row=0;row<<a class="code" href="classTextBuffer.html#r4">heightOfPage</a>;row++) { |
---|
| 163 | 00156 <span class="keywordtype">int</span> rowi = <a class="code" href="classTextBuffer.html#r3">endOfPage</a> - row; |
---|
| 164 | 00157 <span class="keywordtype">short</span> y = (<span class="keywordtype">short</span>)(a_rect->bottom - charHeight * (row + 1)); |
---|
| 165 | 00158 <span class="keywordflow">if</span>((rowi>=0)&&(rowi<<a class="code" href="classTextBuffer.html#r2">linei</a>)) { |
---|
| 166 | 00159 TextOut (a_hdc,0,y,(<span class="keywordtype">char</span>*)<a class="code" href="classTextBuffer.html#r5">spaces</a>,256); <span class="comment">//Clear text background first.</span> |
---|
| 167 | 00160 <span class="keyword">const</span> <span class="keywordtype">char</span>* string = <a class="code" href="classTextBuffer.html#r0">lines</a>[rowi].data(); |
---|
| 168 | 00161 <span class="keywordflow">if</span>(string!=NULL) { |
---|
| 169 | 00162 TextOut (a_hdc,0,y,(<span class="keywordtype">char</span>*)string,strlen((<span class="keywordtype">char</span>*)string)); |
---|
| 170 | 00163 } |
---|
| 171 | 00164 } |
---|
| 172 | 00165 } |
---|
| 173 | 00166 } |
---|
| 174 | 00167 |
---|
| 175 | 00168 <span class="comment">/***************************************************************************/</span> |
---|
| 176 | <a name="l00169"></a><a class="code" href="G4UIWin32_8cc.html#a0">00169</a> <span class="keyword">static</span> <span class="keywordtype">char</span> <a class="code" href="G4UIWin32_8cc.html#a0">mainClassName</a>[] = <span class="stringliteral">"G4UIWin32"</span>; |
---|
| 177 | <a name="l00170"></a><a class="code" href="G4UIWin32_8cc.html#a1">00170</a> <span class="keyword">static</span> <span class="keywordtype">char</span> <a class="code" href="G4UIWin32_8cc.html#a1">textClassName</a>[] = <span class="stringliteral">"G4UIWin32/Text"</span>; |
---|
| 178 | <a name="l00171"></a><a class="code" href="G4UIWin32_8cc.html#a2">00171</a> <span class="keyword">static</span> G4bool <a class="code" href="G4UIWin32_8cc.html#a2">exitSession</a> = <span class="keyword">true</span>; |
---|
| 179 | <a name="l00172"></a><a class="code" href="G4UIWin32_8cc.html#a3">00172</a> <span class="keyword">static</span> G4bool <a class="code" href="G4UIWin32_8cc.html#a3">exitPause</a> = <span class="keyword">true</span>; |
---|
| 180 | <a name="l00173"></a><a class="code" href="G4UIWin32_8cc.html#a4">00173</a> <span class="keyword">static</span> G4bool <a class="code" href="G4UIWin32_8cc.html#a4">exitHelp</a> = <span class="keyword">true</span>; |
---|
| 181 | <a name="l00174"></a><a class="code" href="G4UIWin32_8cc.html#a5">00174</a> <span class="keyword">static</span> G4UIsession* <a class="code" href="G4UIWin32_8cc.html#a5">tmpSession</a> = NULL; |
---|
| 182 | 00175 |
---|
| 183 | <a name="l00176"></a><a class="code" href="G4UIWin32_8cc.html#a6">00176</a> <span class="keyword">static</span> WNDPROC <a class="code" href="G4UIWin32_8cc.html#a6">oldEditWindowProc</a>; |
---|
| 184 | 00177 <span class="keyword">static</span> G4bool <a class="code" href="G4UIXm_8cc.html#a6">ConvertStringToInt</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>*,<span class="keywordtype">int</span>&); |
---|
| 185 | 00178 |
---|
| 186 | <a name="l00179"></a><a class="code" href="G4UIWin32_8cc.html#a7">00179</a> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="G4UIWin32_8cc.html#a7">actionIdentifier</a> = 0; |
---|
| 187 | 00180 |
---|
| 188 | 00181 <span class="comment">/***************************************************************************/</span> |
---|
| 189 | <a name="l00182"></a><a class="code" href="classG4UIWin32.html#a0">00182</a> <a class="code" href="classG4UIWin32.html#a0">G4UIWin32::G4UIWin32</a> ( |
---|
| 190 | 00183 ) |
---|
| 191 | 00184 :mainWindow(NULL) |
---|
| 192 | 00185 ,textWindow(NULL) |
---|
| 193 | 00186 ,editWindow(NULL) |
---|
| 194 | 00187 ,menuBar(NULL) |
---|
| 195 | 00188 ,textBuffer(NULL) |
---|
| 196 | 00189 ,textCols(80) |
---|
| 197 | 00190 ,textRows(12) |
---|
| 198 | 00191 ,fHelp(false) |
---|
| 199 | 00192 ,fHelpChoice(0) |
---|
| 200 | 00193 ,fHistoryPos(-1) |
---|
| 201 | 00194 <span class="comment">/***************************************************************************/</span> |
---|
| 202 | 00196 { |
---|
| 203 | 00197 G4UImanager* UI = G4UImanager::GetUIpointer(); |
---|
| 204 | 00198 <span class="keywordflow">if</span>(UI!=NULL) UI->SetSession(<span class="keyword">this</span>); |
---|
| 205 | 00199 |
---|
| 206 | 00200 <a class="code" href="classG4UIWin32.html#r0">interactorManager</a> = <a class="code" href="classG4Win32.html#e0">G4Win32::getInstance</a> (); |
---|
| 207 | 00201 <span class="keyword">static</span> G4bool Done = FALSE; |
---|
| 208 | 00202 <span class="keywordflow">if</span>(Done==FALSE) { |
---|
| 209 | 00203 WNDCLASS wc; |
---|
| 210 | 00204 wc.style = CS_HREDRAW | CS_VREDRAW; |
---|
| 211 | 00205 wc.lpfnWndProc = (WNDPROC)<a class="code" href="classG4UIWin32.html#h0">G4UIWin32::MainWindowProc</a>; |
---|
| 212 | 00206 wc.cbClsExtra = 0; |
---|
| 213 | 00207 wc.cbWndExtra = 0; |
---|
| 214 | 00208 wc.hInstance = ::GetModuleHandle(NULL); |
---|
| 215 | 00209 wc.hIcon = LoadIcon(NULL,IDI_APPLICATION); |
---|
| 216 | 00210 wc.hCursor = LoadCursor(NULL,IDC_ARROW); |
---|
| 217 | 00211 wc.hbrBackground = GetStockBrush(WHITE_BRUSH); |
---|
| 218 | 00212 wc.lpszMenuName = <a class="code" href="G4UIWin32_8cc.html#a0">mainClassName</a>; |
---|
| 219 | 00213 wc.lpszClassName = <a class="code" href="G4UIWin32_8cc.html#a0">mainClassName</a>; |
---|
| 220 | 00214 ::RegisterClass (&wc); |
---|
| 221 | 00215 |
---|
| 222 | 00216 wc.style = CS_HREDRAW | CS_VREDRAW; |
---|
| 223 | 00217 wc.lpfnWndProc = (WNDPROC)<a class="code" href="classG4UIWin32.html#h1">G4UIWin32::TextWindowProc</a>; |
---|
| 224 | 00218 wc.cbClsExtra = 0; |
---|
| 225 | 00219 wc.cbWndExtra = 0; |
---|
| 226 | 00220 wc.hInstance = ::GetModuleHandle(NULL); |
---|
| 227 | 00221 wc.hIcon = LoadIcon(NULL,IDI_APPLICATION); |
---|
| 228 | 00222 wc.hCursor = LoadCursor(NULL,IDC_ARROW); |
---|
| 229 | 00223 wc.hbrBackground = GetStockBrush(WHITE_BRUSH); |
---|
| 230 | 00224 wc.lpszMenuName = <a class="code" href="G4UIWin32_8cc.html#a1">textClassName</a>; |
---|
| 231 | 00225 wc.lpszClassName = <a class="code" href="G4UIWin32_8cc.html#a1">textClassName</a>; |
---|
| 232 | 00226 ::RegisterClass (&wc); |
---|
| 233 | 00227 Done = TRUE; |
---|
| 234 | 00228 } |
---|
| 235 | 00229 |
---|
| 236 | 00230 <a class="code" href="classG4UIWin32.html#r4">menuBar</a> = CreateMenu(); |
---|
| 237 | 00231 <a class="code" href="classG4UIWin32.html#r5">defaultMenu</a> = CreatePopupMenu(); |
---|
| 238 | 00232 AppendMenu(<a class="code" href="classG4UIWin32.html#r4">menuBar</a>,MF_POPUP,(UINT)<a class="code" href="classG4UIWin32.html#r5">defaultMenu</a>,<span class="stringliteral">"Geant4"</span>); |
---|
| 239 | 00233 |
---|
| 240 | 00234 <a class="code" href="classG4UIWin32.html#r7">textBuffer</a> = <span class="keyword">new</span> <a class="code" href="classTextBuffer.html">TextBuffer</a>(); |
---|
| 241 | 00235 |
---|
| 242 | 00236 <a class="code" href="G4UIWin32_8cc.html#a5">tmpSession</a> = <span class="keyword">this</span>; |
---|
| 243 | 00237 <a class="code" href="classG4UIWin32.html#r1">mainWindow</a> = ::CreateWindow(<a class="code" href="G4UIWin32_8cc.html#a0">mainClassName</a>,<a class="code" href="G4UIWin32_8cc.html#a0">mainClassName</a>, |
---|
| 244 | 00238 WS_OVERLAPPEDWINDOW, |
---|
| 245 | 00239 CW_USEDEFAULT,CW_USEDEFAULT, |
---|
| 246 | 00240 0,0, |
---|
| 247 | 00241 NULL,<a class="code" href="classG4UIWin32.html#r4">menuBar</a>, |
---|
| 248 | 00242 ::GetModuleHandle(NULL), |
---|
| 249 | 00243 NULL); |
---|
| 250 | 00244 <a class="code" href="G4UIWin32_8cc.html#a5">tmpSession</a> = NULL; |
---|
| 251 | 00245 ::SetWindowLong(<a class="code" href="classG4UIWin32.html#r1">mainWindow</a>,GWL_USERDATA,LONG(<span class="keyword">this</span>)); |
---|
| 252 | 00246 |
---|
| 253 | 00247 ::SetForegroundWindow(<a class="code" href="classG4UIWin32.html#r1">mainWindow</a>); |
---|
| 254 | 00248 ::ShowWindow(<a class="code" href="classG4UIWin32.html#r1">mainWindow</a>,SW_SHOWDEFAULT); |
---|
| 255 | 00249 ::UpdateWindow(<a class="code" href="classG4UIWin32.html#r1">mainWindow</a>); |
---|
| 256 | 00250 |
---|
| 257 | 00251 <span class="keywordflow">if</span>(UI!=NULL) UI->SetCoutDestination(<span class="keyword">this</span>); |
---|
| 258 | 00252 } |
---|
| 259 | 00253 <span class="comment">/***************************************************************************/</span> |
---|
| 260 | <a name="l00254"></a><a class="code" href="classG4UIWin32.html#a4">00254</a> <a class="code" href="classG4UIWin32.html#a4">G4UIWin32::~G4UIWin32</a> ( |
---|
| 261 | 00255 ) |
---|
| 262 | 00256 <span class="comment">/***************************************************************************/</span> |
---|
| 263 | 00258 { |
---|
| 264 | 00259 G4UImanager* UI = G4UImanager::GetUIpointer(); |
---|
| 265 | 00260 <span class="keywordflow">if</span>(UI!=NULL) { |
---|
| 266 | 00261 UI->SetSession(NULL); |
---|
| 267 | 00262 UI->SetCoutDestination(NULL); |
---|
| 268 | 00263 } |
---|
| 269 | 00264 <span class="keyword">delete</span> <a class="code" href="classG4UIWin32.html#r7">textBuffer</a>; |
---|
| 270 | 00265 <span class="keywordflow">if</span>(<a class="code" href="classG4UIWin32.html#r2">textWindow</a>!=NULL) ::SetWindowLong(<a class="code" href="classG4UIWin32.html#r2">textWindow</a>,GWL_USERDATA,LONG(NULL)); |
---|
| 271 | 00266 <span class="keywordflow">if</span>(<a class="code" href="classG4UIWin32.html#r1">mainWindow</a>!=NULL) { |
---|
| 272 | 00267 ::SetWindowLong(<a class="code" href="classG4UIWin32.html#r1">mainWindow</a>,GWL_USERDATA,LONG(NULL)); |
---|
| 273 | 00268 ::DestroyWindow(<a class="code" href="classG4UIWin32.html#r1">mainWindow</a>); |
---|
| 274 | 00269 } |
---|
| 275 | 00270 } |
---|
| 276 | 00271 <span class="comment">/***************************************************************************/</span> |
---|
| 277 | <a name="l00272"></a><a class="code" href="classG4UIWin32.html#a1">00272</a> G4UIsession* <a class="code" href="classG4UIWin32.html#a1">G4UIWin32::SessionStart</a> ( |
---|
| 278 | 00273 ) |
---|
| 279 | 00274 <span class="comment">/***************************************************************************/</span> |
---|
| 280 | 00276 { |
---|
| 281 | 00277 <span class="keywordflow">if</span>(<a class="code" href="classG4UIWin32.html#r0">interactorManager</a>==NULL) <span class="keywordflow">return</span> <span class="keyword">this</span>; |
---|
| 282 | 00278 <a class="code" href="classG4UIWin32.html#a5">Prompt</a> (<span class="stringliteral">"session"</span>); |
---|
| 283 | 00279 <a class="code" href="G4UIWin32_8cc.html#a2">exitSession</a> = <span class="keyword">false</span>; |
---|
| 284 | 00280 <a class="code" href="classG4UIWin32.html#r0">interactorManager</a>-><a class="code" href="classG4VInteractorManager.html#a13">DisableSecondaryLoop</a> (); |
---|
| 285 | 00281 <span class="keywordtype">void</span>* event; |
---|
| 286 | 00282 <span class="keywordflow">while</span>((event = <a class="code" href="classG4UIWin32.html#r0">interactorManager</a>-><a class="code" href="classG4VInteractorManager.html#a22">GetEvent</a>())!=NULL) { |
---|
| 287 | 00283 <a class="code" href="classG4UIWin32.html#r0">interactorManager</a>-><a class="code" href="classG4VInteractorManager.html#a17">DispatchEvent</a>(event); |
---|
| 288 | 00284 <span class="keywordflow">if</span>(<a class="code" href="G4UIWin32_8cc.html#a2">exitSession</a>==<span class="keyword">true</span>) <span class="keywordflow">break</span>; |
---|
| 289 | 00285 } |
---|
| 290 | 00286 <a class="code" href="classG4UIWin32.html#r0">interactorManager</a>-><a class="code" href="classG4VInteractorManager.html#a12">EnableSecondaryLoop</a> (); |
---|
| 291 | 00287 <span class="keywordflow">return</span> <span class="keyword">this</span>; |
---|
| 292 | 00288 } |
---|
| 293 | 00289 <span class="comment">/***************************************************************************/</span> |
---|
| 294 | <a name="l00290"></a><a class="code" href="classG4UIWin32.html#a5">00290</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIWin32.html#a5">G4UIWin32::Prompt</a> ( |
---|
| 295 | 00291 G4String a_prompt |
---|
| 296 | 00292 ) |
---|
| 297 | 00293 <span class="comment">/***************************************************************************/</span> |
---|
| 298 | 00295 { |
---|
| 299 | 00296 } |
---|
| 300 | 00297 <span class="comment">/***************************************************************************/</span> |
---|
| 301 | <a name="l00298"></a><a class="code" href="classG4UIWin32.html#a6">00298</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIWin32.html#a6">G4UIWin32::SessionTerminate</a> ( |
---|
| 302 | 00299 ) |
---|
| 303 | 00300 <span class="comment">/***************************************************************************/</span> |
---|
| 304 | 00302 { |
---|
| 305 | 00303 } |
---|
| 306 | 00304 <span class="comment">/***************************************************************************/</span> |
---|
| 307 | <a name="l00305"></a><a class="code" href="classG4UIWin32.html#a7">00305</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIWin32.html#a7">G4UIWin32::PauseSessionStart</a> ( |
---|
| 308 | 00306 G4String a_state |
---|
| 309 | 00307 ) |
---|
| 310 | 00308 <span class="comment">/***************************************************************************/</span> |
---|
| 311 | 00310 { |
---|
| 312 | 00311 <span class="keywordflow">if</span>(a_state==<span class="stringliteral">"G4_pause> "</span>) { |
---|
| 313 | 00312 <a class="code" href="classG4UIWin32.html#d0">SecondaryLoop</a> (<span class="stringliteral">"Pause, type continue to exit this state"</span>); |
---|
| 314 | 00313 } |
---|
| 315 | 00314 |
---|
| 316 | 00315 <span class="keywordflow">if</span>(a_state==<span class="stringliteral">"EndOfEvent"</span>) { |
---|
| 317 | 00316 <span class="comment">// Picking with feed back in event data Done here !!!</span> |
---|
| 318 | 00317 <a class="code" href="classG4UIWin32.html#d0">SecondaryLoop</a> (<span class="stringliteral">"End of event, type continue to exit this state"</span>); |
---|
| 319 | 00318 } |
---|
| 320 | 00319 } |
---|
| 321 | 00320 <span class="comment">/***************************************************************************/</span> |
---|
| 322 | <a name="l00321"></a><a class="code" href="classG4UIWin32.html#d0">00321</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIWin32.html#d0">G4UIWin32::SecondaryLoop</a> ( |
---|
| 323 | 00322 G4String a_prompt |
---|
| 324 | 00323 ) |
---|
| 325 | 00324 <span class="comment">/***************************************************************************/</span> |
---|
| 326 | 00326 { |
---|
| 327 | 00327 <span class="keywordflow">if</span>(<a class="code" href="classG4UIWin32.html#r0">interactorManager</a>==NULL) <span class="keywordflow">return</span>; |
---|
| 328 | 00328 <a class="code" href="classG4UIWin32.html#a5">Prompt</a>(a_prompt); |
---|
| 329 | 00329 <a class="code" href="G4UIWin32_8cc.html#a3">exitPause</a> = <span class="keyword">false</span>; |
---|
| 330 | 00330 <span class="keywordtype">void</span>* event; |
---|
| 331 | 00331 <span class="keywordflow">while</span>((event = <a class="code" href="classG4UIWin32.html#r0">interactorManager</a>-><a class="code" href="classG4VInteractorManager.html#a22">GetEvent</a>())!=NULL) { |
---|
| 332 | 00332 <a class="code" href="classG4UIWin32.html#r0">interactorManager</a>-><a class="code" href="classG4VInteractorManager.html#a17">DispatchEvent</a>(event); |
---|
| 333 | 00333 <span class="keywordflow">if</span>(<a class="code" href="G4UIWin32_8cc.html#a3">exitPause</a>==<span class="keyword">true</span>) <span class="keywordflow">break</span>; |
---|
| 334 | 00334 } |
---|
| 335 | 00335 <a class="code" href="classG4UIWin32.html#a5">Prompt</a>(<span class="stringliteral">"session"</span>); |
---|
| 336 | 00336 } |
---|
| 337 | 00337 <span class="comment">/***************************************************************************/</span> |
---|
| 338 | <a name="l00338"></a><a class="code" href="classG4UIWin32.html#a8">00338</a> G4int <a class="code" href="classG4UIWin32.html#a8">G4UIWin32::ReceiveG4cout</a> ( |
---|
| 339 | 00339 G4String a_string |
---|
| 340 | 00340 ) |
---|
| 341 | 00341 <span class="comment">/***************************************************************************/</span> |
---|
| 342 | 00343 { |
---|
| 343 | 00344 <a class="code" href="classG4UIWin32.html#a11">TextAppendString</a>((<span class="keywordtype">char</span>*)a_string.data()); |
---|
| 344 | 00345 <span class="keywordflow">return</span> 0; |
---|
| 345 | 00346 } |
---|
| 346 | 00347 <span class="comment">/***************************************************************************/</span> |
---|
| 347 | <a name="l00348"></a><a class="code" href="classG4UIWin32.html#a9">00348</a> G4int <a class="code" href="classG4UIWin32.html#a9">G4UIWin32::ReceiveG4cerr</a> ( |
---|
| 348 | 00349 G4String a_string |
---|
| 349 | 00350 ) |
---|
| 350 | 00351 <span class="comment">/***************************************************************************/</span> |
---|
| 351 | 00353 { |
---|
| 352 | 00354 <a class="code" href="classG4UIWin32.html#a11">TextAppendString</a>((<span class="keywordtype">char</span>*)a_string.data()); |
---|
| 353 | 00355 <span class="keywordflow">return</span> 0; |
---|
| 354 | 00356 } |
---|
| 355 | 00357 <span class="comment">/***************************************************************************/</span> |
---|
| 356 | <a name="l00358"></a><a class="code" href="classG4UIWin32.html#d1">00358</a> G4bool <a class="code" href="classG4UIWin32.html#d1">G4UIWin32::GetHelpChoice</a>( |
---|
| 357 | 00359 G4int& aInt |
---|
| 358 | 00360 ) |
---|
| 359 | 00361 <span class="comment">/***************************************************************************/</span> |
---|
| 360 | 00363 { |
---|
| 361 | 00364 <a class="code" href="classG4UIWin32.html#r10">fHelp</a> = <span class="keyword">true</span>; |
---|
| 362 | 00365 <span class="comment">//</span> |
---|
| 363 | 00366 <span class="keywordflow">if</span>(<a class="code" href="classG4UIWin32.html#r0">interactorManager</a>==NULL) <span class="keywordflow">return</span> <span class="keyword">false</span>; |
---|
| 364 | 00367 <a class="code" href="classG4UIWin32.html#a5">Prompt</a>(<span class="stringliteral">"Help"</span>); |
---|
| 365 | 00368 <a class="code" href="G4UIWin32_8cc.html#a4">exitHelp</a> = <span class="keyword">false</span>; |
---|
| 366 | 00369 <span class="keywordtype">void</span>* event; |
---|
| 367 | 00370 <span class="keywordflow">while</span>((event = <a class="code" href="classG4UIWin32.html#r0">interactorManager</a>-><a class="code" href="classG4VInteractorManager.html#a22">GetEvent</a>())!=NULL) { |
---|
| 368 | 00371 <a class="code" href="classG4UIWin32.html#r0">interactorManager</a>-><a class="code" href="classG4VInteractorManager.html#a17">DispatchEvent</a>(event); |
---|
| 369 | 00372 <span class="keywordflow">if</span>(<a class="code" href="G4UIWin32_8cc.html#a4">exitHelp</a>==<span class="keyword">true</span>) <span class="keywordflow">break</span>; |
---|
| 370 | 00373 } |
---|
| 371 | 00374 <a class="code" href="classG4UIWin32.html#a5">Prompt</a>(<span class="stringliteral">"session"</span>); |
---|
| 372 | 00375 <span class="comment">//</span> |
---|
| 373 | 00376 <span class="keywordflow">if</span>(<a class="code" href="classG4UIWin32.html#r10">fHelp</a>==<span class="keyword">false</span>) <span class="keywordflow">return</span> <span class="keyword">false</span>; |
---|
| 374 | 00377 aInt = <a class="code" href="classG4UIWin32.html#r11">fHelpChoice</a>; |
---|
| 375 | 00378 <a class="code" href="classG4UIWin32.html#r10">fHelp</a> = <span class="keyword">false</span>; |
---|
| 376 | 00379 <span class="keywordflow">return</span> <span class="keyword">true</span>; |
---|
| 377 | 00380 } |
---|
| 378 | 00381 <span class="comment">/***************************************************************************/</span> |
---|
| 379 | <a name="l00382"></a><a class="code" href="classG4UIWin32.html#d2">00382</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIWin32.html#d2">G4UIWin32::ExitHelp</a>( |
---|
| 380 | 00383 ) |
---|
| 381 | 00384 <span class="comment">/***************************************************************************/</span> |
---|
| 382 | 00386 { |
---|
| 383 | 00387 } |
---|
| 384 | 00388 <span class="comment">/***************************************************************************/</span> |
---|
| 385 | <a name="l00389"></a><a class="code" href="classG4UIWin32.html#a2">00389</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIWin32.html#a2">G4UIWin32::AddMenu</a> ( |
---|
| 386 | 00390 <span class="keyword">const</span> <span class="keywordtype">char</span>* a_name |
---|
| 387 | 00391 ,<span class="keyword">const</span> <span class="keywordtype">char</span>* a_label |
---|
| 388 | 00392 ) |
---|
| 389 | 00393 <span class="comment">/***************************************************************************/</span> |
---|
| 390 | 00395 { |
---|
| 391 | 00396 <span class="keywordflow">if</span>(a_name==NULL) <span class="keywordflow">return</span>; |
---|
| 392 | 00397 <span class="keywordflow">if</span>(<a class="code" href="classG4UIWin32.html#r5">defaultMenu</a>!=NULL) { |
---|
| 393 | 00398 DeleteMenu (<a class="code" href="classG4UIWin32.html#r4">menuBar</a>,0,MF_BYPOSITION); |
---|
| 394 | 00399 <a class="code" href="classG4UIWin32.html#r5">defaultMenu</a> = NULL; |
---|
| 395 | 00400 } |
---|
| 396 | 00401 HMENU hMenu = CreatePopupMenu(); |
---|
| 397 | 00402 AppendMenu(<a class="code" href="classG4UIWin32.html#r4">menuBar</a>,MF_POPUP,(UINT)hMenu,a_label); |
---|
| 398 | 00403 <a class="code" href="classG4VInteractiveSession.html#a4">AddInteractor</a>(a_name,(<a class="code" href="G4VInteractorManager_8hh.html#a0">G4Interactor</a>)hMenu); |
---|
| 399 | 00404 DrawMenuBar(<a class="code" href="classG4UIWin32.html#r1">mainWindow</a>); |
---|
| 400 | 00405 } |
---|
| 401 | 00406 <span class="comment">/***************************************************************************/</span> |
---|
| 402 | <a name="l00407"></a><a class="code" href="classG4UIWin32.html#a3">00407</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIWin32.html#a3">G4UIWin32::AddButton</a> ( |
---|
| 403 | 00408 <span class="keyword">const</span> <span class="keywordtype">char</span>* a_menu |
---|
| 404 | 00409 ,<span class="keyword">const</span> <span class="keywordtype">char</span>* a_label |
---|
| 405 | 00410 ,<span class="keyword">const</span> <span class="keywordtype">char</span>* a_command |
---|
| 406 | 00411 ) |
---|
| 407 | 00412 <span class="comment">/***************************************************************************/</span> |
---|
| 408 | 00414 { |
---|
| 409 | 00415 <span class="keywordflow">if</span>(a_menu==NULL) <span class="keywordflow">return</span>; |
---|
| 410 | 00416 <span class="keywordflow">if</span>(a_label==NULL) <span class="keywordflow">return</span>; |
---|
| 411 | 00417 <span class="keywordflow">if</span>(a_command==NULL) <span class="keywordflow">return</span>; |
---|
| 412 | 00418 HMENU hMenu = (HMENU)<a class="code" href="classG4VInteractiveSession.html#a5">GetInteractor</a>(a_menu); |
---|
| 413 | 00419 <a class="code" href="G4UIWin32_8cc.html#a7">actionIdentifier</a>++; |
---|
| 414 | 00420 <a class="code" href="classG4UIWin32.html#r6">commands</a>[<a class="code" href="G4UIWin32_8cc.html#a7">actionIdentifier</a>] = a_command; |
---|
| 415 | 00421 AppendMenu (hMenu,MF_STRING,<a class="code" href="G4UIWin32_8cc.html#a7">actionIdentifier</a>,a_label); |
---|
| 416 | 00422 } |
---|
| 417 | 00423 <span class="comment">/***************************************************************************/</span> |
---|
| 418 | <a name="l00424"></a><a class="code" href="classG4UIWin32.html#a10">00424</a> G4String <a class="code" href="classG4UIWin32.html#a10">G4UIWin32::GetCommand</a> ( |
---|
| 419 | 00425 <span class="keywordtype">int</span> a_id |
---|
| 420 | 00426 ) |
---|
| 421 | 00427 <span class="comment">/***************************************************************************/</span> |
---|
| 422 | 00429 { |
---|
| 423 | 00430 <span class="keywordflow">return</span> <a class="code" href="classG4UIWin32.html#r6">commands</a>[a_id]; |
---|
| 424 | 00431 } |
---|
| 425 | 00432 <span class="comment">/***************************************************************************/</span> |
---|
| 426 | 00433 <span class="comment">/***************************************************************************/</span> |
---|
| 427 | 00434 <span class="comment">/***************************************************************************/</span> |
---|
| 428 | <a name="l00435"></a><a class="code" href="classG4UIWin32.html#h0">00435</a> LRESULT CALLBACK <a class="code" href="classG4UIWin32.html#h0">G4UIWin32::MainWindowProc</a> ( |
---|
| 429 | 00436 HWND a_window |
---|
| 430 | 00437 ,UINT a_message |
---|
| 431 | 00438 ,WPARAM a_wParam |
---|
| 432 | 00439 ,LPARAM a_lParam |
---|
| 433 | 00440 ) |
---|
| 434 | 00441 <span class="comment">/***************************************************************************/</span> |
---|
| 435 | 00443 { |
---|
| 436 | 00444 <span class="keyword">static</span> <span class="keywordtype">short</span> charWidth,charHeight; |
---|
| 437 | 00445 |
---|
| 438 | 00446 <span class="keywordflow">switch</span> (a_message) { |
---|
| 439 | 00447 <span class="keywordflow">case</span> WM_CREATE:{ |
---|
| 440 | 00448 HDC hdc; |
---|
| 441 | 00449 TEXTMETRIC tm; |
---|
| 442 | 00450 RECT rect; |
---|
| 443 | 00451 GetWindowRect (a_window,&rect); |
---|
| 444 | 00452 |
---|
| 445 | 00453 hdc = GetDC (a_window); |
---|
| 446 | 00454 GetTextMetrics (hdc,&tm); |
---|
| 447 | 00455 charWidth = (<span class="keywordtype">short</span>)tm.tmAveCharWidth; |
---|
| 448 | 00456 charHeight = (<span class="keywordtype">short</span>)(tm.tmHeight + tm.tmExternalLeading); |
---|
| 449 | 00457 ReleaseDC (a_window,hdc); |
---|
| 450 | 00458 |
---|
| 451 | 00459 <a class="code" href="classG4UIWin32.html">G4UIWin32</a>* This = (<a class="code" href="classG4UIWin32.html">G4UIWin32</a>*)<a class="code" href="G4UIWin32_8cc.html#a5">tmpSession</a>; |
---|
| 452 | 00460 <span class="keywordflow">if</span>(This!=NULL) { |
---|
| 453 | 00461 This-><a class="code" href="classG4UIWin32.html#r2">textWindow</a> = CreateWindow (<a class="code" href="G4UIWin32_8cc.html#a1">textClassName</a>,NULL, |
---|
| 454 | 00462 WS_CHILD | WS_VISIBLE | WS_VSCROLL, |
---|
| 455 | 00463 0,0, |
---|
| 456 | 00464 This-><a class="code" href="classG4UIWin32.html#r9">textCols</a> * charWidth, |
---|
| 457 | 00465 This-><a class="code" href="classG4UIWin32.html#r8">textRows</a> * charHeight, |
---|
| 458 | 00466 a_window,NULL, |
---|
| 459 | 00467 GetWindowInstance(a_window), |
---|
| 460 | 00468 NULL); |
---|
| 461 | 00469 ::SetWindowLong (This-><a class="code" href="classG4UIWin32.html#r2">textWindow</a>,GWL_USERDATA,LONG(This)); |
---|
| 462 | 00470 |
---|
| 463 | 00471 This-><a class="code" href="classG4UIWin32.html#r3">editWindow</a> = CreateWindow (<span class="stringliteral">"edit"</span>,NULL, |
---|
| 464 | 00472 WS_CHILD | WS_VISIBLE | WS_BORDER, |
---|
| 465 | 00473 0,This-><a class="code" href="classG4UIWin32.html#r8">textRows</a> * charHeight, |
---|
| 466 | 00474 This-><a class="code" href="classG4UIWin32.html#r9">textCols</a> * charWidth,charHeight, |
---|
| 467 | 00475 a_window,(HMENU)1, |
---|
| 468 | 00476 GetWindowInstance(a_window), |
---|
| 469 | 00477 NULL); |
---|
| 470 | 00478 <a class="code" href="G4UIWin32_8cc.html#a6">oldEditWindowProc</a> = (WNDPROC)GetWindowLong(This-><a class="code" href="classG4UIWin32.html#r3">editWindow</a>,GWL_WNDPROC); |
---|
| 471 | 00479 SetWindowLong (This-><a class="code" href="classG4UIWin32.html#r3">editWindow</a>,GWL_WNDPROC,(LONG)<a class="code" href="classG4UIWin32.html#h2">EditWindowProc</a>); |
---|
| 472 | 00480 |
---|
| 473 | 00481 MoveWindow (a_window, |
---|
| 474 | 00482 rect.left,rect.top, |
---|
| 475 | 00483 2 * GetSystemMetrics(SM_CXFRAME) + |
---|
| 476 | 00484 This-><a class="code" href="classG4UIWin32.html#r9">textCols</a> * charWidth, |
---|
| 477 | 00485 GetSystemMetrics(SM_CYCAPTION) + |
---|
| 478 | 00486 2 * GetSystemMetrics(SM_CYFRAME) + |
---|
| 479 | 00487 This-><a class="code" href="classG4UIWin32.html#r8">textRows</a> * charHeight + charHeight, |
---|
| 480 | 00488 TRUE); |
---|
| 481 | 00489 } |
---|
| 482 | 00490 }<span class="keywordflow">return</span> 0; |
---|
| 483 | 00491 <span class="keywordflow">case</span> WM_SIZE:{ |
---|
| 484 | 00492 <a class="code" href="classG4UIWin32.html">G4UIWin32</a>* This = (<a class="code" href="classG4UIWin32.html">G4UIWin32</a>*)::GetWindowLong(a_window,GWL_USERDATA); |
---|
| 485 | 00493 <span class="keywordflow">if</span>(This!=NULL) { |
---|
| 486 | 00494 <span class="comment">// Client size :</span> |
---|
| 487 | 00495 <span class="keywordtype">int</span> width = LOWORD(a_lParam); |
---|
| 488 | 00496 <span class="keywordtype">int</span> height = HIWORD(a_lParam); |
---|
| 489 | 00497 <span class="keywordtype">int</span> editHeight = <span class="comment">/*2 * GetSystemMetrics(SM_CYBORDER) + */</span> charHeight; |
---|
| 490 | 00498 MoveWindow (This-><a class="code" href="classG4UIWin32.html#r2">textWindow</a>, |
---|
| 491 | 00499 0,0, |
---|
| 492 | 00500 width,height - editHeight, |
---|
| 493 | 00501 FALSE); |
---|
| 494 | 00502 MoveWindow (This-><a class="code" href="classG4UIWin32.html#r3">editWindow</a>, |
---|
| 495 | 00503 0,height - editHeight, |
---|
| 496 | 00504 width,charHeight, |
---|
| 497 | 00505 FALSE); |
---|
| 498 | 00506 ((<a class="code" href="classTextBuffer.html">TextBuffer</a>*)This-><a class="code" href="classG4UIWin32.html#r7">textBuffer</a>)->SetHeightOfPage(height/charHeight); |
---|
| 499 | 00507 } |
---|
| 500 | 00508 }<span class="keywordflow">return</span> 0; |
---|
| 501 | 00509 <span class="keywordflow">case</span> WM_SETFOCUS:{ |
---|
| 502 | 00510 <a class="code" href="classG4UIWin32.html">G4UIWin32</a>* This = (<a class="code" href="classG4UIWin32.html">G4UIWin32</a>*)::GetWindowLong(a_window,GWL_USERDATA); |
---|
| 503 | 00511 <span class="keywordflow">if</span>(This!=NULL) SetFocus (This-><a class="code" href="classG4UIWin32.html#r3">editWindow</a>); |
---|
| 504 | 00512 }<span class="keywordflow">return</span> 0; |
---|
| 505 | 00513 <span class="keywordflow">case</span> WM_COMMAND:{ |
---|
| 506 | 00514 <a class="code" href="classG4UIWin32.html">G4UIWin32</a>* This = (<a class="code" href="classG4UIWin32.html">G4UIWin32</a>*)::GetWindowLong(a_window,GWL_USERDATA); |
---|
| 507 | 00515 <span class="keywordflow">if</span>(This!=NULL) { |
---|
| 508 | 00516 <span class="keywordflow">if</span>(This-><a class="code" href="classG4UIWin32.html#r10">fHelp</a>==<span class="keyword">false</span>) { |
---|
| 509 | 00517 G4String command = This-><a class="code" href="classG4UIWin32.html#a10">GetCommand</a>(a_wParam); |
---|
| 510 | 00518 This-><a class="code" href="classG4VBasicShell.html#b10">ApplyShellCommand</a> (command,<a class="code" href="G4UIWin32_8cc.html#a2">exitSession</a>,<a class="code" href="G4UIWin32_8cc.html#a3">exitPause</a>); |
---|
| 511 | 00519 } |
---|
| 512 | 00520 } |
---|
| 513 | 00521 }<span class="keywordflow">return</span> 0; |
---|
| 514 | 00522 <span class="keywordflow">case</span> WM_DESTROY: |
---|
| 515 | 00523 PostQuitMessage(0); |
---|
| 516 | 00524 <span class="keywordflow">return</span> 0; |
---|
| 517 | 00525 } |
---|
| 518 | 00526 <span class="keywordflow">return</span> (DefWindowProc(a_window,a_message,a_wParam,a_lParam)); |
---|
| 519 | 00527 } |
---|
| 520 | 00528 <span class="comment">/***************************************************************************/</span> |
---|
| 521 | <a name="l00529"></a><a class="code" href="classG4UIWin32.html#h1">00529</a> LRESULT CALLBACK <a class="code" href="classG4UIWin32.html#h1">G4UIWin32::TextWindowProc</a> ( |
---|
| 522 | 00530 HWND a_window |
---|
| 523 | 00531 ,UINT a_message |
---|
| 524 | 00532 ,WPARAM a_wParam |
---|
| 525 | 00533 ,LPARAM a_lParam |
---|
| 526 | 00534 ) |
---|
| 527 | 00535 <span class="comment">/***************************************************************************/</span> |
---|
| 528 | 00537 { |
---|
| 529 | 00538 <span class="keywordflow">switch</span> (a_message) { |
---|
| 530 | 00539 <span class="keywordflow">case</span> WM_PAINT:{ |
---|
| 531 | 00540 <a class="code" href="classG4UIWin32.html">G4UIWin32</a>* This = (<a class="code" href="classG4UIWin32.html">G4UIWin32</a>*)::GetWindowLong(a_window,GWL_USERDATA); |
---|
| 532 | 00541 <span class="keywordflow">if</span>(This!=NULL) { |
---|
| 533 | 00542 <a class="code" href="classTextBuffer.html">TextBuffer</a>* <a class="code" href="classG4UIWin32.html#r7">textBuffer</a> = (<a class="code" href="classTextBuffer.html">TextBuffer</a>*)This-><a class="code" href="classG4UIWin32.html#r7">textBuffer</a>; |
---|
| 534 | 00543 RECT rect; |
---|
| 535 | 00544 GetClientRect (a_window,&rect); |
---|
| 536 | 00545 PAINTSTRUCT ps; |
---|
| 537 | 00546 HDC hdc = BeginPaint(a_window,&ps); |
---|
| 538 | 00547 textBuffer-><a class="code" href="classTextBuffer.html#a11">Draw</a>(hdc,&rect); |
---|
| 539 | 00548 EndPaint(a_window,&ps); |
---|
| 540 | 00549 } |
---|
| 541 | 00550 }<span class="keywordflow">return</span> 0; |
---|
| 542 | 00551 <span class="keywordflow">case</span> WM_VSCROLL:{ |
---|
| 543 | 00552 <a class="code" href="classG4UIWin32.html">G4UIWin32</a>* This = (<a class="code" href="classG4UIWin32.html">G4UIWin32</a>*)::GetWindowLong(a_window,GWL_USERDATA); |
---|
| 544 | 00553 <span class="keywordflow">if</span>(This!=NULL) { |
---|
| 545 | 00554 <a class="code" href="classTextBuffer.html">TextBuffer</a>* <a class="code" href="classG4UIWin32.html#r7">textBuffer</a> = (<a class="code" href="classTextBuffer.html">TextBuffer</a>*)This-><a class="code" href="classG4UIWin32.html#r7">textBuffer</a>; |
---|
| 546 | 00555 <span class="keywordtype">int</span> what = LOWORD(a_wParam); |
---|
| 547 | 00556 <span class="keywordflow">switch</span>(what) { |
---|
| 548 | 00557 <span class="keywordflow">case</span> SB_LINEUP: |
---|
| 549 | 00558 textBuffer-><a class="code" href="classTextBuffer.html#a7">DecrementEndOfPage</a>(); |
---|
| 550 | 00559 <span class="keywordflow">break</span>; |
---|
| 551 | 00560 <span class="keywordflow">case</span> SB_LINEDOWN: |
---|
| 552 | 00561 textBuffer-><a class="code" href="classTextBuffer.html#a6">IncrementEndOfPage</a>(); |
---|
| 553 | 00562 <span class="keywordflow">break</span>; |
---|
| 554 | 00563 <span class="keywordflow">case</span> SB_PAGEUP: |
---|
| 555 | 00564 textBuffer-><a class="code" href="classTextBuffer.html#a9">JumpUpEndOfPage</a>(); |
---|
| 556 | 00565 <span class="keywordflow">break</span>; |
---|
| 557 | 00566 <span class="keywordflow">case</span> SB_PAGEDOWN: |
---|
| 558 | 00567 textBuffer-><a class="code" href="classTextBuffer.html#a8">JumpDownEndOfPage</a>(); |
---|
| 559 | 00568 <span class="keywordflow">break</span>; |
---|
| 560 | 00569 <span class="keywordflow">case</span> SB_THUMBPOSITION: |
---|
| 561 | 00570 <span class="keywordflow">case</span> SB_THUMBTRACK: |
---|
| 562 | 00571 textBuffer-><a class="code" href="classTextBuffer.html#a4">SetEndOfPage</a>(HIWORD(a_wParam)); |
---|
| 563 | 00572 <span class="keywordflow">break</span>; |
---|
| 564 | 00573 <span class="keywordflow">default</span>: |
---|
| 565 | 00574 <span class="keywordflow">return</span> 0; |
---|
| 566 | 00575 } |
---|
| 567 | 00576 <span class="keywordtype">int</span> eop = textBuffer-><a class="code" href="classTextBuffer.html#a5">GetEndOfPage</a>(); |
---|
| 568 | 00577 SetScrollPos(a_window,SB_VERT,eop,TRUE); |
---|
| 569 | 00578 InvalidateRect(a_window,NULL,TRUE); |
---|
| 570 | 00579 }}<span class="keywordflow">return</span> 0; |
---|
| 571 | 00580 <span class="keywordflow">case</span> WM_DESTROY: |
---|
| 572 | 00581 PostQuitMessage(0); |
---|
| 573 | 00582 <span class="keywordflow">return</span> 0; |
---|
| 574 | 00583 } |
---|
| 575 | 00584 <span class="keywordflow">return</span> (DefWindowProc(a_window,a_message,a_wParam,a_lParam)); |
---|
| 576 | 00585 } |
---|
| 577 | 00586 <span class="comment">/***************************************************************************/</span> |
---|
| 578 | <a name="l00587"></a><a class="code" href="classG4UIWin32.html#h2">00587</a> LRESULT CALLBACK <a class="code" href="classG4UIWin32.html#h2">G4UIWin32::EditWindowProc</a> ( |
---|
| 579 | 00588 HWND a_window |
---|
| 580 | 00589 ,UINT a_message |
---|
| 581 | 00590 ,WPARAM a_wParam |
---|
| 582 | 00591 ,LPARAM a_lParam |
---|
| 583 | 00592 ) |
---|
| 584 | 00593 <span class="comment">/***************************************************************************/</span> |
---|
| 585 | 00595 { |
---|
| 586 | 00596 <span class="keywordflow">switch</span> (a_message) { |
---|
| 587 | 00597 <span class="keywordflow">case</span> WM_KEYDOWN: |
---|
| 588 | 00598 <span class="keywordflow">switch</span>(a_wParam){ |
---|
| 589 | 00599 <span class="keywordflow">case</span> VK_RETURN:{ |
---|
| 590 | 00600 <a class="code" href="classG4UIWin32.html">G4UIWin32</a>* This = (<a class="code" href="classG4UIWin32.html">G4UIWin32</a>*)::GetWindowLong( |
---|
| 591 | 00601 GetParent(a_window),GWL_USERDATA); |
---|
| 592 | 00602 <span class="keywordtype">char</span> buffer[128]; |
---|
| 593 | 00603 GetWindowText (a_window,buffer,128); |
---|
| 594 | 00604 G4String command (buffer); |
---|
| 595 | 00605 <span class="comment">//SetWindowText (a_window,"");</span> |
---|
| 596 | 00606 Edit_SetText(a_window,<span class="stringliteral">""</span>); |
---|
| 597 | 00607 Edit_SetSel(a_window,0,0); |
---|
| 598 | 00608 |
---|
| 599 | 00609 <span class="keywordflow">if</span>(This!=NULL) { |
---|
| 600 | 00610 <span class="keywordflow">if</span>(This-><a class="code" href="classG4UIWin32.html#r10">fHelp</a>==<span class="keyword">true</span>) { |
---|
| 601 | 00611 <a class="code" href="G4UIWin32_8cc.html#a4">exitHelp</a> = <span class="keyword">true</span>; |
---|
| 602 | 00612 This-><a class="code" href="classG4UIWin32.html#r10">fHelp</a> = <a class="code" href="G4UIXm_8cc.html#a6">ConvertStringToInt</a>(command.data(),This-><a class="code" href="classG4UIWin32.html#r11">fHelpChoice</a>); |
---|
| 603 | 00613 } <span class="keywordflow">else</span> { |
---|
| 604 | 00614 This-><a class="code" href="classG4UIWin32.html#r12">fHistory</a>.push_back(command); |
---|
| 605 | 00615 This-><a class="code" href="classG4UIWin32.html#r13">fHistoryPos</a> = -1; |
---|
| 606 | 00616 This-><a class="code" href="classG4VBasicShell.html#b10">ApplyShellCommand</a> (command,<a class="code" href="G4UIWin32_8cc.html#a2">exitSession</a>,<a class="code" href="G4UIWin32_8cc.html#a3">exitPause</a>); |
---|
| 607 | 00617 } |
---|
| 608 | 00618 } |
---|
| 609 | 00619 |
---|
| 610 | 00620 }<span class="keywordflow">break</span>; |
---|
| 611 | 00621 <span class="keywordflow">case</span> VK_TAB:{ |
---|
| 612 | 00622 <a class="code" href="classG4UIWin32.html">G4UIWin32</a>* This = (<a class="code" href="classG4UIWin32.html">G4UIWin32</a>*)::GetWindowLong( |
---|
| 613 | 00623 GetParent(a_window),GWL_USERDATA); |
---|
| 614 | 00624 <span class="keywordflow">if</span>( (This!=NULL) && (This-><a class="code" href="classG4UIWin32.html#r10">fHelp</a>==<span class="keyword">true</span>) ) <span class="keywordflow">break</span>; |
---|
| 615 | 00625 <span class="keywordtype">char</span> buffer[128]; |
---|
| 616 | 00626 Edit_GetText(a_window,buffer,128); |
---|
| 617 | 00627 |
---|
| 618 | 00628 G4String command(buffer); |
---|
| 619 | 00629 |
---|
| 620 | 00630 <span class="keywordflow">if</span>(This!=NULL) { |
---|
| 621 | 00631 G4String cmd = This-><a class="code" href="classG4VBasicShell.html#b5">Complete</a>(command); |
---|
| 622 | 00632 <span class="keyword">const</span> <span class="keywordtype">char</span>* d = cmd.data(); |
---|
| 623 | 00633 <span class="keywordtype">int</span> l = strlen(d); |
---|
| 624 | 00634 Edit_SetText(a_window,d); |
---|
| 625 | 00635 Edit_SetSel(a_window,l,l); |
---|
| 626 | 00636 } |
---|
| 627 | 00637 |
---|
| 628 | 00638 }<span class="keywordflow">break</span>; |
---|
| 629 | 00639 <span class="keywordflow">case</span> VK_UP:{ |
---|
| 630 | 00640 <a class="code" href="classG4UIWin32.html">G4UIWin32</a>* This = (<a class="code" href="classG4UIWin32.html">G4UIWin32</a>*)::GetWindowLong( |
---|
| 631 | 00641 GetParent(a_window),GWL_USERDATA); |
---|
| 632 | 00642 <span class="keywordflow">if</span>(This!=NULL) { |
---|
| 633 | 00643 <span class="keywordtype">int</span> pos = This-><a class="code" href="classG4UIWin32.html#r13">fHistoryPos</a>== -1 ? |
---|
| 634 | 00644 This-><a class="code" href="classG4UIWin32.html#r12">fHistory</a>.size()-1 : This-><a class="code" href="classG4UIWin32.html#r13">fHistoryPos</a>-1; |
---|
| 635 | 00645 <span class="keywordflow">if</span>((pos>=0)&&(pos<(<span class="keywordtype">int</span>)This-><a class="code" href="classG4UIWin32.html#r12">fHistory</a>.size())) { |
---|
| 636 | 00646 G4String command = This-><a class="code" href="classG4UIWin32.html#r12">fHistory</a>[pos]; |
---|
| 637 | 00647 <span class="keyword">const</span> <span class="keywordtype">char</span>* d = command.data(); |
---|
| 638 | 00648 <span class="keywordtype">int</span> l = strlen(d); |
---|
| 639 | 00649 Edit_SetText(a_window,d); |
---|
| 640 | 00650 Edit_SetSel(a_window,l,l); |
---|
| 641 | 00651 <span class="comment">//</span> |
---|
| 642 | 00652 This-><a class="code" href="classG4UIWin32.html#r13">fHistoryPos</a> = pos; |
---|
| 643 | 00653 } |
---|
| 644 | 00654 } |
---|
| 645 | 00655 }<span class="keywordflow">return</span> 0; <span class="comment">//Do not jump into oldEditProc.</span> |
---|
| 646 | 00656 <span class="keywordflow">case</span> VK_DOWN:{ |
---|
| 647 | 00657 <a class="code" href="classG4UIWin32.html">G4UIWin32</a>* This = (<a class="code" href="classG4UIWin32.html">G4UIWin32</a>*)::GetWindowLong( |
---|
| 648 | 00658 GetParent(a_window),GWL_USERDATA); |
---|
| 649 | 00659 <span class="keywordflow">if</span>(This!=NULL) { |
---|
| 650 | 00660 <span class="keywordtype">int</span> pos = This-><a class="code" href="classG4UIWin32.html#r13">fHistoryPos</a> + 1; |
---|
| 651 | 00661 <span class="keywordflow">if</span>((pos>=0)&&(pos<(<span class="keywordtype">int</span>)This-><a class="code" href="classG4UIWin32.html#r12">fHistory</a>.size())) { |
---|
| 652 | 00662 G4String command = This-><a class="code" href="classG4UIWin32.html#r12">fHistory</a>[pos]; |
---|
| 653 | 00663 <span class="keyword">const</span> <span class="keywordtype">char</span>* d = command.data(); |
---|
| 654 | 00664 <span class="keywordtype">int</span> l = strlen(d); |
---|
| 655 | 00665 Edit_SetText(a_window,d); |
---|
| 656 | 00666 Edit_SetSel(a_window,l,l); |
---|
| 657 | 00667 <span class="comment">//</span> |
---|
| 658 | 00668 This-><a class="code" href="classG4UIWin32.html#r13">fHistoryPos</a> = pos; |
---|
| 659 | 00669 } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(pos>=(<span class="keywordtype">int</span>)This-><a class="code" href="classG4UIWin32.html#r12">fHistory</a>.size()) { |
---|
| 660 | 00670 Edit_SetText(a_window,<span class="stringliteral">""</span>); |
---|
| 661 | 00671 Edit_SetSel(a_window,0,0); |
---|
| 662 | 00672 <span class="comment">//</span> |
---|
| 663 | 00673 This-><a class="code" href="classG4UIWin32.html#r13">fHistoryPos</a> = -1; |
---|
| 664 | 00674 } |
---|
| 665 | 00675 } |
---|
| 666 | 00676 }<span class="keywordflow">return</span> 0; <span class="comment">//Do not jump into oldEditProc.</span> |
---|
| 667 | 00677 } |
---|
| 668 | 00678 } |
---|
| 669 | 00679 <span class="keywordflow">return</span> CallWindowProc(<a class="code" href="G4UIWin32_8cc.html#a6">oldEditWindowProc</a>, |
---|
| 670 | 00680 a_window,a_message, |
---|
| 671 | 00681 a_wParam,a_lParam); |
---|
| 672 | 00682 } |
---|
| 673 | 00683 <span class="comment">/***************************************************************************/</span> |
---|
| 674 | <a name="l00684"></a><a class="code" href="classG4UIWin32.html#a11">00684</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIWin32.html#a11">G4UIWin32::TextAppendString</a> ( |
---|
| 675 | 00685 <span class="keywordtype">char</span>* a_string |
---|
| 676 | 00686 ) |
---|
| 677 | 00687 <span class="comment">/***************************************************************************/</span> |
---|
| 678 | 00689 { |
---|
| 679 | 00690 <span class="keywordflow">if</span>( (a_string==NULL) || (a_string[0]==<span class="charliteral">'\0'</span>) ) <span class="keywordflow">return</span>; |
---|
| 680 | 00691 <span class="keywordflow">if</span>(<a class="code" href="classG4UIWin32.html#r2">textWindow</a>==NULL) <span class="keywordflow">return</span>; |
---|
| 681 | 00692 <span class="keywordflow">if</span>(((<a class="code" href="classTextBuffer.html">TextBuffer</a>*)<a class="code" href="classG4UIWin32.html#r7">textBuffer</a>)->AppendString(a_string)==<span class="keyword">true</span>) { |
---|
| 682 | 00693 <span class="comment">// The appending triggers and end of line, and then updates window :</span> |
---|
| 683 | 00694 RECT rect; |
---|
| 684 | 00695 GetClientRect(<a class="code" href="classG4UIWin32.html#r2">textWindow</a>,&rect); |
---|
| 685 | 00696 InvalidateRect(<a class="code" href="classG4UIWin32.html#r2">textWindow</a>,NULL,TRUE); <span class="comment">//To erase background.</span> |
---|
| 686 | 00697 HDC hdc = GetDC(<a class="code" href="classG4UIWin32.html#r2">textWindow</a>); |
---|
| 687 | 00698 ((<a class="code" href="classTextBuffer.html">TextBuffer</a>*)<a class="code" href="classG4UIWin32.html#r7">textBuffer</a>)->Draw(hdc,&rect); |
---|
| 688 | 00699 ReleaseDC (<a class="code" href="classG4UIWin32.html#r2">textWindow</a>,hdc); |
---|
| 689 | 00700 <span class="keywordtype">int</span> linen = ((<a class="code" href="classTextBuffer.html">TextBuffer</a>*)<a class="code" href="classG4UIWin32.html#r7">textBuffer</a>)->GetNumberOfLines(); |
---|
| 690 | 00701 SetScrollRange(<a class="code" href="classG4UIWin32.html#r2">textWindow</a>,SB_VERT,0,linen-1,TRUE); |
---|
| 691 | 00702 SetScrollPos(<a class="code" href="classG4UIWin32.html#r2">textWindow</a>,SB_VERT,linen-1,TRUE); |
---|
| 692 | 00703 } |
---|
| 693 | 00704 } |
---|
| 694 | <a name="l00706"></a><a class="code" href="G4UIWin32_8cc.html#a8">00706</a> G4bool <a class="code" href="G4UIXm_8cc.html#a6">ConvertStringToInt</a>( |
---|
| 695 | 00707 <span class="keyword">const</span> <span class="keywordtype">char</span>* aString |
---|
| 696 | 00708 ,<span class="keywordtype">int</span>& aInt |
---|
| 697 | 00709 ) |
---|
| 698 | 00712 { |
---|
| 699 | 00713 aInt = 0; |
---|
| 700 | 00714 <span class="keywordflow">if</span>(aString==NULL) <span class="keywordflow">return</span> <span class="keyword">false</span>; |
---|
| 701 | 00715 <span class="keywordtype">char</span>* s; |
---|
| 702 | 00716 <span class="keywordtype">long</span> value = strtol(aString,&s,10); |
---|
| 703 | 00717 <span class="keywordflow">if</span>(s==aString) <span class="keywordflow">return</span> <span class="keyword">false</span>; |
---|
| 704 | 00718 aInt = value; |
---|
| 705 | 00719 <span class="keywordflow">return</span> <span class="keyword">true</span>; |
---|
| 706 | 00720 } |
---|
| 707 | 00721 |
---|
| 708 | 00722 |
---|
| 709 | 00723 <span class="preprocessor">#endif</span> |
---|
| 710 | </pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Jun 22 11:07:02 2007 by |
---|
| 711 | <a href="http://www.doxygen.org/index.html"> |
---|
| 712 | <img src="doxygen.png" alt="doxygen" align="middle" border=0 > |
---|
| 713 | </a>1.3.4 </small></address> |
---|
| 714 | </body> |
---|
| 715 | </html> |
---|