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

📄 fg__object_8cpp-source.html

📁 《道法自然》书的源码FishGUI,一个跨平台的界面库
💻 HTML
📖 第 1 页 / 共 2 页
字号:
00134         <span class="keywordflow">break</span>;00135 00136     <span class="keywordflow">case</span> <a class="code" href="group__Frame__Style.html#ga0">FS_NONE</a>:00137         pAdaptor-&gt;<a class="code" href="classFG__OSAdaptor.html#a5">FillRect</a>(m_Rect, <a class="code" href="classFG__Object.html#p1">m_Background</a>, <a class="code" href="classFG__Object.html#p1">m_Background</a>);00138         <span class="keywordflow">break</span>;00139 00140     <span class="keywordflow">default</span>:00141         <span class="keywordflow">break</span>;00142     }00143 00144         pAdaptor-&gt;<a class="code" href="classFG__OSAdaptor.html#a4">EndDraw</a>();00145 }00146 <a name="l00147"></a><a class="code" href="classFG__Object.html#a3">00147</a> <span class="keywordtype">void</span> <a class="code" href="classFG__Object.html#a3">FG_Object::GetClientRect</a>(<a class="code" href="structFG__Rect.html">FG_Rect</a> &amp; rect)<span class="keyword"> const</span>00148 <span class="keyword"></span>{00149     <span class="comment">// 根据边框风格除去不同的边框大小</span>00150         <span class="keywordflow">switch</span> (<a class="code" href="classFG__Object.html#p3">m_wStyle</a> &amp; <a class="code" href="group__Frame__Style.html#ga4">FS_MASK</a>)00151         {00152         <span class="keywordflow">case</span> <a class="code" href="group__Frame__Style.html#ga2">FS_RAISED</a>:00153         <span class="keywordflow">case</span> <a class="code" href="group__Frame__Style.html#ga3">FS_RECESSED</a>:00154                 rect = <a class="code" href="classFG__Object.html#p2">m_Rect</a>;00155                 rect -= 2;00156                 <span class="keywordflow">break</span>;00157         <span class="keywordflow">case</span> <a class="code" href="group__Frame__Style.html#ga1">FS_THIN</a>:00158                 rect = m_Rect;00159                 rect -= 1;00160                 <span class="keywordflow">break</span>;00161         <span class="keywordflow">case</span> <a class="code" href="group__Frame__Style.html#ga0">FS_NONE</a>:00162                 rect = m_Rect;00163                 <span class="keywordflow">break</span>;00164         <span class="keywordflow">default</span>:00165                 rect.<a class="code" href="structFG__Rect.html#a2">Set</a>(0, 0, 0, 0);00166                 <span class="keywordflow">break</span>;00167         }00168 }00169 <a name="l00170"></a><a class="code" href="classFG__Object.html#a20">00170</a> <span class="keywordtype">bool</span> <a class="code" href="classFG__Object.html#a20">FG_Object::Message</a>(<a class="code" href="structFG__Message.html">FG_Message</a> * pMsg)00171 {00172     <span class="comment">// 通过虚函数得到该类的消息映射表指针</span>00173     <span class="keyword">const</span> <a class="code" href="structFG__MSGMAP.html">FG_MSGMAP</a> * pMsgMap = <a class="code" href="classFG__Object.html#b5">GetMessageMap</a>();00174 00175     <span class="comment">// 从本类向基类循环查找消息映射表,直到找到该消息,或到达最后的基类</span>00176     <span class="keywordflow">for</span> ( ; pMsgMap; pMsgMap = pMsgMap-&gt;<a class="code" href="structFG__MSGMAP.html#o0">m_pBaseMsgMap</a>)00177     {00178         <span class="comment">// 在一个消息映射表中查找该消息</span>00179         <span class="keyword">const</span> <a class="code" href="structFG__MSGMAP__ENTRY.html">FG_MSGMAP_ENTRY</a> * lpEntry = pMsgMap-&gt;<a class="code" href="structFG__MSGMAP.html#a0">FindMsgCallback</a>(pMsg-&gt;<a class="code" href="structFG__Message.html#o0">wType</a>, pMsg-&gt;<a class="code" href="structFG__Message.html#o1">wData</a>, pMsg-&gt;<a class="code" href="structFG__Message.html#o2">wID</a>);00180         <span class="keywordflow">if</span> (lpEntry-&gt;<a class="code" href="structFG__MSGMAP__ENTRY.html#o3">m_Callback</a>)00181         {00182             <span class="comment">// 根据消息类型分发消息</span>00183             <span class="keywordflow">switch</span> (pMsg-&gt;<a class="code" href="structFG__Message.html#o0">wType</a>)00184             {00185             <span class="keywordflow">case</span> <a class="code" href="group__Utility.html#gga12a19">FG_MSG_DRAW</a>:00186                 {00187                     <a class="code" href="classFG__OSAdaptor.html">FG_OSAdaptor</a> * pAdaptor = <a class="code" href="group__OSAdaptor.html#ga1">FG_GetAdaptor</a>();00188                     <span class="keywordflow">if</span> (! pAdaptor)00189                         <span class="keywordflow">return</span> <span class="keyword">false</span>;00190                     <span class="comment">// 把消息处理函数的指针强制转换成正确的类型</span>00191                     <a class="code" href="group__MsgHandler__Type.html#ga1">FG_PMSG_vd</a> pfn = (<a class="code" href="group__MsgHandler__Type.html#ga1">FG_PMSG_vd</a>)lpEntry-&gt;<a class="code" href="structFG__MSGMAP__ENTRY.html#o3">m_Callback</a>;00192                     <span class="comment">// 调用消息处理函数</span>00193                     (this-&gt;*pfn)(pAdaptor);00194                 }00195                 <span class="keywordflow">return</span> <span class="keyword">true</span>;00196             <span class="keywordflow">case</span> <a class="code" href="group__Utility.html#gga12a20">FG_MSG_KEY</a>:00197             <span class="keywordflow">case</span> <a class="code" href="group__Utility.html#gga12a21">FG_MSG_MOUSE</a>:00198                 {00199                     <a class="code" href="group__MsgHandler__Type.html#ga3">FG_PMSG_bm</a> pfn = (<a class="code" href="group__MsgHandler__Type.html#ga3">FG_PMSG_bm</a>)lpEntry-&gt;<a class="code" href="structFG__MSGMAP__ENTRY.html#o3">m_Callback</a>;00200                     <span class="keywordflow">return</span> (this-&gt;*pfn)(pMsg);00201                 }00202             <span class="keywordflow">case</span> <a class="code" href="group__Utility.html#gga12a25">FG_MSG_FOCUS</a>:00203             <span class="keywordflow">case</span> <a class="code" href="group__Utility.html#gga12a24">FG_MSG_DRAW_REQUEST</a>:00204                 {00205                     <a class="code" href="group__MsgHandler__Type.html#ga2">FG_PMSG_vm</a> pfn = (<a class="code" href="group__MsgHandler__Type.html#ga2">FG_PMSG_vm</a>)lpEntry-&gt;<a class="code" href="structFG__MSGMAP__ENTRY.html#o3">m_Callback</a>;00206                     (this-&gt;*pfn)(pMsg);00207                 }00208                 <span class="keywordflow">return</span> <span class="keyword">true</span>;00209             <span class="keywordflow">case</span> <a class="code" href="group__Utility.html#gga12a22">FG_MSG_TIMER</a>:00210             <span class="keywordflow">case</span> <a class="code" href="group__Utility.html#gga12a27">FG_MSG_UPDATE_VIEW</a>:00211                 (this-&gt;*(lpEntry-&gt;<a class="code" href="structFG__MSGMAP__ENTRY.html#o3">m_Callback</a>))();00212                 <span class="keywordflow">return</span> <span class="keyword">true</span>;00213             <span class="keywordflow">case</span> <a class="code" href="group__Utility.html#gga12a26">FG_MSG_NOTIFY</a>:00214                 <span class="keywordflow">if</span> (lpEntry-&gt;<a class="code" href="structFG__MSGMAP__ENTRY.html#o2">m_wID</a>)00215                     (this-&gt;*(lpEntry-&gt;<a class="code" href="structFG__MSGMAP__ENTRY.html#o3">m_Callback</a>))();00216                 <span class="keywordflow">else</span>00217                 {00218                     <a class="code" href="group__MsgHandler__Type.html#ga2">FG_PMSG_vm</a> pfn = (<a class="code" href="group__MsgHandler__Type.html#ga2">FG_PMSG_vm</a>)lpEntry-&gt;<a class="code" href="structFG__MSGMAP__ENTRY.html#o3">m_Callback</a>;00219                     (this-&gt;*pfn)(pMsg);00220                 }00221                 <span class="keywordflow">return</span> <span class="keyword">true</span>;00222             <span class="keywordflow">default</span>:00223                 <span class="keywordflow">return</span> <span class="keyword">false</span>;;00224             }00225         }00226     }00227     <span class="keywordflow">return</span> <span class="keyword">false</span>;00228 }00229 <a name="l00230"></a><a class="code" href="classFG__Object.html#b3">00230</a> <span class="keywordtype">void</span> <a class="code" href="classFG__Object.html#b3">FG_Object::NotifyParent</a>(<a class="code" href="group__Utility.html#ga1">WORD</a> wNotification)00231 {00232     <span class="keywordflow">if</span> (<a class="code" href="classFG__Object.html#p5">m_pParent</a>)00233     {00234         <a class="code" href="structFG__Message.html">FG_Message</a> Msg(<a class="code" href="group__Utility.html#gga12a26">FG_MSG_NOTIFY</a>, wNotification, <a class="code" href="classFG__Object.html#a10">ID</a>());00235         <a class="code" href="classFG__Object.html#p5">m_pParent</a>-&gt;<a class="code" href="classFG__Object.html#a20">Message</a>(&amp; Msg);00236     }00237 }00238 <a name="l00239"></a><a class="code" href="classFG__Object.html#b4">00239</a> <span class="keywordtype">void</span> <a class="code" href="classFG__Object.html#b4">FG_Object::RequestDraw</a>()00240 {00241     <span class="keywordflow">if</span> (<a class="code" href="classFG__Object.html#p5">m_pParent</a>)00242     {00243         <a class="code" href="structFG__Message.html">FG_Message</a> Msg(<a class="code" href="group__Utility.html#gga12a24">FG_MSG_DRAW_REQUEST</a>);00244         Msg.<a class="code" href="structFG__Message.html#o4">lData</a> = (<a class="code" href="group__Utility.html#ga2">DWORD</a>)<span class="keyword">this</span>;00245         <a class="code" href="classFG__Object.html#p5">m_pParent</a>-&gt;<a class="code" href="classFG__Object.html#a20">Message</a>(&amp; Msg);00246     }00247 }00248 00249 <span class="comment">//##ModelId=3F6EAC8F0128</span><a name="l00250"></a><a class="code" href="classFG__Object.html#b7">00250</a> <span class="keywordtype">void</span> <a class="code" href="classFG__Object.html#b7">FG_Object::OnFocus</a>(<a class="code" href="structFG__Message.html">FG_Message</a> * pMsg)00251 {00252     <span class="keywordflow">if</span> (pMsg-&gt;<a class="code" href="structFG__Message.html#o1">wData</a> == <a class="code" href="group__Utility.html#gga15a36">FFS_LOSE</a>)00253         <a class="code" href="classFG__Object.html#a18">ResetFocus</a>();00254     <span class="keywordflow">else</span>00255         <a class="code" href="classFG__Object.html#a17">SetFocus</a>();00256 00257     <a class="code" href="classFG__Object.html#b4">RequestDraw</a>();00258 }00259 </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 + -