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

📄 fg__object_8cpp-source.html

📁 《道法自然》书的源码FishGUI,一个跨平台的界面库
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=gb2312"><title>FishGUI: FG_Object.cpp Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- 制作者 Doxygen 1.3.6 --><div class="qindex"><a class="qindex" href="main.html">首页</a> | <a class="qindex" href="modules.html">模块</a> | <a class="qindex" href="hierarchy.html">类继承关系</a> | <a class="qindex" href="classes.html">按字典顺序排序的列表</a> | <a class="qindex" href="annotated.html">组合类型列表</a> | <a class="qindex" href="files.html">文件列表</a> | <a class="qindex" href="functions.html">组合类型成员</a> | <a class="qindex" href="globals.html">文件成员</a></div><h1>FG_Object.cpp</h1><a href="FG__Object_8cpp.html">浏览该文件的文档。</a><div class="fragment"><pre>00001 <span class="comment">/*--------------------------------------------------------------------------</span>00002 <span class="comment"></span>00003 <span class="comment">        FG_Object.cpp - 窗口元素类的实现文件</span>00004 <span class="comment"></span>00005 <span class="comment">        本程序是FishGUI软件的一部分</span>00006 <span class="comment"></span>00007 <span class="comment">        版权所有 (C) 2003,2004 王咏武</span>00008 <span class="comment">        http://www.contextfree.net/wangyw/</span>00009 <span class="comment"></span>00010 <span class="comment">----------------------------------------------------------------------------</span>00011 <span class="comment"></span>00012 <span class="comment">        作者对 FishGUI 软件及其所有源代码授权如下:</span>00013 <span class="comment"></span>00014 <span class="comment">        允许任何个人、组织、机构、企业无偿获得、修改、使用、重新发布 FishGUI 软</span>00015 <span class="comment">        件及其源代码,或按照有偿或者无偿的方式发行基于 FishGUI 源代码的全部或部</span>00016 <span class="comment">        分内容开发的软件产品,——但行使以上权利时,须遵守以下约定:</span>00017 <span class="comment"></span>00018 <span class="comment">        1、重新发布 FishGUI 软件及其源代码时,不得隐去软件及其源代码中原有的版</span>00019 <span class="comment">           权信息和开发者标识。</span>00020 <span class="comment"></span>00021 <span class="comment">        2、发行基于 FishGUI 源代码的全部或部分内容开发的软件产品时,必须在产品</span>00022 <span class="comment">           的显著位置标明以下字样:</span>00023 <span class="comment"></span>00024 <span class="comment">           【本产品的一部分功能是基于王咏武在 FishGUI 软件中的工作完成的】</span>00025 <span class="comment"></span>00026 <span class="comment">        3、在正式出版物中引用 FishGUI 的文档、源代码或注释内容的,应注明软件的</span>00027 <span class="comment">           原作者为王咏武。</span>00028 <span class="comment"></span>00029 <span class="comment">--------------------------------------------------------------------------*/</span>00041 <span class="preprocessor">#include "../OSAdaptor/FG_OSAdaptor.h"</span>00042 <span class="preprocessor">#include "<a class="code" href="FG__Container_8h.html">FG_Container.h</a>"</span>00043 00044 <span class="comment">// message map of base object</span>00045 <span class="comment">//##ModelId=3F5C4D4103CC</span><a name="l00046"></a><a class="code" href="classFG__Object.html#t0">00046</a> <span class="keyword">const</span> <a class="code" href="structFG__MSGMAP.html">FG_MSGMAP</a> <a class="code" href="classFG__Object.html#t0">FG_Object::m_MsgMap</a> = { <a class="code" href="group__Utility.html#ga11">NULL</a>, &amp; <a class="code" href="classFG__Object.html#v0">FG_Object::m_MsgEntries</a>[0] };00047 <span class="comment">//##ModelId=3F5C4D41037C</span><a name="l00048"></a><a class="code" href="classFG__Object.html#v0">00048</a> <span class="keyword">const</span> <a class="code" href="structFG__MSGMAP__ENTRY.html">FG_MSGMAP_ENTRY</a> <a class="code" href="classFG__Object.html#v0">FG_Object::m_MsgEntries</a>[] =00049 { 00050     <a class="code" href="group__MsgMap__Define.html#ga2">ON_DRAW</a>        (<a class="code" href="classFG__Object.html#b6">FG_Object::OnDraw</a>)00051     <a class="code" href="group__MsgMap__Define.html#ga11">ON_FOCUS</a>       (<a class="code" href="classFG__Object.html#b7">FG_Object::OnFocus</a>)00052     { <span class="keyword">false</span>, 0, 0, (<a class="code" href="group__MsgHandler__Type.html#ga0">FG_PMSG_vv</a>)<a class="code" href="group__Utility.html#ga11">NULL</a> } 00053 };00054 00055 <span class="comment">//##ModelId=3F5C4D42001F</span><a name="l00056"></a><a class="code" href="classFG__Object.html#b5">00056</a> <span class="keyword">const</span> <a class="code" href="structFG__MSGMAP.html">FG_MSGMAP</a> * <a class="code" href="classFG__Object.html#b5">FG_Object::GetMessageMap</a>()<span class="keyword"> const</span>00057 <span class="keyword"></span>{00058     <span class="keywordflow">return</span> &amp; <a class="code" href="classFG__Object.html#t0">FG_Object::m_MsgMap</a>;00059 }00060 <a name="l00061"></a><a class="code" href="classFG__Object.html#b2">00061</a> <span class="keywordtype">void</span> <a class="code" href="classFG__Object.html#b2">FG_Object::DrawBorder</a>(<a class="code" href="classFG__OSAdaptor.html">FG_OSAdaptor</a> * pAdaptor)00062 {00063         <a class="code" href="structFG__Rect.html">FG_Rect</a> Rect;00064         <span class="keywordflow">if</span> (<a class="code" href="classFG__Object.html#p3">m_wStyle</a> &amp; <a class="code" href="group__General__Style.html#ga0">GS_TRANSPARENT</a>)00065                 <span class="keywordflow">return</span>;00066 00067         pAdaptor-&gt;<a class="code" href="classFG__OSAdaptor.html#a3">BeginDraw</a>(<a class="code" href="classFG__Object.html#p2">m_Rect</a>);00068 00069         <a class="code" href="structFG__Point.html">FG_Point</a> p[3];00070     <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>)00071     {00072     <span class="keywordflow">case</span>  <a class="code" href="group__Frame__Style.html#ga2">FS_RAISED</a>:00073         Rect = <a class="code" href="classFG__Object.html#p2">m_Rect</a>;00074         Rect -= 2;00075         pAdaptor-&gt;<a class="code" href="classFG__OSAdaptor.html#a5">FillRect</a>(Rect, <a class="code" href="classFG__Object.html#p1">m_Background</a>, <a class="code" href="classFG__Object.html#p1">m_Background</a>);00076 00077                 p[0].<a class="code" href="structFG__Point.html#o0">x</a> = p[1].<a class="code" href="structFG__Point.html#o0">x</a> = m_Rect.wLeft;00078                 p[0].<a class="code" href="structFG__Point.html#o1">y</a> = m_Rect.wBottom - 1;00079                 p[1].<a class="code" href="structFG__Point.html#o1">y</a> = p[2].<a class="code" href="structFG__Point.html#o1">y</a> = m_Rect.wTop;00080                 p[2].<a class="code" href="structFG__Point.html#o0">x</a> = m_Rect.wRight - 1;00081                 pAdaptor-&gt;<a class="code" href="classFG__OSAdaptor.html#a11">DrawPolyLine</a>(3, p, <a class="code" href="FG__X11Adaptor_8cpp.html#a1">COLOR_GRAY</a>);00082 00083                 p[0].<a class="code" href="structFG__Point.html#o0">x</a> = p[1].<a class="code" href="structFG__Point.html#o0">x</a> = m_Rect.wLeft + 1;00084                 p[0].<a class="code" href="structFG__Point.html#o1">y</a> = m_Rect.wBottom - 2;00085                 p[1].<a class="code" href="structFG__Point.html#o1">y</a> = p[2].<a class="code" href="structFG__Point.html#o1">y</a> = m_Rect.wTop + 1;00086                 p[2].<a class="code" href="structFG__Point.html#o0">x</a> = m_Rect.wRight - 2;00087                 pAdaptor-&gt;<a class="code" href="classFG__OSAdaptor.html#a11">DrawPolyLine</a>(3, p, <a class="code" href="FG__X11Adaptor_8cpp.html#a2">COLOR_WHITE</a>);00088 00089                 p[0].<a class="code" href="structFG__Point.html#o0">x</a> = p[1].<a class="code" href="structFG__Point.html#o0">x</a> = m_Rect.wRight - 1;00090                 p[0].<a class="code" href="structFG__Point.html#o1">y</a> = m_Rect.wTop + 1;00091                 p[1].<a class="code" href="structFG__Point.html#o1">y</a> = p[2].<a class="code" href="structFG__Point.html#o1">y</a> = m_Rect.wBottom - 1;00092                 p[2].<a class="code" href="structFG__Point.html#o0">x</a> = m_Rect.wLeft + 1;00093                 pAdaptor-&gt;<a class="code" href="classFG__OSAdaptor.html#a11">DrawPolyLine</a>(3, p, <a class="code" href="FG__X11Adaptor_8cpp.html#a3">COLOR_DARKGRAY</a>);00094 00095                 p[0].<a class="code" href="structFG__Point.html#o0">x</a> = p[1].<a class="code" href="structFG__Point.html#o0">x</a> = m_Rect.wRight;00096                 p[0].<a class="code" href="structFG__Point.html#o1">y</a> = m_Rect.wTop;00097                 p[1].<a class="code" href="structFG__Point.html#o1">y</a> = p[2].<a class="code" href="structFG__Point.html#o1">y</a> = m_Rect.wBottom;00098                 p[2].<a class="code" href="structFG__Point.html#o0">x</a> = m_Rect.wLeft;00099                 pAdaptor-&gt;<a class="code" href="classFG__OSAdaptor.html#a11">DrawPolyLine</a>(3, p, <a class="code" href="FG__X11Adaptor_8cpp.html#a0">COLOR_BLACK</a>);00100         <span class="keywordflow">break</span>;00101 00102     <span class="keywordflow">case</span> <a class="code" href="group__Frame__Style.html#ga3">FS_RECESSED</a>:00103         Rect = m_Rect;00104         Rect -= 2;00105         pAdaptor-&gt;<a class="code" href="classFG__OSAdaptor.html#a5">FillRect</a>(Rect, <a class="code" href="classFG__Object.html#p1">m_Background</a>, <a class="code" href="classFG__Object.html#p1">m_Background</a>);00106 00107                 p[0].<a class="code" href="structFG__Point.html#o0">x</a> = p[1].<a class="code" href="structFG__Point.html#o0">x</a> = m_Rect.wRight - 1;00108                 p[0].<a class="code" href="structFG__Point.html#o1">y</a> = m_Rect.wTop + 1;00109                 p[1].<a class="code" href="structFG__Point.html#o1">y</a> = p[2].<a class="code" href="structFG__Point.html#o1">y</a> = m_Rect.wBottom - 1;00110                 p[2].<a class="code" href="structFG__Point.html#o0">x</a> = m_Rect.wLeft + 1;00111                 pAdaptor-&gt;<a class="code" href="classFG__OSAdaptor.html#a11">DrawPolyLine</a>(3, p, <a class="code" href="FG__X11Adaptor_8cpp.html#a1">COLOR_GRAY</a>);00112 00113                 p[0].<a class="code" href="structFG__Point.html#o0">x</a> = p[1].<a class="code" href="structFG__Point.html#o0">x</a> = m_Rect.wRight;00114                 p[0].<a class="code" href="structFG__Point.html#o1">y</a> = m_Rect.wTop;00115                 p[1].<a class="code" href="structFG__Point.html#o1">y</a> = p[2].<a class="code" href="structFG__Point.html#o1">y</a> = m_Rect.wBottom;00116                 p[2].<a class="code" href="structFG__Point.html#o0">x</a> = m_Rect.wLeft;00117                 pAdaptor-&gt;<a class="code" href="classFG__OSAdaptor.html#a11">DrawPolyLine</a>(3, p, <a class="code" href="FG__X11Adaptor_8cpp.html#a2">COLOR_WHITE</a>);00118 00119                 p[0].<a class="code" href="structFG__Point.html#o0">x</a> = p[1].<a class="code" href="structFG__Point.html#o0">x</a> = m_Rect.wLeft;00120                 p[0].<a class="code" href="structFG__Point.html#o1">y</a> = m_Rect.wBottom - 1;00121                 p[1].<a class="code" href="structFG__Point.html#o1">y</a> = p[2].<a class="code" href="structFG__Point.html#o1">y</a> = m_Rect.wTop;00122                 p[2].<a class="code" href="structFG__Point.html#o0">x</a> = m_Rect.wRight - 1;00123                 pAdaptor-&gt;<a class="code" href="classFG__OSAdaptor.html#a11">DrawPolyLine</a>(3, p, <a class="code" href="FG__X11Adaptor_8cpp.html#a3">COLOR_DARKGRAY</a>);00124 00125                 p[0].<a class="code" href="structFG__Point.html#o0">x</a> = p[1].<a class="code" href="structFG__Point.html#o0">x</a> = m_Rect.wLeft + 1;00126                 p[0].<a class="code" href="structFG__Point.html#o1">y</a> = m_Rect.wBottom - 2;00127                 p[1].<a class="code" href="structFG__Point.html#o1">y</a> = p[2].<a class="code" href="structFG__Point.html#o1">y</a> = m_Rect.wTop + 1;00128                 p[2].<a class="code" href="structFG__Point.html#o0">x</a> = m_Rect.wRight - 2;00129                 pAdaptor-&gt;<a class="code" href="classFG__OSAdaptor.html#a11">DrawPolyLine</a>(3, p, <a class="code" href="FG__X11Adaptor_8cpp.html#a0">COLOR_BLACK</a>);00130         <span class="keywordflow">break</span>;00131 00132     <span class="keywordflow">case</span> <a class="code" href="group__Frame__Style.html#ga1">FS_THIN</a>:00133         pAdaptor-&gt;<a class="code" href="classFG__OSAdaptor.html#a5">FillRect</a>(m_Rect, <a class="code" href="FG__X11Adaptor_8cpp.html#a0">COLOR_BLACK</a>, <a class="code" href="classFG__Object.html#p1">m_Background</a>);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -