📄 helloworldbasicappui_8cpp-source.html
字号:
<a name="l00112"></a>00112 <span class="keywordflow">if</span> ( <a class="code" href="class_c_hello_world_basic_app_ui.html#45dd0a3e0e75e56b4727a01a8ef2c6b1">iAppView</a> )<a name="l00113"></a>00113 {<a name="l00114"></a>00114 <span class="keyword">delete</span> <a class="code" href="class_c_hello_world_basic_app_ui.html#45dd0a3e0e75e56b4727a01a8ef2c6b1">iAppView</a>;<a name="l00115"></a>00115 <a class="code" href="class_c_hello_world_basic_app_ui.html#45dd0a3e0e75e56b4727a01a8ef2c6b1">iAppView</a> = NULL;<a name="l00116"></a>00116 }<a name="l00117"></a>00117 }<a name="l00118"></a>00118 <a name="l00119"></a>00119 <span class="comment">// -----------------------------------------------------------------------------</span><a name="l00120"></a>00120 <span class="comment">// CHelloWorldBasicAppUi::HandleCommandL()</span><a name="l00121"></a>00121 <span class="comment">// Takes care of command handling.</span><a name="l00122"></a>00122 <span class="comment">// -----------------------------------------------------------------------------</span><a name="l00123"></a>00123 <span class="comment">//</span><a name="l00124"></a><a class="code" href="class_c_hello_world_basic_app_ui.html#a682d228622cea7790645ce10f591242">00124</a> <span class="keywordtype">void</span> <a class="code" href="class_c_hello_world_basic_app_ui.html#a682d228622cea7790645ce10f591242">CHelloWorldBasicAppUi::HandleCommandL</a>( TInt aCommand )<a name="l00125"></a>00125 {<a name="l00126"></a>00126 <span class="comment">// clear possible old user-given text</span><a name="l00127"></a>00127 <a class="code" href="class_c_hello_world_basic_app_ui.html#45dd0a3e0e75e56b4727a01a8ef2c6b1">iAppView</a>-><a class="code" href="class_c_hello_world_basic_app_view.html#59cee462c5e06d883260d21037a3ebd7">GetText</a>().Zero();<a name="l00128"></a>00128 <a name="l00129"></a>00129 <span class="keywordflow">switch</span>( aCommand )<a name="l00130"></a>00130 {<a name="l00131"></a>00131 <span class="keywordflow">case</span> EEikCmdExit:<a name="l00132"></a>00132 <span class="keywordflow">case</span> EAknSoftkeyExit:<a name="l00133"></a>00133 Exit();<a name="l00134"></a>00134 <span class="keywordflow">break</span>;<a name="l00135"></a>00135 <a name="l00136"></a>00136 <span class="keywordflow">case</span> EHelloWorldBasicCommand1:<a name="l00137"></a>00137 {<a name="l00138"></a>00138 <span class="comment">// Load a string from the resource file and display it</span><a name="l00139"></a>00139 HBufC* textResource = StringLoader::LoadLC( R_HEWB_COMMAND1_TEXT );<a name="l00140"></a>00140 CAknInformationNote* note = <span class="keyword">new</span> ( ELeave ) CAknInformationNote;<a name="l00141"></a>00141 <a name="l00142"></a>00142 <span class="comment">// Show the information Note with</span><a name="l00143"></a>00143 <span class="comment">// textResource loaded with StringLoader.</span><a name="l00144"></a>00144 note->ExecuteLD( *textResource );<a name="l00145"></a>00145 <a name="l00146"></a>00146 <span class="comment">// Pop HBuf from CleanUpStack and Destroy it.</span><a name="l00147"></a>00147 CleanupStack::PopAndDestroy( textResource );<a name="l00148"></a>00148 }<a name="l00149"></a>00149 <span class="keywordflow">break</span>;<a name="l00150"></a>00150 <a name="l00151"></a>00151 <span class="keywordflow">case</span> EHelloWorldBasicCommand2:<a name="l00152"></a>00152 {<a name="l00153"></a>00153 RFs fsSession;<a name="l00154"></a>00154 RFile rFile;<a name="l00155"></a>00155 <a name="l00156"></a>00156 <span class="comment">// Connects a client process to the fileserver</span><a name="l00157"></a>00157 User::LeaveIfError(fsSession.Connect());<a name="l00158"></a>00158 CleanupClosePushL(fsSession);<a name="l00159"></a>00159 <a name="l00160"></a>00160 <span class="comment">//Open file where the stream text is</span><a name="l00161"></a>00161 User::LeaveIfError(rFile.Open(fsSession,KHelloFileName, EFileStreamText));<a name="l00162"></a>00162 CleanupClosePushL(rFile);<a name="l00163"></a>00163 <a name="l00164"></a>00164 <span class="comment">// copy stream from file to RFileStream object</span><a name="l00165"></a>00165 RFileReadStream inputFileStream(rFile);<a name="l00166"></a>00166 CleanupClosePushL(inputFileStream);<a name="l00167"></a>00167 <a name="l00168"></a>00168 <span class="comment">// HBufC descriptor is created from the RFileStream object.</span><a name="l00169"></a>00169 HBufC* fileData = HBufC::NewLC(inputFileStream, 32);<a name="l00170"></a>00170 <a name="l00171"></a>00171 CAknInformationNote* note = <span class="keyword">new</span> ( ELeave ) CAknInformationNote;<a name="l00172"></a>00172 <a name="l00173"></a>00173 <span class="comment">// Show the information Note</span><a name="l00174"></a>00174 note->ExecuteLD( *fileData );<a name="l00175"></a>00175 <a name="l00176"></a>00176 <span class="comment">// Pop loaded resources from the cleanup stack:</span><a name="l00177"></a>00177 <span class="comment">// filedata, inputFileStream, rFile, fsSession</span><a name="l00178"></a>00178 CleanupStack::PopAndDestroy(4, &fsSession);<a name="l00179"></a>00179 }<a name="l00180"></a>00180 <span class="keywordflow">break</span>;<a name="l00181"></a>00181 <a name="l00182"></a>00182 <span class="keywordflow">case</span> EHelloWorldBasicCommand3:<a name="l00183"></a>00183 {<a name="l00184"></a>00184 <span class="comment">// Load a string from the resources and use it as a default value</span><a name="l00185"></a>00185 HBufC* defaultText = StringLoader::LoadLC( R_HEWB_FILE_TEXT );<a name="l00186"></a>00186 <a name="l00187"></a>00187 <a class="code" href="class_c_hello_world_query_dialog.html">CHelloWorldQueryDialog</a> *dlg = <span class="keyword">new</span> (ELeave)<a name="l00188"></a>00188 <a class="code" href="class_c_hello_world_query_dialog.html">CHelloWorldQueryDialog</a>( <a class="code" href="class_c_hello_world_basic_app_ui.html#45dd0a3e0e75e56b4727a01a8ef2c6b1">iAppView</a>-><a class="code" href="class_c_hello_world_basic_app_view.html#59cee462c5e06d883260d21037a3ebd7">GetText</a>(), defaultText );<a name="l00189"></a>00189 <a name="l00190"></a>00190 dlg->ExecuteLD( R_DIALOG_TEXT_EDIT_QUERY );<a name="l00191"></a>00191 <a name="l00192"></a>00192 <span class="comment">// Pop HBuf from CleanUpStack and Destroy it.</span><a name="l00193"></a>00193 CleanupStack::PopAndDestroy( defaultText );<a name="l00194"></a>00194 }<a name="l00195"></a>00195 <span class="keywordflow">break</span>;<a name="l00196"></a>00196 <a name="l00197"></a>00197 <span class="keywordflow">default</span>:<a name="l00198"></a>00198 <span class="keywordflow">break</span>;<a name="l00199"></a>00199 }<a name="l00200"></a>00200 }<a name="l00201"></a>00201 <span class="comment">// -----------------------------------------------------------------------------</span><a name="l00202"></a>00202 <span class="comment">// Called by framework when layout is changed.</span><a name="l00203"></a>00203 <span class="comment">// Passes the new client rectangle to the AppView</span><a name="l00204"></a>00204 <span class="comment">// -----------------------------------------------------------------------------</span><a name="l00205"></a>00205 <span class="comment">//</span><a name="l00206"></a><a class="code" href="class_c_hello_world_basic_app_ui.html#6acdbe8a9b57446075bf46d035e751eb">00206</a> <span class="keywordtype">void</span> <a class="code" href="class_c_hello_world_basic_app_ui.html#6acdbe8a9b57446075bf46d035e751eb">CHelloWorldBasicAppUi::HandleResourceChangeL</a>( TInt aType )<a name="l00207"></a>00207 {<a name="l00208"></a>00208 <span class="comment">// base-class call also</span><a name="l00209"></a>00209 CAknAppUi::HandleResourceChangeL(aType);<a name="l00210"></a>00210 <span class="keywordflow">if</span> (aType == KEikDynamicLayoutVariantSwitch)<a name="l00211"></a>00211 {<a name="l00212"></a>00212 <span class="keywordflow">if</span> (<a class="code" href="class_c_hello_world_basic_app_ui.html#45dd0a3e0e75e56b4727a01a8ef2c6b1">iAppView</a>)<a name="l00213"></a>00213 iAppView->SetRect( ClientRect() );<a name="l00214"></a>00214 }<a name="l00215"></a>00215 }<a name="l00216"></a>00216 <a name="l00217"></a>00217 <span class="comment">// End of File</span><a name="l00218"></a>00218 </pre></div><hr><table x-use-null-cells style="x-cell-content-align: top; width: 100%; border-spacing: 0px; border-spacing: 0px;" cellspacing=0 width=100%> <col style="width: 50%;"> <col style="width: 50%;"> <tr style="x-cell-content-align: top;" valign=top> <td style="width: 50%; padding-right: 10px; padding-left: 10px; border-right-style: None; border-left-style: None; border-top-style: None; border-bottom-style: None;" width=50%> <p style="font-family: Arial;"><small style="font-size: smaller;">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -