📄 fg__window_8cpp-source.html
字号:
00128 <a class="code" href="classFG__Widget.html">FG_Widget</a> * pTarget = (<a class="code" href="classFG__Widget.html">FG_Widget</a> *)<a class="code" href="classFG__Container.html#a3">GetChild</a>(wID);00129 <span class="keywordflow">if</span> (pTarget)00130 {00131 <span class="keywordtype">bool</span> ret = <a class="code" href="classFG__Window.html#r0">m_KeyMap</a>.<a class="code" href="classFG__KeyMap.html#a1">RegisterKey</a>(wOrgKey, wActKey, pTarget); 00132 <span class="keywordflow">if</span> (ret)00133 {00134 pTarget-><a class="code" href="classFG__Widget.html#a2">SetCanGetFocus</a>(<span class="keyword">false</span>);00135 <span class="keywordflow">if</span> (pTarget == <a class="code" href="classFG__Window.html#p1">m_pFocus</a>)00136 <a class="code" href="classFG__Window.html#a6">ChangeFocus</a>(<a class="code" href="group__Utility.html#ga11">NULL</a>);00137 }00138 <span class="keywordflow">return</span> ret;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=3F584C9403D0</span><a name="l00145"></a><a class="code" href="classFG__Window.html#b0">00145</a> <span class="keywordtype">void</span> <a class="code" href="classFG__Window.html#b0">FG_Window::OnDraw</a>(<a class="code" href="classFG__OSAdaptor.html">FG_OSAdaptor</a> * pAdaptor)00146 {00147 pAdaptor-><a class="code" href="classFG__OSAdaptor.html#a3">BeginDraw</a>(m_Rect);00148 00149 <a class="code" href="classFG__Object.html#b6">FG_Container::OnDraw</a>(pAdaptor);00150 00151 <span class="keywordflow">if</span> (<a class="code" href="classFG__Window.html#p0">m_Title</a>.<a class="code" href="classFG__String.html#a5">Length</a>())00152 {00153 <span class="comment">// 画标题</span>00154 <a class="code" href="structFG__Rect.html">FG_Rect</a> Rect;00155 <a class="code" href="classFG__Object.html#a3">FG_Object::GetClientRect</a>(Rect);00156 Rect.<a class="code" href="structFG__Rect.html#o3">wBottom</a> = Rect.<a class="code" href="structFG__Rect.html#o1">wTop</a> + <a class="code" href="group__Utility.html#ga5">TITLE_HEIGHT</a>;00157 pAdaptor-><a class="code" href="classFG__OSAdaptor.html#a5">FillRect</a>(Rect, <a class="code" href="FG__X11Adaptor_8cpp.html#a4">COLOR_BLUE</a>, <a class="code" href="FG__X11Adaptor_8cpp.html#a4">COLOR_BLUE</a>);00158 pAdaptor-><a class="code" href="classFG__OSAdaptor.html#a7">DrawText</a>(<a class="code" href="classFG__Window.html#p0">m_Title</a>.<a class="code" href="classFG__String.html#a4">DataGet</a>(), Rect.<a class="code" href="structFG__Rect.html#o0">wLeft</a> + 2, Rect.<a class="code" href="structFG__Rect.html#o1">wTop</a> + 1, <a class="code" href="FG__X11Adaptor_8cpp.html#a2">COLOR_WHITE</a>);00159 }00160 00161 <span class="comment">// 按照覆盖顺序把FG_MSG_DRAW消息发送给每个子控件,要求他们重画自己</span>00162 FG_OBJECTLIST::forward_iterator i;00163 <span class="keywordflow">for</span> (i = m_ObjectList.First(); ! i.IsDone(); ++ i)00164 {00165 <a class="code" href="structFG__Message.html">FG_Message</a> Msg(<a class="code" href="group__Utility.html#gga12a19">FG_MSG_DRAW</a>);00166 i->Message(& Msg);00167 }00168 00169 pAdaptor-><a class="code" href="classFG__OSAdaptor.html#a4">EndDraw</a>();00170 }00171 00172 <span class="comment">//##ModelId=3F603B980398</span><a name="l00173"></a><a class="code" href="classFG__Window.html#b3">00173</a> <span class="keywordtype">void</span> <a class="code" href="classFG__Window.html#b3">FG_Window::OnDrawRequest</a>(<a class="code" href="structFG__Message.html">FG_Message</a> * pMsg)00174 {00175 <span class="comment">// - 如果本窗口为焦点窗口</span>00176 <span class="comment">// - 直接发送FG_MSG_DRAW消息给要求重画控件,使其重画自己</span>00177 <span class="comment">// - 否则</span>00178 <span class="comment">// - 给屏幕对象发送要求重画消息\ref FG_MSG_DRAW_REQUEST</span>00179 <span class="keywordflow">if</span> (<a class="code" href="classFG__Object.html#a19">IsFocus</a>())00180 {00181 <a class="code" href="classFG__Object.html">FG_Object</a> * pSender = (<a class="code" href="classFG__Object.html">FG_Object</a> *)pMsg-><a class="code" href="structFG__Message.html#o3">pData</a>;00182 <a class="code" href="structFG__Message.html">FG_Message</a> Msg(<a class="code" href="group__Utility.html#gga12a19">FG_MSG_DRAW</a>);00183 pSender-><a class="code" href="classFG__Object.html#a20">Message</a>(& Msg);00184 }00185 <span class="keywordflow">else</span>00186 {00187 <a class="code" href="classFG__Object.html#b4">RequestDraw</a>();00188 }00189 }00190 00191 <span class="comment">//##ModelId=3F5C4AEB0321</span><a name="l00192"></a><a class="code" href="classFG__Window.html#b1">00192</a> <span class="keywordtype">bool</span> <a class="code" href="classFG__Window.html#b1">FG_Window::OnKey</a>(<a class="code" href="structFG__Message.html">FG_Message</a> * pMsg)00193 {00194 <span class="keywordflow">if</span> (pMsg-><a class="code" href="structFG__Message.html#o4">lData</a> == <a class="code" href="group__Virtual__Key.html#ga16">FVK_TAB</a>)00195 {00196 <span class="comment">// TAB键,按顺序切换焦点</span>00197 <span class="keywordflow">if</span> (<a class="code" href="classFG__Window.html#p1">m_pFocus</a> && pMsg-><a class="code" href="structFG__Message.html#o1">wData</a> == <a class="code" href="group__Utility.html#gga13a29">FKS_DOWN</a>)00198 {00199 FG_OBJECTLIST::loop_iterator i = m_ObjectList.Loop(<a class="code" href="classFG__Window.html#p1">m_pFocus</a>);00200 <a class="code" href="classFG__CheckCanGetFocus.html">FG_CheckCanGetFocus</a> tmp;00201 00202 <span class="keywordflow">if</span> (<a class="code" href="group__Utility.html#ga10">FG_ListFind_If</a>(i, tmp))00203 <a class="code" href="classFG__Window.html#a6">ChangeFocus</a>((<a class="code" href="classFG__Widget.html">FG_Widget</a> *)(<a class="code" href="classFG__Object.html">FG_Object</a> *)i);00204 }00205 <span class="keywordflow">return</span> <span class="keyword">true</span>;00206 }00207 <span class="keywordflow">else</span>00208 {00209 <span class="comment">// 发送给快捷键管理器处理</span>00210 <span class="comment">// 如果不是快捷键(快捷键管理器未处理),发送给当前焦点窗口</span>00211 <span class="keywordflow">if</span> (<a class="code" href="classFG__Window.html#r0">m_KeyMap</a>.<a class="code" href="classFG__KeyMap.html#a2">SendKey</a>(pMsg))00212 <span class="keywordflow">return</span> <span class="keyword">true</span>;00213 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="classFG__Window.html#p1">m_pFocus</a>)00214 <span class="keywordflow">return</span> <a class="code" href="classFG__Window.html#p1">m_pFocus</a>-><a class="code" href="classFG__Object.html#a20">Message</a>(pMsg);00215 <span class="keywordflow">else</span>00216 <span class="keywordflow">return</span> <span class="keyword">false</span>;00217 }00218 }00219 00220 <span class="comment">//##ModelId=3F5C4AEB032B</span><a name="l00221"></a><a class="code" href="classFG__Window.html#b2">00221</a> <span class="keywordtype">bool</span> <a class="code" href="classFG__Window.html#b2">FG_Window::OnMouse</a>(<a class="code" href="structFG__Message.html">FG_Message</a> * pMsg)00222 {00223 <span class="comment">// 把该消息发送给鼠标指针所在的窗口元素,并且使该窗口元素得到焦点</span>00224 FG_OBJECTLIST::back_iterator i;00225 <span class="keywordflow">for</span> (i = m_ObjectList.Last(); ! i.IsDone(); ++ i)00226 {00227 <span class="keywordflow">if</span> (i->IsContains(pMsg-><a class="code" href="structFG__Message.html#o5">Point</a>))00228 {00229 <span class="keywordflow">if</span> (pMsg-><a class="code" href="structFG__Message.html#o1">wData</a> == <a class="code" href="group__Utility.html#gga14a32">FMS_LBUTTONDOWN</a>)00230 <a class="code" href="classFG__Window.html#a6">ChangeFocus</a>((<a class="code" href="classFG__Widget.html">FG_Widget</a> *)(<a class="code" href="classFG__Object.html">FG_Object</a> *)i);00231 00232 <span class="keywordflow">if</span> (i->Message(pMsg))00233 <span class="keywordflow">return</span> <span class="keyword">true</span>;00234 }00235 }00236 <span class="keywordflow">return</span> <span class="keyword">false</span>;00237 }00238 00239 <span class="comment">//##ModelId=3F6193A80162</span><a name="l00240"></a><a class="code" href="classFG__Window.html#b4">00240</a> <span class="keywordtype">void</span> <a class="code" href="classFG__Window.html#b4">FG_Window::OnFocus</a>(<a class="code" href="structFG__Message.html">FG_Message</a> * pMsg)00241 {00242 <span class="keywordflow">if</span> (<a class="code" href="classFG__Window.html#p1">m_pFocus</a>)00243 <a class="code" href="classFG__Window.html#p1">m_pFocus</a>-><a class="code" href="classFG__Object.html#a20">Message</a>(pMsg);00244 00245 <a class="code" href="classFG__Object.html#b7">FG_Container::OnFocus</a>(pMsg);00246 }00247 </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 + -