⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 focuseventappview_8cpp-source.html

📁 用来学习 焦点 的 的例子,可以 好好看看焦点在 symbian中很重要,
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<a name="l00096"></a><a class="code" href="class_c_focus_event_app_view.html#67f946ca7848ec78de4961c5bcefdb72">00096</a> <span class="keywordtype">void</span> <a class="code" href="class_c_focus_event_app_view.html#67f946ca7848ec78de4961c5bcefdb72">CFocusEventAppView::Draw</a>( <span class="keyword">const</span> TRect&amp; <span class="comment">/*aRect*/</span> )<span class="keyword"> const</span><a name="l00097"></a>00097 <span class="keyword">    </span>{<a name="l00098"></a>00098 <a name="l00099"></a>00099     <span class="comment">// Get the standard graphics context</span><a name="l00100"></a>00100     CWindowGc&amp; gc = SystemGc();<a name="l00101"></a>00101 <a name="l00102"></a>00102     <span class="comment">// Gets the control's extent</span><a name="l00103"></a>00103     TRect drawRect=Rect();<a name="l00104"></a>00104     gc.UseFont( NEikonEnvironment::EikEnv().AnnotationFont() );<a name="l00105"></a>00105 <a name="l00106"></a>00106     <span class="comment">// Clears the screen</span><a name="l00107"></a>00107     gc.Clear( drawRect );<a name="l00108"></a>00108 <a name="l00109"></a>00109     <span class="comment">// Draw all lines of text</span><a name="l00110"></a>00110     TInt count;<a name="l00111"></a>00111     <span class="keywordflow">for</span> ( count = 0; count &lt; <a class="code" href="class_c_focus_event_app_view.html#074ac1c7490630dfae97d172ebbb7d45">iTextLines</a>.Count(); count++ )<a name="l00112"></a>00112         {<a name="l00113"></a>00113         gc.DrawText( <a class="code" href="class_c_focus_event_app_view.html#074ac1c7490630dfae97d172ebbb7d45">iTextLines</a>[ count ],<a name="l00114"></a>00114         TPoint( KTextXMargin, KTextMinY+<a name="l00115"></a>00115                                      ( count*KTextDistanceBetweenLines ) ) );<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">// CFocusEventAppView::Print()</span><a name="l00121"></a>00121 <span class="comment">// Show text on screen.</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_focus_event_app_view.html#cb774d5077102fc3c5dbdb7df1261389">00124</a> <span class="keywordtype">void</span> <a class="code" href="class_c_focus_event_app_view.html#cb774d5077102fc3c5dbdb7df1261389">CFocusEventAppView::Print</a>( <span class="keyword">const</span> TDesC&amp; aText )<a name="l00125"></a>00125     {<a name="l00126"></a>00126     <a class="code" href="class_c_focus_event_app_view.html#0e66541056b289546108814685519f69">ShowTextOnScreen</a>( aText );<a name="l00127"></a>00127     }<a name="l00128"></a>00128 <a name="l00129"></a>00129 <span class="comment">// -----------------------------------------------------------------------------</span><a name="l00130"></a>00130 <span class="comment">// CFocusEventAppView::ShowTextOnScreen()</span><a name="l00131"></a>00131 <span class="comment">// Show text on screen.</span><a name="l00132"></a>00132 <span class="comment">// -----------------------------------------------------------------------------</span><a name="l00133"></a>00133 <span class="comment">//</span><a name="l00134"></a><a class="code" href="class_c_focus_event_app_view.html#0e66541056b289546108814685519f69">00134</a> <span class="keywordtype">void</span> <a class="code" href="class_c_focus_event_app_view.html#0e66541056b289546108814685519f69">CFocusEventAppView::ShowTextOnScreen</a>( <span class="keyword">const</span> TDesC&amp; aText )<a name="l00135"></a>00135     {<a name="l00136"></a>00136     <span class="comment">// Add the text line onto the last line</span><a name="l00137"></a>00137     TInt lastTextLine = <a class="code" href="class_c_focus_event_app_view.html#074ac1c7490630dfae97d172ebbb7d45">iTextLines</a>.Count() - 1;<a name="l00138"></a>00138 <a name="l00139"></a>00139     <span class="comment">// Make sure the text line doesn't get too long for the buffer.</span><a name="l00140"></a>00140     <span class="comment">// This should really clip rather than not do anything</span><a name="l00141"></a>00141     <span class="comment">// if the line is too long.</span><a name="l00142"></a>00142     <span class="keywordflow">if</span> ( aText.Length() + <a class="code" href="class_c_focus_event_app_view.html#074ac1c7490630dfae97d172ebbb7d45">iTextLines</a>[ lastTextLine ].Length()<a name="l00143"></a>00143                                   &lt;= KTestFrameworkMaxScreenMessageLength )<a name="l00144"></a>00144         {<a name="l00145"></a>00145         <a class="code" href="class_c_focus_event_app_view.html#074ac1c7490630dfae97d172ebbb7d45">iTextLines</a>[ lastTextLine ].Append( aText );<a name="l00146"></a>00146         DrawNow();<a name="l00147"></a>00147         }<a name="l00148"></a>00148     }<a name="l00149"></a>00149 <a name="l00150"></a>00150 <span class="comment">// -----------------------------------------------------------------------------</span><a name="l00151"></a>00151 <span class="comment">// CFocusEventAppView::PrintNewLineL()</span><a name="l00152"></a>00152 <span class="comment">// Print new line.</span><a name="l00153"></a>00153 <span class="comment">// -----------------------------------------------------------------------------</span><a name="l00154"></a>00154 <span class="comment">//</span><a name="l00155"></a><a class="code" href="class_c_focus_event_app_view.html#07d5ce838d6f875de7f10db4e60a0f6a">00155</a> <span class="keywordtype">void</span> <a class="code" href="class_c_focus_event_app_view.html#07d5ce838d6f875de7f10db4e60a0f6a">CFocusEventAppView::PrintNewLineL</a>()<a name="l00156"></a>00156     {<a name="l00157"></a>00157     <span class="comment">// Add a new line onto the array</span><a name="l00158"></a>00158     <span class="comment">// If the array is already at the maximum size,</span><a name="l00159"></a>00159     <span class="comment">// delete the first line of text</span><a name="l00160"></a>00160     <span class="keywordflow">if</span> ( <a class="code" href="class_c_focus_event_app_view.html#074ac1c7490630dfae97d172ebbb7d45">iTextLines</a>.Count() &gt;= KMaxTextLines )<a name="l00161"></a>00161         {<a name="l00162"></a>00162         <a class="code" href="class_c_focus_event_app_view.html#074ac1c7490630dfae97d172ebbb7d45">iTextLines</a>.Remove( 0 );<a name="l00163"></a>00163         }<a name="l00164"></a>00164     User::LeaveIfError( iTextLines.Append( KNullDesC() ) );<a name="l00165"></a>00165     DrawNow();<a name="l00166"></a>00166     }<a name="l00167"></a>00167 <a name="l00168"></a>00168 <span class="comment">// ---------------------------------------------------------</span><a name="l00169"></a>00169 <span class="comment">// CFocusEventAppView::HandleResourceChange()</span><a name="l00170"></a>00170 <span class="comment">// Called by framework when layout is changed.</span><a name="l00171"></a>00171 <span class="comment">// ---------------------------------------------------------</span><a name="l00172"></a>00172 <span class="comment">//</span><a name="l00173"></a><a class="code" href="class_c_focus_event_app_view.html#389d15aa1abc22fb211d040f034e4e31">00173</a> <span class="keywordtype">void</span> <a class="code" href="class_c_focus_event_app_view.html#389d15aa1abc22fb211d040f034e4e31">CFocusEventAppView::HandleResourceChange</a>(TInt aType)<a name="l00174"></a>00174     {<a name="l00175"></a>00175     CCoeControl::HandleResourceChange(aType);<a name="l00176"></a>00176 <a name="l00177"></a>00177     <span class="comment">// ADDED FOR SCALABLE UI SUPPORT</span><a name="l00178"></a>00178     <span class="comment">// *****************************</span><a name="l00179"></a>00179     <span class="keywordflow">if</span> ( aType==KEikDynamicLayoutVariantSwitch )<a name="l00180"></a>00180         {<a name="l00181"></a>00181         TRect rect;<a name="l00182"></a>00182         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);<a name="l00183"></a>00183         SetRect(rect);<a name="l00184"></a>00184         }<a name="l00185"></a>00185     }<a name="l00186"></a>00186 <span class="comment">// End of File</span></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 + -