📄 fg__edit_8cpp-source.html
字号:
00113 <span class="keywordflow">if</span> (<a class="code" href="classFG__TextWidget.html#a3">TextLength</a>() < <a class="code" href="classFG__Edit.html#p0">m_wLimit</a>)00114 <a class="code" href="classFG__Edit.html#d0">InsertChar</a>((<a class="code" href="group__Utility.html#ga1">WORD</a>)pMsg-><a class="code" href="structFG__Message.html#o4">lData</a>);00115 <span class="keywordflow">return</span> <span class="keyword">true</span>;00116 }00117 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (pMsg-><a class="code" href="structFG__Message.html#o4">lData</a> == <a class="code" href="group__Virtual__Key.html#ga13">FVK_DELETE</a>)00118 {00119 <a class="code" href="classFG__Edit.html#d1">DeleteChar</a>();00120 <span class="keywordflow">return</span> <span class="keyword">true</span>;00121 }00122 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (pMsg-><a class="code" href="structFG__Message.html#o4">lData</a> == <a class="code" href="group__Virtual__Key.html#ga14">FVK_LEFT</a>)00123 {00124 <span class="keywordflow">if</span> (<a class="code" href="classFG__Edit.html#p1">m_wCursorPos</a> > 0)00125 {00126 <a class="code" href="classFG__Edit.html#p1">m_wCursorPos</a> --;00127 <a class="code" href="classFG__Edit.html#d2">DrawWithCursor</a>();00128 }00129 <span class="keywordflow">return</span> <span class="keyword">true</span>;00130 }00131 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (pMsg-><a class="code" href="structFG__Message.html#o4">lData</a> == <a class="code" href="group__Virtual__Key.html#ga15">FVK_RIGHT</a>)00132 {00133 <span class="keywordflow">if</span> (<a class="code" href="classFG__Edit.html#p1">m_wCursorPos</a> < <a class="code" href="classFG__TextWidget.html#a3">TextLength</a>())00134 {00135 <a class="code" href="classFG__Edit.html#p1">m_wCursorPos</a> ++;00136 <a class="code" href="classFG__Edit.html#d2">DrawWithCursor</a>();00137 }00138 <span class="keywordflow">return</span> <span class="keyword">true</span>;00139 }00140 <span class="keywordflow">else</span>00141 <span class="keywordflow">return</span> <span class="keyword">false</span>;00142 }00143 00144 <span class="comment">//##ModelId=3F65E8E203AF</span><a name="l00145"></a><a class="code" href="classFG__Edit.html#b3">00145</a> <span class="keywordtype">void</span> <a class="code" href="classFG__Edit.html#b3">FG_Edit::OnCursorTimer</a>(<span class="keywordtype">void</span>)00146 {00147 <span class="keywordflow">if</span> (<a class="code" href="classFG__Object.html#a19">IsFocus</a>())00148 {00149 <a class="code" href="classFG__Edit.html#p2">m_bDrawCursor</a> = ! <a class="code" href="classFG__Edit.html#p2">m_bDrawCursor</a>;00150 <a class="code" href="classFG__Object.html#b4">RequestDraw</a>();00151 }00152 }00153 00154 <span class="comment">//##ModelId=3F65E8E203B9</span><a name="l00155"></a><a class="code" href="classFG__Edit.html#b4">00155</a> <span class="keywordtype">void</span> <a class="code" href="classFG__Edit.html#b4">FG_Edit::OnFocus</a>(<a class="code" href="structFG__Message.html">FG_Message</a> * pMsg)00156 {00157 <span class="keywordflow">if</span> (pMsg-><a class="code" href="structFG__Message.html#o1">wData</a> == <a class="code" href="group__Utility.html#gga15a35">FFS_GET</a>)00158 <a class="code" href="classFG__Edit.html#p2">m_bDrawCursor</a> = <span class="keyword">true</span>;00159 <span class="keywordflow">else</span>00160 <a class="code" href="classFG__Edit.html#p2">m_bDrawCursor</a> = <span class="keyword">false</span>;00161 00162 <a class="code" href="classFG__Object.html#b7">FG_Label::OnFocus</a>(pMsg);00163 }00164 00165 <span class="comment">//##ModelId=3F65E8E2039A</span><a name="l00166"></a><a class="code" href="classFG__Edit.html#b2">00166</a> <span class="keywordtype">bool</span> <a class="code" href="classFG__Edit.html#b2">FG_Edit::OnMouse</a>(<a class="code" href="structFG__Message.html">FG_Message</a> * pMsg)00167 {00168 <span class="keywordflow">if</span> (m_pParent)00169 ((<a class="code" href="classFG__Window.html">FG_Window</a> *)m_pParent)->ChangeFocus(<span class="keyword">this</span>);00170 <span class="keywordflow">return</span> <span class="keyword">true</span>;00171 }00172 00173 <span class="comment">//##ModelId=3F65E8E203D7</span><a name="l00174"></a><a class="code" href="classFG__Edit.html#d0">00174</a> <span class="keywordtype">void</span> <a class="code" href="classFG__Edit.html#d0">FG_Edit::InsertChar</a>(<a class="code" href="group__Utility.html#ga1">WORD</a> wKey)00175 {00176 <a class="code" href="group__Utility.html#ga1">WORD</a> length = <a class="code" href="classFG__TextWidget.html#a3">TextLength</a>();00177 <span class="keywordtype">char</span> * temp = <span class="keyword">new</span> <span class="keywordtype">char</span>[length + 2];00178 00179 memcpy(temp, <a class="code" href="classFG__TextWidget.html#a1">GetText</a>(), <a class="code" href="classFG__Edit.html#p1">m_wCursorPos</a>);00180 temp[<a class="code" href="classFG__Edit.html#p1">m_wCursorPos</a>] = (<span class="keywordtype">char</span>)wKey;00181 memcpy(temp + <a class="code" href="classFG__Edit.html#p1">m_wCursorPos</a> + 1, <a class="code" href="classFG__TextWidget.html#a1">GetText</a>() + m_wCursorPos, <a class="code" href="classFG__TextWidget.html#a3">TextLength</a>() - m_wCursorPos);00182 temp[length + 1] = 0;00183 <a class="code" href="classFG__TextWidget.html#a2">SetText</a>(temp);00184 m_wCursorPos ++;00185 <span class="keyword">delete</span> [] temp;00186 00187 <a class="code" href="classFG__Edit.html#d2">DrawWithCursor</a>();00188 }00189 00190 <span class="comment">//##ModelId=3F65E8E30003</span><a name="l00191"></a><a class="code" href="classFG__Edit.html#d1">00191</a> <span class="keywordtype">void</span> <a class="code" href="classFG__Edit.html#d1">FG_Edit::DeleteChar</a>(<span class="keywordtype">void</span>)00192 {00193 <span class="keywordflow">if</span> (<a class="code" href="classFG__Edit.html#p1">m_wCursorPos</a> < <a class="code" href="classFG__TextWidget.html#a3">TextLength</a>())00194 {00195 <a class="code" href="group__Utility.html#ga1">WORD</a> length = <a class="code" href="classFG__TextWidget.html#a3">TextLength</a>();00196 <span class="keywordflow">if</span> (length > 1)00197 {00198 <span class="keywordtype">char</span> * temp = <span class="keyword">new</span> <span class="keywordtype">char</span>[length];00199 00200 memcpy(temp, m_Text.<a class="code" href="classFG__String.html#a4">DataGet</a>(), <a class="code" href="classFG__Edit.html#p1">m_wCursorPos</a>);00201 memcpy(temp + <a class="code" href="classFG__Edit.html#p1">m_wCursorPos</a>, <a class="code" href="classFG__TextWidget.html#a1">GetText</a>() + m_wCursorPos + 1, <a class="code" href="classFG__TextWidget.html#a3">TextLength</a>() - m_wCursorPos - 1);00202 temp[length - 1] = 0;00203 m_Text.<a class="code" href="classFG__String.html#a3">DataSet</a>(temp);00204 <span class="keyword">delete</span> []temp;00205 }00206 <span class="keywordflow">else</span>00207 m_Text.<a class="code" href="classFG__String.html#a3">DataSet</a>(<a class="code" href="group__Utility.html#ga11">NULL</a>);00208 00209 <a class="code" href="classFG__Edit.html#d2">DrawWithCursor</a>();00210 }00211 }00212 00213 <span class="comment">//##ModelId=3F65E8E30017</span><a name="l00214"></a><a class="code" href="classFG__Edit.html#d2">00214</a> <span class="keywordtype">void</span> <a class="code" href="classFG__Edit.html#d2">FG_Edit::DrawWithCursor</a>(<span class="keywordtype">void</span>)00215 {00216 <a class="code" href="classFG__Edit.html#p2">m_bDrawCursor</a> = <span class="keyword">true</span>;00217 <a class="code" href="classFG__Object.html#b4">RequestDraw</a>();00218 }00219 </pre></div><hr><center>由 DoxyGen 1.3.6 于 Wed Jun 9 22:34:40 2004 生成<br>版权所有 (C) 2003,2004 王咏武</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -