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

📄 fg__screen_8cpp-source.html

📁 《道法自然》书的源码FishGUI,一个跨平台的界面库
💻 HTML
📖 第 1 页 / 共 2 页
字号:
00111 00112 <span class="comment">//##ModelId=3F71AB20003E</span><a name="l00113"></a><a class="code" href="classFG__Screen.html#b4">00113</a> <a class="code" href="classFG__Screen.html#b4">FG_Screen::~FG_Screen</a>()00114 {00115     <span class="keywordflow">if</span> (<a class="code" href="classFG__Screen.html#p0">m_pFactory</a>)00116         <span class="keyword">delete</span> <a class="code" href="classFG__Screen.html#p0">m_pFactory</a>;00117 }00118 <a name="l00119"></a><a class="code" href="classFG__Screen.html#a0">00119</a> <span class="keywordtype">bool</span> <a class="code" href="classFG__Screen.html#a0">FG_Screen::AddWindow</a>(<a class="code" href="classFG__Window.html">FG_Window</a> * pWindow)00120 {00121     <span class="keywordflow">if</span> (<a class="code" href="classFG__Container.html#b0">AddChild</a>(pWindow))00122     {00123         FG_OBJECTLIST::back_iterator pLast = m_ObjectList.Last();00124         pLast ++;00125         <a class="code" href="structFG__Message.html">FG_Message</a> Msg(<a class="code" href="group__Utility.html#gga12a25">FG_MSG_FOCUS</a>, <a class="code" href="group__Utility.html#gga15a36">FFS_LOSE</a>);00126         <span class="keywordflow">if</span> (! 00127             pLast.IsDone())00128             pLast-&gt;Message(&amp; Msg);00129 00130         Msg.<a class="code" href="structFG__Message.html#o0">wType</a> = <a class="code" href="group__Utility.html#gga12a25">FG_MSG_FOCUS</a>;00131         Msg.<a class="code" href="structFG__Message.html#o1">wData</a> = <a class="code" href="group__Utility.html#gga15a35">FFS_GET</a>;00132         pLast = m_ObjectList.Last();00133         pLast-&gt;Message(&amp; Msg);00134         <span class="keywordflow">return</span> <span class="keyword">true</span>;00135     }00136     <span class="keywordflow">else</span>00137         <span class="keywordflow">return</span> <span class="keyword">false</span>;00138 }00139 <a name="l00140"></a><a class="code" href="classFG__Screen.html#a1">00140</a> <span class="keywordtype">bool</span> <a class="code" href="classFG__Screen.html#a1">FG_Screen::RemoveWindow</a>(<a class="code" href="classFG__Window.html">FG_Window</a> * pWindow)00141 {00142     FG_OBJECTLIST::back_iterator pLast = m_ObjectList.Last();00143     <span class="keywordflow">if</span> (<a class="code" href="classFG__Container.html#b1">RemoveChild</a>(pWindow))00144     {00145         FG_OBJECTLIST::back_iterator pNewLast = m_ObjectList.Last();00146         <span class="keywordflow">if</span> (! pNewLast.IsDone() &amp;&amp; pNewLast != pLast)00147         {00148             <a class="code" href="structFG__Message.html">FG_Message</a> Msg(<a class="code" href="group__Utility.html#gga12a25">FG_MSG_FOCUS</a>, <a class="code" href="group__Utility.html#gga15a35">FFS_GET</a>);00149             pNewLast-&gt;Message(&amp; Msg);00150         }00151         <a class="code" href="classFG__Screen.html#b2">DrawAllWindow</a>();00152         <span class="keywordflow">return</span> <span class="keyword">true</span>;00153     }00154     <span class="keywordflow">else</span>00155         <span class="keywordflow">return</span> <span class="keyword">false</span>;00156 }00157 00158 <span class="comment">//##ModelId=3F57524C03C5</span><a name="l00159"></a><a class="code" href="classFG__Screen.html#a2">00159</a> <span class="keywordtype">void</span> <a class="code" href="classFG__Screen.html#a2">FG_Screen::OSMessage</a>(<a class="code" href="structFG__Message.html">FG_Message</a> * pMsg)00160 {00161     <span class="keywordflow">switch</span> (pMsg-&gt;<a class="code" href="structFG__Message.html#o0">wType</a>)00162     {00163     <span class="keywordflow">case</span> <a class="code" href="group__Utility.html#gga12a19">FG_MSG_DRAW</a>:00164         <a class="code" href="classFG__Screen.html#b2">DrawAllWindow</a>();00165         <span class="keywordflow">break</span>;00166     <span class="keywordflow">case</span> <a class="code" href="group__Utility.html#gga12a20">FG_MSG_KEY</a>:00167         m_ObjectList.Last()-&gt;Message(pMsg);00168         <span class="keywordflow">break</span>;00169     <span class="keywordflow">case</span> <a class="code" href="group__Utility.html#gga12a21">FG_MSG_MOUSE</a>:00170         {00171             <span class="keywordflow">if</span> (m_ObjectList.Last()-&gt;IsContains(pMsg-&gt;<a class="code" href="structFG__Message.html#o5">Point</a>))00172                 m_ObjectList.Last()-&gt;Message(pMsg);00173         }00174         <span class="keywordflow">break</span>;00175     }00176 }00177 00178 <span class="comment">//##ModelId=3F6193A70319</span><a name="l00179"></a><a class="code" href="classFG__Screen.html#b0">00179</a> <span class="keywordtype">void</span> <a class="code" href="classFG__Screen.html#b0">FG_Screen::OnDrawRequest</a>(<a class="code" href="structFG__Message.html">FG_Message</a> * pMsg)00180 {00181     <span class="comment">// 对于窗口对象发来的重画请求,并不直接重画,而是启动一个时间为\ref SCREEN_DRAW_INTERVAL(50毫秒)的定时器,</span>00182     <span class="comment">// 定时器到期时才执行重画操作,该定时器在删除之前只能被成功一次,因此50 毫秒内只会发生一次重画操作,</span>00183     <span class="comment">// 提高了重画的效率,不会引起闪烁感</span>00184     <a class="code" href="classFG__Object.html#b0">StartTimer</a>(<a class="code" href="classFG__Screen.html#y1y0">TIMERID_DRAW</a>, <a class="code" href="group__Utility.html#ga8">SCREEN_DRAW_INTERVAL</a>);00185 }00186 00187 <span class="comment">//##ModelId=3F71AB1F03C2</span><a name="l00188"></a><a class="code" href="classFG__Screen.html#b1">00188</a> <span class="keywordtype">void</span> <a class="code" href="classFG__Screen.html#b1">FG_Screen::OnDrawTimer</a>(<span class="keywordtype">void</span>)00189 {00190     <a class="code" href="classFG__Screen.html#b2">DrawAllWindow</a>();00191     <a class="code" href="classFG__Object.html#b1">KillTimer</a>(<a class="code" href="classFG__Screen.html#y1y0">TIMERID_DRAW</a>);00192 }00193 00194 <span class="comment">//##ModelId=3F6193A70337</span><a name="l00195"></a><a class="code" href="classFG__Screen.html#b2">00195</a> <span class="keywordtype">void</span> <a class="code" href="classFG__Screen.html#b2">FG_Screen::DrawAllWindow</a>()00196 {00197     <a class="code" href="classFG__OSAdaptor.html">FG_OSAdaptor</a> * pAdaptor = <a class="code" href="group__OSAdaptor.html#ga1">FG_GetAdaptor</a>();00198     <span class="keywordflow">if</span> (! pAdaptor)00199         <span class="keywordflow">return</span>;00200 00201     pAdaptor-&gt;<a class="code" href="classFG__OSAdaptor.html#a3">BeginDraw</a>(m_Rect);00202 00203     <a class="code" href="classFG__Object.html#b6">FG_Container::OnDraw</a>(pAdaptor);00204 00205     FG_OBJECTLIST::forward_iterator i;00206     <span class="keywordflow">for</span> (i = m_ObjectList.First(); ! i.IsDone(); ++ i)00207     {00208         <a class="code" href="structFG__Message.html">FG_Message</a> Msg(<a class="code" href="group__Utility.html#gga12a19">FG_MSG_DRAW</a>);00209         i-&gt;Message(&amp; Msg);00210     }00211 00212     pAdaptor-&gt;<a class="code" href="classFG__OSAdaptor.html#a4">EndDraw</a>();00213 }00214 </pre></div><hr><center>由 DoxyGen 1.3.6 于 Wed Jun 9 22:34:41 2004 生成<br>版权所有 (C) 2003,2004 王咏武</body></html>

⌨️ 快捷键说明

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