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

📄 _rich_text_editor_container_8cpp-source.html

📁 symbian OS中关于文本编辑功能的实现
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<a name="l00393"></a>00393     charFormatMask.SetAttrib(EAttFontTypeface);<a name="l00394"></a>00394     charFormatMask.SetAttrib(EAttFontHeight);<a name="l00395"></a>00395 <a name="l00396"></a>00396         <a class="code" href="class_c_r_t_e_container.html#714a273f76116be110f7a0bf8e2e6236">iRtEd</a>-&gt;ApplyCharFormatL(charFormat, charFormatMask);<a name="l00397"></a>00397 <a name="l00398"></a>00398         <a class="code" href="class_c_r_t_e_container.html#38bc46ca50d704160d45a75119a95774">Echo</a>(R_TYPE_DIALOG_TBUF_INDICATOR_FONT);<a name="l00399"></a>00399         }<a name="l00400"></a>00400 <span class="preprocessor">#else</span><a name="l00401"></a>00401 <span class="preprocessor"></span><span class="comment">// ----------------------------------------------------</span><a name="l00402"></a>00402 <span class="comment">// SetFont(const CFont *aFont)</span><a name="l00403"></a>00403 <span class="comment">// Change the text's font in the editor </span><a name="l00404"></a>00404 <span class="comment">// to the one specified as input parameter for the function </span><a name="l00405"></a>00405 <span class="comment">// ----------------------------------------------------</span><a name="l00406"></a><a class="code" href="class_c_r_t_e_container.html#061e324637a0ecbb00f0c822194240f2">00406</a> <span class="keywordtype">void</span> <a class="code" href="class_c_r_t_e_container.html#061e324637a0ecbb00f0c822194240f2">CRTEContainer::SetFont</a>(<span class="keyword">const</span> CFont *aFont)<a name="l00407"></a>00407         {       <a name="l00408"></a>00408                 <span class="comment">/*</span><a name="l00409"></a>00409 <span class="comment">        TCursorSelection cs = iRtEd-&gt;Selection();</span><a name="l00410"></a>00410 <span class="comment">        </span><a name="l00411"></a>00411 <span class="comment">        SetSelectionL(cs.iCursorPos, cs.iAnchorPos-1);</span><a name="l00412"></a>00412 <span class="comment">        */</span><a name="l00413"></a>00413     TFontSpec fontspec = aFont-&gt;FontSpecInTwips();<a name="l00414"></a>00414     TCharFormat charFormat( fontspec.iTypeface.iName, fontspec.iHeight );<a name="l00415"></a>00415     TCharFormatMask charFormatMask;<a name="l00416"></a>00416 <a name="l00417"></a>00417     charFormatMask.SetAttrib(EAttFontTypeface);<a name="l00418"></a>00418     charFormatMask.SetAttrib(EAttFontHeight);<a name="l00419"></a>00419         <a class="code" href="class_c_r_t_e_container.html#714a273f76116be110f7a0bf8e2e6236">iRtEd</a>-&gt;ApplyCharFormatL(charFormat, charFormatMask);<a name="l00420"></a>00420 <a name="l00421"></a>00421         <a class="code" href="class_c_r_t_e_container.html#38bc46ca50d704160d45a75119a95774">Echo</a>(R_TYPE_DIALOG_TBUF_INDICATOR_FONT);<a name="l00422"></a>00422         }<a name="l00423"></a>00423 <span class="preprocessor">#endif</span><a name="l00424"></a>00424 <span class="preprocessor"></span><span class="comment">// ----------------------------------------------------</span><a name="l00425"></a>00425 <span class="comment">// Strike()</span><a name="l00426"></a>00426 <span class="comment">// Toggle between strikethrough or not strikethrough text</span><a name="l00427"></a>00427 <span class="comment">// It depend only bool switch in the code, which turn to opposite in every </span><a name="l00428"></a>00428 <span class="comment">// case Strikethrough selected from the menu.</span><a name="l00429"></a>00429 <span class="comment">// ----------------------------------------------------</span><a name="l00430"></a><a class="code" href="class_c_r_t_e_container.html#10f4269acf9d1c486ce5706181f08f38">00430</a> <span class="keywordtype">void</span> <a class="code" href="class_c_r_t_e_container.html#10f4269acf9d1c486ce5706181f08f38">CRTEContainer::Strike</a>()<a name="l00431"></a>00431         {<a name="l00432"></a>00432     TCharFormat charFormat;<a name="l00433"></a>00433         TCharFormatMask charFormatMask;<a name="l00434"></a>00434 <a name="l00435"></a>00435         <a class="code" href="class_c_r_t_e_container.html#6000af4decfcfe07e4d797956b4601ec">iStrike</a>=!<a class="code" href="class_c_r_t_e_container.html#6000af4decfcfe07e4d797956b4601ec">iStrike</a>;<a name="l00436"></a>00436         charFormat.iFontPresentation.iStrikethrough=<a class="code" href="class_c_r_t_e_container.html#6000af4decfcfe07e4d797956b4601ec">iStrike</a>?EStrikethroughOn:EStrikethroughOff;<a name="l00437"></a>00437     charFormatMask.SetAttrib(EAttFontStrikethrough);<a name="l00438"></a>00438         <a class="code" href="class_c_r_t_e_container.html#714a273f76116be110f7a0bf8e2e6236">iRtEd</a>-&gt;ApplyCharFormatL(charFormat, charFormatMask);<a name="l00439"></a>00439 <a name="l00440"></a>00440         <span class="keywordflow">if</span>(<a class="code" href="class_c_r_t_e_container.html#6000af4decfcfe07e4d797956b4601ec">iStrike</a>)<a name="l00441"></a>00441                 {<a name="l00442"></a>00442                 <a class="code" href="class_c_r_t_e_container.html#38bc46ca50d704160d45a75119a95774">Echo</a>(R_TYPE_DIALOG_TBUF_INDICATOR_STRIKE_ON);<a name="l00443"></a>00443                 }<a name="l00444"></a>00444         <span class="keywordflow">else</span><a name="l00445"></a>00445                 {<a name="l00446"></a>00446                 Echo(R_TYPE_DIALOG_TBUF_INDICATOR_STRIKE_OFF);<a name="l00447"></a>00447                 }<a name="l00448"></a>00448         }<a name="l00449"></a>00449         <a name="l00450"></a>00450 <span class="comment">// ----------------------------------------------------</span><a name="l00451"></a>00451 <span class="comment">// SetColor(TRgb aColor)</span><a name="l00452"></a>00452 <span class="comment">// Set the selected text color based on the input parameter</span><a name="l00453"></a>00453 <span class="comment">// If nothing selected, text color changed only the cursor position.</span><a name="l00454"></a>00454 <span class="comment">// ----------------------------------------------------</span><a name="l00455"></a><a class="code" href="class_c_r_t_e_container.html#1c8ce06002012052d2e246a981f4654f">00455</a> <span class="keywordtype">void</span> <a class="code" href="class_c_r_t_e_container.html#1c8ce06002012052d2e246a981f4654f">CRTEContainer::SetColor</a>(TRgb aColor)<a name="l00456"></a>00456         {<a name="l00457"></a>00457         TCharFormat charFormat;<a name="l00458"></a>00458         TCharFormatMask charFormatMask;<a name="l00459"></a>00459 <a name="l00460"></a>00460         charFormat.iFontPresentation.iTextColor = aColor;<a name="l00461"></a>00461         charFormatMask.SetAttrib(EAttColor);<a name="l00462"></a>00462         <a class="code" href="class_c_r_t_e_container.html#714a273f76116be110f7a0bf8e2e6236">iRtEd</a>-&gt;ApplyCharFormatL(charFormat, charFormatMask);<a name="l00463"></a>00463         <a name="l00464"></a>00464 <span class="comment">//      iRtEd-&gt;SetBackgroundColorL(aColor); </span><a name="l00465"></a>00465 <span class="comment">//  It is possible to change the background color - if foreground and background </span><a name="l00466"></a>00466 <span class="comment">//  color is same, the text became invisible.</span><a name="l00467"></a>00467         }<a name="l00468"></a>00468 <a name="l00469"></a>00469 <span class="comment">// ----------------------------------------------------</span><a name="l00470"></a>00470 <span class="comment">// Echo(TInt aMessage)</span><a name="l00471"></a>00471 <span class="comment">// Echo the last operation to the status line</span><a name="l00472"></a>00472 <span class="comment">// ----------------------------------------------------</span><a name="l00473"></a><a class="code" href="class_c_r_t_e_container.html#38bc46ca50d704160d45a75119a95774">00473</a> <span class="keywordtype">void</span> <a class="code" href="class_c_r_t_e_container.html#38bc46ca50d704160d45a75119a95774">CRTEContainer::Echo</a>(TInt aMessage)<a name="l00474"></a>00474         {<a name="l00475"></a>00475         TBuf&lt;32&gt; buf;<a name="l00476"></a>00476         CEikonEnv::Static()-&gt;ReadResource(buf, aMessage);<a name="l00477"></a>00477         <a class="code" href="class_c_r_t_e_container.html#fabd5bcb3685cab3910529b0f983f726">iStatusLine</a>-&gt;SetTextL(buf);<a name="l00478"></a>00478         }<a name="l00479"></a>00479 <a name="l00480"></a>00480 <span class="comment">// ----------------------------------------------------</span><a name="l00481"></a>00481 <span class="comment">// IntroL()</span><a name="l00482"></a>00482 <span class="comment">// Create Intro Text.</span><a name="l00483"></a>00483 <span class="comment">// ----------------------------------------------------</span><a name="l00484"></a><a class="code" href="class_c_r_t_e_container.html#8939e114fd2cf016a7d09bf02b938de9">00484</a> <span class="keywordtype">void</span> <a class="code" href="class_c_r_t_e_container.html#8939e114fd2cf016a7d09bf02b938de9">CRTEContainer::IntroL</a>()<a name="l00485"></a>00485         {<a name="l00486"></a>00486         TBuf&lt;KBufSize&gt; Introbuf;<a name="l00487"></a>00487         CEikonEnv::Static()-&gt;ReadResource(Introbuf, R_TYPE_DIALOG_TBUF_INTRO_TEXT);<a name="l00488"></a>00488 <a name="l00489"></a>00489         TBuf&lt;KBufSize&gt; HelpText;<a name="l00490"></a>00490         CEikonEnv::Static()-&gt;ReadResource(HelpText, R_TYPE_DIALOG_TBUF_INTRO_HELP_TEXT);<a name="l00491"></a>00491         HelpText.Append(CEditableText::ELineBreak);<a name="l00492"></a>00492 <a name="l00493"></a>00493         <span class="comment">//Start the center format.</span><a name="l00494"></a>00494         <a class="code" href="class_c_r_t_e_container.html#618ba05ed3587bd0f47307bde788917b">SetAlignment</a>(CParaFormat::ECenterAlign);<a name="l00495"></a>00495         <a name="l00496"></a>00496         <span class="comment">//Set the text.</span><a name="l00497"></a>00497         <a class="code" href="class_c_r_t_e_container.html#714a273f76116be110f7a0bf8e2e6236">iRtEd</a>-&gt;SetTextL(&amp;Introbuf);<a name="l00498"></a>00498         <a class="code" href="class_c_r_t_e_container.html#714a273f76116be110f7a0bf8e2e6236">iRtEd</a>-&gt;RichText()-&gt;InsertL(<a class="code" href="class_c_r_t_e_container.html#714a273f76116be110f7a0bf8e2e6236">iRtEd</a>-&gt;Text()-&gt;DocumentLength()<span class="comment">/* at the end*/</span>, HelpText);<a name="l00499"></a>00499         <a name="l00500"></a>00500         <a class="code" href="class_c_r_t_e_container.html#38bc46ca50d704160d45a75119a95774">Echo</a>(R_TYPE_DIALOG_TBUF_INDICATOR_DEMO);<a name="l00501"></a>00501         }<a name="l00502"></a>00502 <a name="l00503"></a>00503 <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 + -