source: trunk/source/interfaces/html/G4UIWin32_8cc-source.html@ 833

Last change on this file since 833 was 571, checked in by garnier, 18 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: 56.6 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>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&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>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>
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: G4UIWin32.cc,v 1.13 2006/06/29 19:09:45 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="comment">//#define DEBUG</span>
4000033
4100034 <span class="preprocessor">#ifdef G4UI_BUILD_WIN32_SESSION</span>
4200035 <span class="preprocessor"></span>
4300036 <span class="comment">// this :</span>
4400037 <span class="preprocessor">#include "<a class="code" href="G4UIWin32_8hh.html">G4UIWin32.hh</a>"</span>
4500038
4600039 <span class="preprocessor">#include &lt;string.h&gt;</span>
4700040
4800041 <span class="preprocessor">#include &lt;windows.h&gt;</span>
4900042 <span class="preprocessor">#include &lt;windowsx.h&gt;</span>
5000043 <span class="preprocessor">#include &lt;wingdi.h&gt;</span>
5100044
5200045 <span class="preprocessor">#include &lt;strstream&gt;</span>
5300046
5400047 <span class="preprocessor">#include "G4UImanager.hh"</span>
5500048 <span class="preprocessor">#include "G4StateManager.hh"</span>
5600049 <span class="preprocessor">#include "G4UIcommandTree.hh"</span>
5700050 <span class="preprocessor">#include "G4UIcommandStatus.hh"</span>
5800051 <span class="preprocessor">#include "<a class="code" href="G4Win32_8hh.html">G4Win32.hh</a>"</span>
5900052
6000053 <span class="preprocessor">#define TEXT_MAX_LINES 300</span>
6100054 <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>
6300056 {
6400057 <span class="keyword">public</span>:
6500058 <a class="code" href="classTextBuffer.html#a0">TextBuffer</a>();
6600059 <a class="code" href="classTextBuffer.html#a1">~TextBuffer</a>();
6700060
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; }
7000063 <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>; }
7200065
7300066 <span class="keywordtype">void</span> <a class="code" href="classTextBuffer.html#a6">IncrementEndOfPage</a> ();
7400067 <span class="keywordtype">void</span> <a class="code" href="classTextBuffer.html#a7">DecrementEndOfPage</a> ();
7500068 <span class="keywordtype">void</span> <a class="code" href="classTextBuffer.html#a8">JumpDownEndOfPage</a> ();
7600069 <span class="keywordtype">void</span> <a class="code" href="classTextBuffer.html#a9">JumpUpEndOfPage</a> ();
7700070 G4bool <a class="code" href="classTextBuffer.html#a10">AppendString</a> (<span class="keywordtype">char</span>* a_string);
7800071 <span class="keywordtype">void</span> <a class="code" href="classTextBuffer.html#a11">Draw</a> (HDC a_hdc,RECT* a_rect);
7900072
8000073 <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];
8600079 };
8700080
88<a name="l00081"></a><a class="code" href="classTextBuffer.html#a0">00081</a> <a class="code" href="classTextBuffer.html#a0">TextBuffer::TextBuffer</a>()
8900082 : linei(0),linen(TEXT_MAX_LINES),endOfPage(0),heightOfPage(12)
9000083 {
9100084 <a class="code" href="classTextBuffer.html#r0">lines</a> = <span class="keyword">new</span> G4String[<a class="code" href="classTextBuffer.html#r1">linen</a>];
9200085 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> count=0;count&lt;256;count++) <a class="code" href="classTextBuffer.html#r5">spaces</a>[count] = <span class="charliteral">' '</span>;
9300086 }
9400087
95<a name="l00088"></a><a class="code" href="classTextBuffer.html#a1">00088</a> <a class="code" href="classTextBuffer.html#a1">TextBuffer::~TextBuffer</a>()
9600089 {
9700090 <span class="keyword">delete</span> [] <a class="code" href="classTextBuffer.html#r0">lines</a>;
9800091 }
9900092
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)
10100094 {
10200095 <span class="keywordflow">if</span>( (a_value&lt;0) || (a_value&gt;=<a class="code" href="classTextBuffer.html#r2">linei</a>)) {
10300096 <a class="code" href="classTextBuffer.html#r3">endOfPage</a> = <a class="code" href="classTextBuffer.html#r2">linei</a>-1;
10400097 } <span class="keywordflow">else</span> {
10500098 <a class="code" href="classTextBuffer.html#r3">endOfPage</a> = a_value;
10600099 }
10700100 }
10800101
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> ()
11000103 {
11100104 <a class="code" href="classTextBuffer.html#r3">endOfPage</a>++;
11200105 <span class="keywordflow">if</span>(<a class="code" href="classTextBuffer.html#r3">endOfPage</a>&gt;=<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;
11300106 }
11400107
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> ()
11600109 {
11700110 <a class="code" href="classTextBuffer.html#r3">endOfPage</a>--;
11800111 <span class="keywordflow">if</span>(<a class="code" href="classTextBuffer.html#r3">endOfPage</a>&lt;0) <a class="code" href="classTextBuffer.html#r3">endOfPage</a> = 0;
11900112 }
12000113
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> ()
12200115 {
12300116 <a class="code" href="classTextBuffer.html#r3">endOfPage</a> += <a class="code" href="classTextBuffer.html#r4">heightOfPage</a>;
12400117 <span class="keywordflow">if</span>(<a class="code" href="classTextBuffer.html#r3">endOfPage</a>&gt;=<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;
12500118 }
12600119
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> ()
12800121 {
12900122 <a class="code" href="classTextBuffer.html#r3">endOfPage</a> -= <a class="code" href="classTextBuffer.html#r4">heightOfPage</a>;
13000123 <span class="keywordflow">if</span>(<a class="code" href="classTextBuffer.html#r3">endOfPage</a>&lt;0) <a class="code" href="classTextBuffer.html#r3">endOfPage</a> = 0;
13100124 }
13200125
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)
13400127 {
13500128 G4bool value = <span class="keyword">false</span>;
13600129 <span class="keywordflow">if</span>( (a_string==NULL) || (a_string[0]==<span class="charliteral">'\0'</span>) ) <span class="keywordflow">return</span> value;
13700130 <span class="keywordtype">int</span> length = strlen(a_string);
13800131 <span class="keywordflow">if</span>(a_string[length-1]==<span class="charliteral">'\n'</span>) {
13900132 <a class="code" href="classTextBuffer.html#r0">lines</a>[<a class="code" href="classTextBuffer.html#r2">linei</a>] += a_string;
14000133 <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>);
14100134 <a class="code" href="classTextBuffer.html#r2">linei</a>++;
14200135 value = <span class="keyword">true</span>;
14300136 } <span class="keywordflow">else</span> {
14400137 <a class="code" href="classTextBuffer.html#r0">lines</a>[<a class="code" href="classTextBuffer.html#r2">linei</a>] += a_string;
14500138 }
14600139 <span class="keywordflow">if</span>(<a class="code" href="classTextBuffer.html#r2">linei</a>&gt;=<a class="code" href="classTextBuffer.html#r1">linen</a>) {
14700140 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> count=0;count&lt;<a class="code" href="classTextBuffer.html#r1">linen</a>;count++) {
14800141 <a class="code" href="classTextBuffer.html#r0">lines</a>[count] = <span class="stringliteral">""</span>;
14900142 }
15000143 <a class="code" href="classTextBuffer.html#r2">linei</a> = 0;
15100144 }
15200145 <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;
15300146 <span class="keywordflow">return</span> value;
15400147 }
15500148
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)
15700150 {
15800151 TEXTMETRIC tm;
15900152 GetTextMetrics (a_hdc,&amp;tm);
16000153 <span class="keywordtype">short</span> charWidth = (<span class="keywordtype">short</span>)tm.tmAveCharWidth;
16100154 <span class="keywordtype">short</span> charHeight = (<span class="keywordtype">short</span>)(tm.tmHeight + tm.tmExternalLeading);
16200155 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> row=0;row&lt;<a class="code" href="classTextBuffer.html#r4">heightOfPage</a>;row++) {
16300156 <span class="keywordtype">int</span> rowi = <a class="code" href="classTextBuffer.html#r3">endOfPage</a> - row;
16400157 <span class="keywordtype">short</span> y = (<span class="keywordtype">short</span>)(a_rect-&gt;bottom - charHeight * (row + 1));
16500158 <span class="keywordflow">if</span>((rowi&gt;=0)&amp;&amp;(rowi&lt;<a class="code" href="classTextBuffer.html#r2">linei</a>)) {
16600159 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>
16700160 <span class="keyword">const</span> <span class="keywordtype">char</span>* string = <a class="code" href="classTextBuffer.html#r0">lines</a>[rowi].data();
16800161 <span class="keywordflow">if</span>(string!=NULL) {
16900162 TextOut (a_hdc,0,y,(<span class="keywordtype">char</span>*)string,strlen((<span class="keywordtype">char</span>*)string));
17000163 }
17100164 }
17200165 }
17300166 }
17400167
17500168 <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;
18200175
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>;
18400177 <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>&amp;);
18500178
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;
18700180
18800181 <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> (
19000183 )
19100184 :mainWindow(NULL)
19200185 ,textWindow(NULL)
19300186 ,editWindow(NULL)
19400187 ,menuBar(NULL)
19500188 ,textBuffer(NULL)
19600189 ,textCols(80)
19700190 ,textRows(12)
19800191 ,fHelp(false)
19900192 ,fHelpChoice(0)
20000193 ,fHistoryPos(-1)
20100194 <span class="comment">/***************************************************************************/</span>
20200196 {
20300197 G4UImanager* UI = G4UImanager::GetUIpointer();
20400198 <span class="keywordflow">if</span>(UI!=NULL) UI-&gt;SetSession(<span class="keyword">this</span>);
20500199
20600200 <a class="code" href="classG4UIWin32.html#r0">interactorManager</a> = <a class="code" href="classG4Win32.html#e0">G4Win32::getInstance</a> ();
20700201 <span class="keyword">static</span> G4bool Done = FALSE;
20800202 <span class="keywordflow">if</span>(Done==FALSE) {
20900203 WNDCLASS wc;
21000204 wc.style = CS_HREDRAW | CS_VREDRAW;
21100205 wc.lpfnWndProc = (WNDPROC)<a class="code" href="classG4UIWin32.html#h0">G4UIWin32::MainWindowProc</a>;
21200206 wc.cbClsExtra = 0;
21300207 wc.cbWndExtra = 0;
21400208 wc.hInstance = ::GetModuleHandle(NULL);
21500209 wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
21600210 wc.hCursor = LoadCursor(NULL,IDC_ARROW);
21700211 wc.hbrBackground = GetStockBrush(WHITE_BRUSH);
21800212 wc.lpszMenuName = <a class="code" href="G4UIWin32_8cc.html#a0">mainClassName</a>;
21900213 wc.lpszClassName = <a class="code" href="G4UIWin32_8cc.html#a0">mainClassName</a>;
22000214 ::RegisterClass (&amp;wc);
22100215
22200216 wc.style = CS_HREDRAW | CS_VREDRAW;
22300217 wc.lpfnWndProc = (WNDPROC)<a class="code" href="classG4UIWin32.html#h1">G4UIWin32::TextWindowProc</a>;
22400218 wc.cbClsExtra = 0;
22500219 wc.cbWndExtra = 0;
22600220 wc.hInstance = ::GetModuleHandle(NULL);
22700221 wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
22800222 wc.hCursor = LoadCursor(NULL,IDC_ARROW);
22900223 wc.hbrBackground = GetStockBrush(WHITE_BRUSH);
23000224 wc.lpszMenuName = <a class="code" href="G4UIWin32_8cc.html#a1">textClassName</a>;
23100225 wc.lpszClassName = <a class="code" href="G4UIWin32_8cc.html#a1">textClassName</a>;
23200226 ::RegisterClass (&amp;wc);
23300227 Done = TRUE;
23400228 }
23500229
23600230 <a class="code" href="classG4UIWin32.html#r4">menuBar</a> = CreateMenu();
23700231 <a class="code" href="classG4UIWin32.html#r5">defaultMenu</a> = CreatePopupMenu();
23800232 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>);
23900233
24000234 <a class="code" href="classG4UIWin32.html#r7">textBuffer</a> = <span class="keyword">new</span> <a class="code" href="classTextBuffer.html">TextBuffer</a>();
24100235
24200236 <a class="code" href="G4UIWin32_8cc.html#a5">tmpSession</a> = <span class="keyword">this</span>;
24300237 <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>,
24400238 WS_OVERLAPPEDWINDOW,
24500239 CW_USEDEFAULT,CW_USEDEFAULT,
24600240 0,0,
24700241 NULL,<a class="code" href="classG4UIWin32.html#r4">menuBar</a>,
24800242 ::GetModuleHandle(NULL),
24900243 NULL);
25000244 <a class="code" href="G4UIWin32_8cc.html#a5">tmpSession</a> = NULL;
25100245 ::SetWindowLong(<a class="code" href="classG4UIWin32.html#r1">mainWindow</a>,GWL_USERDATA,LONG(<span class="keyword">this</span>));
25200246
25300247 ::SetForegroundWindow(<a class="code" href="classG4UIWin32.html#r1">mainWindow</a>);
25400248 ::ShowWindow(<a class="code" href="classG4UIWin32.html#r1">mainWindow</a>,SW_SHOWDEFAULT);
25500249 ::UpdateWindow(<a class="code" href="classG4UIWin32.html#r1">mainWindow</a>);
25600250
25700251 <span class="keywordflow">if</span>(UI!=NULL) UI-&gt;SetCoutDestination(<span class="keyword">this</span>);
25800252 }
25900253 <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> (
26100255 )
26200256 <span class="comment">/***************************************************************************/</span>
26300258 {
26400259 G4UImanager* UI = G4UImanager::GetUIpointer();
26500260 <span class="keywordflow">if</span>(UI!=NULL) {
26600261 UI-&gt;SetSession(NULL);
26700262 UI-&gt;SetCoutDestination(NULL);
26800263 }
26900264 <span class="keyword">delete</span> <a class="code" href="classG4UIWin32.html#r7">textBuffer</a>;
27000265 <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));
27100266 <span class="keywordflow">if</span>(<a class="code" href="classG4UIWin32.html#r1">mainWindow</a>!=NULL) {
27200267 ::SetWindowLong(<a class="code" href="classG4UIWin32.html#r1">mainWindow</a>,GWL_USERDATA,LONG(NULL));
27300268 ::DestroyWindow(<a class="code" href="classG4UIWin32.html#r1">mainWindow</a>);
27400269 }
27500270 }
27600271 <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> (
27800273 )
27900274 <span class="comment">/***************************************************************************/</span>
28000276 {
28100277 <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>;
28200278 <a class="code" href="classG4UIWin32.html#a5">Prompt</a> (<span class="stringliteral">"session"</span>);
28300279 <a class="code" href="G4UIWin32_8cc.html#a2">exitSession</a> = <span class="keyword">false</span>;
28400280 <a class="code" href="classG4UIWin32.html#r0">interactorManager</a>-&gt;<a class="code" href="classG4VInteractorManager.html#a13">DisableSecondaryLoop</a> ();
28500281 <span class="keywordtype">void</span>* event;
28600282 <span class="keywordflow">while</span>((event = <a class="code" href="classG4UIWin32.html#r0">interactorManager</a>-&gt;<a class="code" href="classG4VInteractorManager.html#a22">GetEvent</a>())!=NULL) {
28700283 <a class="code" href="classG4UIWin32.html#r0">interactorManager</a>-&gt;<a class="code" href="classG4VInteractorManager.html#a17">DispatchEvent</a>(event);
28800284 <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>;
28900285 }
29000286 <a class="code" href="classG4UIWin32.html#r0">interactorManager</a>-&gt;<a class="code" href="classG4VInteractorManager.html#a12">EnableSecondaryLoop</a> ();
29100287 <span class="keywordflow">return</span> <span class="keyword">this</span>;
29200288 }
29300289 <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> (
29500291 G4String a_prompt
29600292 )
29700293 <span class="comment">/***************************************************************************/</span>
29800295 {
29900296 }
30000297 <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> (
30200299 )
30300300 <span class="comment">/***************************************************************************/</span>
30400302 {
30500303 }
30600304 <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> (
30800306 G4String a_state
30900307 )
31000308 <span class="comment">/***************************************************************************/</span>
31100310 {
31200311 <span class="keywordflow">if</span>(a_state==<span class="stringliteral">"G4_pause&gt; "</span>) {
31300312 <a class="code" href="classG4UIWin32.html#d0">SecondaryLoop</a> (<span class="stringliteral">"Pause, type continue to exit this state"</span>);
31400313 }
31500314
31600315 <span class="keywordflow">if</span>(a_state==<span class="stringliteral">"EndOfEvent"</span>) {
31700316 <span class="comment">// Picking with feed back in event data Done here !!!</span>
31800317 <a class="code" href="classG4UIWin32.html#d0">SecondaryLoop</a> (<span class="stringliteral">"End of event, type continue to exit this state"</span>);
31900318 }
32000319 }
32100320 <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> (
32300322 G4String a_prompt
32400323 )
32500324 <span class="comment">/***************************************************************************/</span>
32600326 {
32700327 <span class="keywordflow">if</span>(<a class="code" href="classG4UIWin32.html#r0">interactorManager</a>==NULL) <span class="keywordflow">return</span>;
32800328 <a class="code" href="classG4UIWin32.html#a5">Prompt</a>(a_prompt);
32900329 <a class="code" href="G4UIWin32_8cc.html#a3">exitPause</a> = <span class="keyword">false</span>;
33000330 <span class="keywordtype">void</span>* event;
33100331 <span class="keywordflow">while</span>((event = <a class="code" href="classG4UIWin32.html#r0">interactorManager</a>-&gt;<a class="code" href="classG4VInteractorManager.html#a22">GetEvent</a>())!=NULL) {
33200332 <a class="code" href="classG4UIWin32.html#r0">interactorManager</a>-&gt;<a class="code" href="classG4VInteractorManager.html#a17">DispatchEvent</a>(event);
33300333 <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>;
33400334 }
33500335 <a class="code" href="classG4UIWin32.html#a5">Prompt</a>(<span class="stringliteral">"session"</span>);
33600336 }
33700337 <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> (
33900339 G4String a_string
34000340 )
34100341 <span class="comment">/***************************************************************************/</span>
34200343 {
34300344 <a class="code" href="classG4UIWin32.html#a11">TextAppendString</a>((<span class="keywordtype">char</span>*)a_string.data());
34400345 <span class="keywordflow">return</span> 0;
34500346 }
34600347 <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> (
34800349 G4String a_string
34900350 )
35000351 <span class="comment">/***************************************************************************/</span>
35100353 {
35200354 <a class="code" href="classG4UIWin32.html#a11">TextAppendString</a>((<span class="keywordtype">char</span>*)a_string.data());
35300355 <span class="keywordflow">return</span> 0;
35400356 }
35500357 <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>(
35700359 G4int&amp; aInt
35800360 )
35900361 <span class="comment">/***************************************************************************/</span>
36000363 {
36100364 <a class="code" href="classG4UIWin32.html#r10">fHelp</a> = <span class="keyword">true</span>;
36200365 <span class="comment">//</span>
36300366 <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>;
36400367 <a class="code" href="classG4UIWin32.html#a5">Prompt</a>(<span class="stringliteral">"Help"</span>);
36500368 <a class="code" href="G4UIWin32_8cc.html#a4">exitHelp</a> = <span class="keyword">false</span>;
36600369 <span class="keywordtype">void</span>* event;
36700370 <span class="keywordflow">while</span>((event = <a class="code" href="classG4UIWin32.html#r0">interactorManager</a>-&gt;<a class="code" href="classG4VInteractorManager.html#a22">GetEvent</a>())!=NULL) {
36800371 <a class="code" href="classG4UIWin32.html#r0">interactorManager</a>-&gt;<a class="code" href="classG4VInteractorManager.html#a17">DispatchEvent</a>(event);
36900372 <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>;
37000373 }
37100374 <a class="code" href="classG4UIWin32.html#a5">Prompt</a>(<span class="stringliteral">"session"</span>);
37200375 <span class="comment">//</span>
37300376 <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>;
37400377 aInt = <a class="code" href="classG4UIWin32.html#r11">fHelpChoice</a>;
37500378 <a class="code" href="classG4UIWin32.html#r10">fHelp</a> = <span class="keyword">false</span>;
37600379 <span class="keywordflow">return</span> <span class="keyword">true</span>;
37700380 }
37800381 <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>(
38000383 )
38100384 <span class="comment">/***************************************************************************/</span>
38200386 {
38300387 }
38400388 <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> (
38600390 <span class="keyword">const</span> <span class="keywordtype">char</span>* a_name
38700391 ,<span class="keyword">const</span> <span class="keywordtype">char</span>* a_label
38800392 )
38900393 <span class="comment">/***************************************************************************/</span>
39000395 {
39100396 <span class="keywordflow">if</span>(a_name==NULL) <span class="keywordflow">return</span>;
39200397 <span class="keywordflow">if</span>(<a class="code" href="classG4UIWin32.html#r5">defaultMenu</a>!=NULL) {
39300398 DeleteMenu (<a class="code" href="classG4UIWin32.html#r4">menuBar</a>,0,MF_BYPOSITION);
39400399 <a class="code" href="classG4UIWin32.html#r5">defaultMenu</a> = NULL;
39500400 }
39600401 HMENU hMenu = CreatePopupMenu();
39700402 AppendMenu(<a class="code" href="classG4UIWin32.html#r4">menuBar</a>,MF_POPUP,(UINT)hMenu,a_label);
39800403 <a class="code" href="classG4VInteractiveSession.html#a4">AddInteractor</a>(a_name,(<a class="code" href="G4VInteractorManager_8hh.html#a0">G4Interactor</a>)hMenu);
39900404 DrawMenuBar(<a class="code" href="classG4UIWin32.html#r1">mainWindow</a>);
40000405 }
40100406 <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> (
40300408 <span class="keyword">const</span> <span class="keywordtype">char</span>* a_menu
40400409 ,<span class="keyword">const</span> <span class="keywordtype">char</span>* a_label
40500410 ,<span class="keyword">const</span> <span class="keywordtype">char</span>* a_command
40600411 )
40700412 <span class="comment">/***************************************************************************/</span>
40800414 {
40900415 <span class="keywordflow">if</span>(a_menu==NULL) <span class="keywordflow">return</span>;
41000416 <span class="keywordflow">if</span>(a_label==NULL) <span class="keywordflow">return</span>;
41100417 <span class="keywordflow">if</span>(a_command==NULL) <span class="keywordflow">return</span>;
41200418 HMENU hMenu = (HMENU)<a class="code" href="classG4VInteractiveSession.html#a5">GetInteractor</a>(a_menu);
41300419 <a class="code" href="G4UIWin32_8cc.html#a7">actionIdentifier</a>++;
41400420 <a class="code" href="classG4UIWin32.html#r6">commands</a>[<a class="code" href="G4UIWin32_8cc.html#a7">actionIdentifier</a>] = a_command;
41500421 AppendMenu (hMenu,MF_STRING,<a class="code" href="G4UIWin32_8cc.html#a7">actionIdentifier</a>,a_label);
41600422 }
41700423 <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> (
41900425 <span class="keywordtype">int</span> a_id
42000426 )
42100427 <span class="comment">/***************************************************************************/</span>
42200429 {
42300430 <span class="keywordflow">return</span> <a class="code" href="classG4UIWin32.html#r6">commands</a>[a_id];
42400431 }
42500432 <span class="comment">/***************************************************************************/</span>
42600433 <span class="comment">/***************************************************************************/</span>
42700434 <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> (
42900436 HWND a_window
43000437 ,UINT a_message
43100438 ,WPARAM a_wParam
43200439 ,LPARAM a_lParam
43300440 )
43400441 <span class="comment">/***************************************************************************/</span>
43500443 {
43600444 <span class="keyword">static</span> <span class="keywordtype">short</span> charWidth,charHeight;
43700445
43800446 <span class="keywordflow">switch</span> (a_message) {
43900447 <span class="keywordflow">case</span> WM_CREATE:{
44000448 HDC hdc;
44100449 TEXTMETRIC tm;
44200450 RECT rect;
44300451 GetWindowRect (a_window,&amp;rect);
44400452
44500453 hdc = GetDC (a_window);
44600454 GetTextMetrics (hdc,&amp;tm);
44700455 charWidth = (<span class="keywordtype">short</span>)tm.tmAveCharWidth;
44800456 charHeight = (<span class="keywordtype">short</span>)(tm.tmHeight + tm.tmExternalLeading);
44900457 ReleaseDC (a_window,hdc);
45000458
45100459 <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>;
45200460 <span class="keywordflow">if</span>(This!=NULL) {
45300461 This-&gt;<a class="code" href="classG4UIWin32.html#r2">textWindow</a> = CreateWindow (<a class="code" href="G4UIWin32_8cc.html#a1">textClassName</a>,NULL,
45400462 WS_CHILD | WS_VISIBLE | WS_VSCROLL,
45500463 0,0,
45600464 This-&gt;<a class="code" href="classG4UIWin32.html#r9">textCols</a> * charWidth,
45700465 This-&gt;<a class="code" href="classG4UIWin32.html#r8">textRows</a> * charHeight,
45800466 a_window,NULL,
45900467 GetWindowInstance(a_window),
46000468 NULL);
46100469 ::SetWindowLong (This-&gt;<a class="code" href="classG4UIWin32.html#r2">textWindow</a>,GWL_USERDATA,LONG(This));
46200470
46300471 This-&gt;<a class="code" href="classG4UIWin32.html#r3">editWindow</a> = CreateWindow (<span class="stringliteral">"edit"</span>,NULL,
46400472 WS_CHILD | WS_VISIBLE | WS_BORDER,
46500473 0,This-&gt;<a class="code" href="classG4UIWin32.html#r8">textRows</a> * charHeight,
46600474 This-&gt;<a class="code" href="classG4UIWin32.html#r9">textCols</a> * charWidth,charHeight,
46700475 a_window,(HMENU)1,
46800476 GetWindowInstance(a_window),
46900477 NULL);
47000478 <a class="code" href="G4UIWin32_8cc.html#a6">oldEditWindowProc</a> = (WNDPROC)GetWindowLong(This-&gt;<a class="code" href="classG4UIWin32.html#r3">editWindow</a>,GWL_WNDPROC);
47100479 SetWindowLong (This-&gt;<a class="code" href="classG4UIWin32.html#r3">editWindow</a>,GWL_WNDPROC,(LONG)<a class="code" href="classG4UIWin32.html#h2">EditWindowProc</a>);
47200480
47300481 MoveWindow (a_window,
47400482 rect.left,rect.top,
47500483 2 * GetSystemMetrics(SM_CXFRAME) +
47600484 This-&gt;<a class="code" href="classG4UIWin32.html#r9">textCols</a> * charWidth,
47700485 GetSystemMetrics(SM_CYCAPTION) +
47800486 2 * GetSystemMetrics(SM_CYFRAME) +
47900487 This-&gt;<a class="code" href="classG4UIWin32.html#r8">textRows</a> * charHeight + charHeight,
48000488 TRUE);
48100489 }
48200490 }<span class="keywordflow">return</span> 0;
48300491 <span class="keywordflow">case</span> WM_SIZE:{
48400492 <a class="code" href="classG4UIWin32.html">G4UIWin32</a>* This = (<a class="code" href="classG4UIWin32.html">G4UIWin32</a>*)::GetWindowLong(a_window,GWL_USERDATA);
48500493 <span class="keywordflow">if</span>(This!=NULL) {
48600494 <span class="comment">// Client size :</span>
48700495 <span class="keywordtype">int</span> width = LOWORD(a_lParam);
48800496 <span class="keywordtype">int</span> height = HIWORD(a_lParam);
48900497 <span class="keywordtype">int</span> editHeight = <span class="comment">/*2 * GetSystemMetrics(SM_CYBORDER) + */</span> charHeight;
49000498 MoveWindow (This-&gt;<a class="code" href="classG4UIWin32.html#r2">textWindow</a>,
49100499 0,0,
49200500 width,height - editHeight,
49300501 FALSE);
49400502 MoveWindow (This-&gt;<a class="code" href="classG4UIWin32.html#r3">editWindow</a>,
49500503 0,height - editHeight,
49600504 width,charHeight,
49700505 FALSE);
49800506 ((<a class="code" href="classTextBuffer.html">TextBuffer</a>*)This-&gt;<a class="code" href="classG4UIWin32.html#r7">textBuffer</a>)-&gt;SetHeightOfPage(height/charHeight);
49900507 }
50000508 }<span class="keywordflow">return</span> 0;
50100509 <span class="keywordflow">case</span> WM_SETFOCUS:{
50200510 <a class="code" href="classG4UIWin32.html">G4UIWin32</a>* This = (<a class="code" href="classG4UIWin32.html">G4UIWin32</a>*)::GetWindowLong(a_window,GWL_USERDATA);
50300511 <span class="keywordflow">if</span>(This!=NULL) SetFocus (This-&gt;<a class="code" href="classG4UIWin32.html#r3">editWindow</a>);
50400512 }<span class="keywordflow">return</span> 0;
50500513 <span class="keywordflow">case</span> WM_COMMAND:{
50600514 <a class="code" href="classG4UIWin32.html">G4UIWin32</a>* This = (<a class="code" href="classG4UIWin32.html">G4UIWin32</a>*)::GetWindowLong(a_window,GWL_USERDATA);
50700515 <span class="keywordflow">if</span>(This!=NULL) {
50800516 <span class="keywordflow">if</span>(This-&gt;<a class="code" href="classG4UIWin32.html#r10">fHelp</a>==<span class="keyword">false</span>) {
50900517 G4String command = This-&gt;<a class="code" href="classG4UIWin32.html#a10">GetCommand</a>(a_wParam);
51000518 This-&gt;<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>);
51100519 }
51200520 }
51300521 }<span class="keywordflow">return</span> 0;
51400522 <span class="keywordflow">case</span> WM_DESTROY:
51500523 PostQuitMessage(0);
51600524 <span class="keywordflow">return</span> 0;
51700525 }
51800526 <span class="keywordflow">return</span> (DefWindowProc(a_window,a_message,a_wParam,a_lParam));
51900527 }
52000528 <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> (
52200530 HWND a_window
52300531 ,UINT a_message
52400532 ,WPARAM a_wParam
52500533 ,LPARAM a_lParam
52600534 )
52700535 <span class="comment">/***************************************************************************/</span>
52800537 {
52900538 <span class="keywordflow">switch</span> (a_message) {
53000539 <span class="keywordflow">case</span> WM_PAINT:{
53100540 <a class="code" href="classG4UIWin32.html">G4UIWin32</a>* This = (<a class="code" href="classG4UIWin32.html">G4UIWin32</a>*)::GetWindowLong(a_window,GWL_USERDATA);
53200541 <span class="keywordflow">if</span>(This!=NULL) {
53300542 <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-&gt;<a class="code" href="classG4UIWin32.html#r7">textBuffer</a>;
53400543 RECT rect;
53500544 GetClientRect (a_window,&amp;rect);
53600545 PAINTSTRUCT ps;
53700546 HDC hdc = BeginPaint(a_window,&amp;ps);
53800547 textBuffer-&gt;<a class="code" href="classTextBuffer.html#a11">Draw</a>(hdc,&amp;rect);
53900548 EndPaint(a_window,&amp;ps);
54000549 }
54100550 }<span class="keywordflow">return</span> 0;
54200551 <span class="keywordflow">case</span> WM_VSCROLL:{
54300552 <a class="code" href="classG4UIWin32.html">G4UIWin32</a>* This = (<a class="code" href="classG4UIWin32.html">G4UIWin32</a>*)::GetWindowLong(a_window,GWL_USERDATA);
54400553 <span class="keywordflow">if</span>(This!=NULL) {
54500554 <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-&gt;<a class="code" href="classG4UIWin32.html#r7">textBuffer</a>;
54600555 <span class="keywordtype">int</span> what = LOWORD(a_wParam);
54700556 <span class="keywordflow">switch</span>(what) {
54800557 <span class="keywordflow">case</span> SB_LINEUP:
54900558 textBuffer-&gt;<a class="code" href="classTextBuffer.html#a7">DecrementEndOfPage</a>();
55000559 <span class="keywordflow">break</span>;
55100560 <span class="keywordflow">case</span> SB_LINEDOWN:
55200561 textBuffer-&gt;<a class="code" href="classTextBuffer.html#a6">IncrementEndOfPage</a>();
55300562 <span class="keywordflow">break</span>;
55400563 <span class="keywordflow">case</span> SB_PAGEUP:
55500564 textBuffer-&gt;<a class="code" href="classTextBuffer.html#a9">JumpUpEndOfPage</a>();
55600565 <span class="keywordflow">break</span>;
55700566 <span class="keywordflow">case</span> SB_PAGEDOWN:
55800567 textBuffer-&gt;<a class="code" href="classTextBuffer.html#a8">JumpDownEndOfPage</a>();
55900568 <span class="keywordflow">break</span>;
56000569 <span class="keywordflow">case</span> SB_THUMBPOSITION:
56100570 <span class="keywordflow">case</span> SB_THUMBTRACK:
56200571 textBuffer-&gt;<a class="code" href="classTextBuffer.html#a4">SetEndOfPage</a>(HIWORD(a_wParam));
56300572 <span class="keywordflow">break</span>;
56400573 <span class="keywordflow">default</span>:
56500574 <span class="keywordflow">return</span> 0;
56600575 }
56700576 <span class="keywordtype">int</span> eop = textBuffer-&gt;<a class="code" href="classTextBuffer.html#a5">GetEndOfPage</a>();
56800577 SetScrollPos(a_window,SB_VERT,eop,TRUE);
56900578 InvalidateRect(a_window,NULL,TRUE);
57000579 }}<span class="keywordflow">return</span> 0;
57100580 <span class="keywordflow">case</span> WM_DESTROY:
57200581 PostQuitMessage(0);
57300582 <span class="keywordflow">return</span> 0;
57400583 }
57500584 <span class="keywordflow">return</span> (DefWindowProc(a_window,a_message,a_wParam,a_lParam));
57600585 }
57700586 <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> (
57900588 HWND a_window
58000589 ,UINT a_message
58100590 ,WPARAM a_wParam
58200591 ,LPARAM a_lParam
58300592 )
58400593 <span class="comment">/***************************************************************************/</span>
58500595 {
58600596 <span class="keywordflow">switch</span> (a_message) {
58700597 <span class="keywordflow">case</span> WM_KEYDOWN:
58800598 <span class="keywordflow">switch</span>(a_wParam){
58900599 <span class="keywordflow">case</span> VK_RETURN:{
59000600 <a class="code" href="classG4UIWin32.html">G4UIWin32</a>* This = (<a class="code" href="classG4UIWin32.html">G4UIWin32</a>*)::GetWindowLong(
59100601 GetParent(a_window),GWL_USERDATA);
59200602 <span class="keywordtype">char</span> buffer[128];
59300603 GetWindowText (a_window,buffer,128);
59400604 G4String command (buffer);
59500605 <span class="comment">//SetWindowText (a_window,"");</span>
59600606 Edit_SetText(a_window,<span class="stringliteral">""</span>);
59700607 Edit_SetSel(a_window,0,0);
59800608
59900609 <span class="keywordflow">if</span>(This!=NULL) {
60000610 <span class="keywordflow">if</span>(This-&gt;<a class="code" href="classG4UIWin32.html#r10">fHelp</a>==<span class="keyword">true</span>) {
60100611 <a class="code" href="G4UIWin32_8cc.html#a4">exitHelp</a> = <span class="keyword">true</span>;
60200612 This-&gt;<a class="code" href="classG4UIWin32.html#r10">fHelp</a> = <a class="code" href="G4UIXm_8cc.html#a6">ConvertStringToInt</a>(command.data(),This-&gt;<a class="code" href="classG4UIWin32.html#r11">fHelpChoice</a>);
60300613 } <span class="keywordflow">else</span> {
60400614 This-&gt;<a class="code" href="classG4UIWin32.html#r12">fHistory</a>.push_back(command);
60500615 This-&gt;<a class="code" href="classG4UIWin32.html#r13">fHistoryPos</a> = -1;
60600616 This-&gt;<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>);
60700617 }
60800618 }
60900619
61000620 }<span class="keywordflow">break</span>;
61100621 <span class="keywordflow">case</span> VK_TAB:{
61200622 <a class="code" href="classG4UIWin32.html">G4UIWin32</a>* This = (<a class="code" href="classG4UIWin32.html">G4UIWin32</a>*)::GetWindowLong(
61300623 GetParent(a_window),GWL_USERDATA);
61400624 <span class="keywordflow">if</span>( (This!=NULL) &amp;&amp; (This-&gt;<a class="code" href="classG4UIWin32.html#r10">fHelp</a>==<span class="keyword">true</span>) ) <span class="keywordflow">break</span>;
61500625 <span class="keywordtype">char</span> buffer[128];
61600626 Edit_GetText(a_window,buffer,128);
61700627
61800628 G4String command(buffer);
61900629
62000630 <span class="keywordflow">if</span>(This!=NULL) {
62100631 G4String cmd = This-&gt;<a class="code" href="classG4VBasicShell.html#b5">Complete</a>(command);
62200632 <span class="keyword">const</span> <span class="keywordtype">char</span>* d = cmd.data();
62300633 <span class="keywordtype">int</span> l = strlen(d);
62400634 Edit_SetText(a_window,d);
62500635 Edit_SetSel(a_window,l,l);
62600636 }
62700637
62800638 }<span class="keywordflow">break</span>;
62900639 <span class="keywordflow">case</span> VK_UP:{
63000640 <a class="code" href="classG4UIWin32.html">G4UIWin32</a>* This = (<a class="code" href="classG4UIWin32.html">G4UIWin32</a>*)::GetWindowLong(
63100641 GetParent(a_window),GWL_USERDATA);
63200642 <span class="keywordflow">if</span>(This!=NULL) {
63300643 <span class="keywordtype">int</span> pos = This-&gt;<a class="code" href="classG4UIWin32.html#r13">fHistoryPos</a>== -1 ?
63400644 This-&gt;<a class="code" href="classG4UIWin32.html#r12">fHistory</a>.size()-1 : This-&gt;<a class="code" href="classG4UIWin32.html#r13">fHistoryPos</a>-1;
63500645 <span class="keywordflow">if</span>((pos&gt;=0)&amp;&amp;(pos&lt;(<span class="keywordtype">int</span>)This-&gt;<a class="code" href="classG4UIWin32.html#r12">fHistory</a>.size())) {
63600646 G4String command = This-&gt;<a class="code" href="classG4UIWin32.html#r12">fHistory</a>[pos];
63700647 <span class="keyword">const</span> <span class="keywordtype">char</span>* d = command.data();
63800648 <span class="keywordtype">int</span> l = strlen(d);
63900649 Edit_SetText(a_window,d);
64000650 Edit_SetSel(a_window,l,l);
64100651 <span class="comment">//</span>
64200652 This-&gt;<a class="code" href="classG4UIWin32.html#r13">fHistoryPos</a> = pos;
64300653 }
64400654 }
64500655 }<span class="keywordflow">return</span> 0; <span class="comment">//Do not jump into oldEditProc.</span>
64600656 <span class="keywordflow">case</span> VK_DOWN:{
64700657 <a class="code" href="classG4UIWin32.html">G4UIWin32</a>* This = (<a class="code" href="classG4UIWin32.html">G4UIWin32</a>*)::GetWindowLong(
64800658 GetParent(a_window),GWL_USERDATA);
64900659 <span class="keywordflow">if</span>(This!=NULL) {
65000660 <span class="keywordtype">int</span> pos = This-&gt;<a class="code" href="classG4UIWin32.html#r13">fHistoryPos</a> + 1;
65100661 <span class="keywordflow">if</span>((pos&gt;=0)&amp;&amp;(pos&lt;(<span class="keywordtype">int</span>)This-&gt;<a class="code" href="classG4UIWin32.html#r12">fHistory</a>.size())) {
65200662 G4String command = This-&gt;<a class="code" href="classG4UIWin32.html#r12">fHistory</a>[pos];
65300663 <span class="keyword">const</span> <span class="keywordtype">char</span>* d = command.data();
65400664 <span class="keywordtype">int</span> l = strlen(d);
65500665 Edit_SetText(a_window,d);
65600666 Edit_SetSel(a_window,l,l);
65700667 <span class="comment">//</span>
65800668 This-&gt;<a class="code" href="classG4UIWin32.html#r13">fHistoryPos</a> = pos;
65900669 } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(pos&gt;=(<span class="keywordtype">int</span>)This-&gt;<a class="code" href="classG4UIWin32.html#r12">fHistory</a>.size()) {
66000670 Edit_SetText(a_window,<span class="stringliteral">""</span>);
66100671 Edit_SetSel(a_window,0,0);
66200672 <span class="comment">//</span>
66300673 This-&gt;<a class="code" href="classG4UIWin32.html#r13">fHistoryPos</a> = -1;
66400674 }
66500675 }
66600676 }<span class="keywordflow">return</span> 0; <span class="comment">//Do not jump into oldEditProc.</span>
66700677 }
66800678 }
66900679 <span class="keywordflow">return</span> CallWindowProc(<a class="code" href="G4UIWin32_8cc.html#a6">oldEditWindowProc</a>,
67000680 a_window,a_message,
67100681 a_wParam,a_lParam);
67200682 }
67300683 <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> (
67500685 <span class="keywordtype">char</span>* a_string
67600686 )
67700687 <span class="comment">/***************************************************************************/</span>
67800689 {
67900690 <span class="keywordflow">if</span>( (a_string==NULL) || (a_string[0]==<span class="charliteral">'\0'</span>) ) <span class="keywordflow">return</span>;
68000691 <span class="keywordflow">if</span>(<a class="code" href="classG4UIWin32.html#r2">textWindow</a>==NULL) <span class="keywordflow">return</span>;
68100692 <span class="keywordflow">if</span>(((<a class="code" href="classTextBuffer.html">TextBuffer</a>*)<a class="code" href="classG4UIWin32.html#r7">textBuffer</a>)-&gt;AppendString(a_string)==<span class="keyword">true</span>) {
68200693 <span class="comment">// The appending triggers and end of line, and then updates window :</span>
68300694 RECT rect;
68400695 GetClientRect(<a class="code" href="classG4UIWin32.html#r2">textWindow</a>,&amp;rect);
68500696 InvalidateRect(<a class="code" href="classG4UIWin32.html#r2">textWindow</a>,NULL,TRUE); <span class="comment">//To erase background.</span>
68600697 HDC hdc = GetDC(<a class="code" href="classG4UIWin32.html#r2">textWindow</a>);
68700698 ((<a class="code" href="classTextBuffer.html">TextBuffer</a>*)<a class="code" href="classG4UIWin32.html#r7">textBuffer</a>)-&gt;Draw(hdc,&amp;rect);
68800699 ReleaseDC (<a class="code" href="classG4UIWin32.html#r2">textWindow</a>,hdc);
68900700 <span class="keywordtype">int</span> linen = ((<a class="code" href="classTextBuffer.html">TextBuffer</a>*)<a class="code" href="classG4UIWin32.html#r7">textBuffer</a>)-&gt;GetNumberOfLines();
69000701 SetScrollRange(<a class="code" href="classG4UIWin32.html#r2">textWindow</a>,SB_VERT,0,linen-1,TRUE);
69100702 SetScrollPos(<a class="code" href="classG4UIWin32.html#r2">textWindow</a>,SB_VERT,linen-1,TRUE);
69200703 }
69300704 }
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>(
69500707 <span class="keyword">const</span> <span class="keywordtype">char</span>* aString
69600708 ,<span class="keywordtype">int</span>&amp; aInt
69700709 )
69800712 {
69900713 aInt = 0;
70000714 <span class="keywordflow">if</span>(aString==NULL) <span class="keywordflow">return</span> <span class="keyword">false</span>;
70100715 <span class="keywordtype">char</span>* s;
70200716 <span class="keywordtype">long</span> value = strtol(aString,&amp;s,10);
70300717 <span class="keywordflow">if</span>(s==aString) <span class="keywordflow">return</span> <span class="keyword">false</span>;
70400718 aInt = value;
70500719 <span class="keywordflow">return</span> <span class="keyword">true</span>;
70600720 }
70700721
70800722
70900723 <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>
Note: See TracBrowser for help on using the repository browser.