diff options
Diffstat (limited to 'docs/doxygen/nel/a05684.html')
-rw-r--r-- | docs/doxygen/nel/a05684.html | 212 |
1 files changed, 212 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a05684.html b/docs/doxygen/nel/a05684.html new file mode 100644 index 00000000..2e5cb515 --- /dev/null +++ b/docs/doxygen/nel/a05684.html @@ -0,0 +1,212 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: event_listener.cpp Source File</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>event_listener.cpp</h1><a href="a04261.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 +00007 <span class="comment">/* Copyright, 2000 Nevrax Ltd.</span> +00008 <span class="comment"> *</span> +00009 <span class="comment"> * This file is part of NEVRAX NEL.</span> +00010 <span class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</span> +00011 <span class="comment"> * it under the terms of the GNU General Public License as published by</span> +00012 <span class="comment"> * the Free Software Foundation; either version 2, or (at your option)</span> +00013 <span class="comment"> * any later version.</span> +00014 <span class="comment"></span> +00015 <span class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</span> +00016 <span class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</span> +00017 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> +00018 <span class="comment"> * General Public License for more details.</span> +00019 <span class="comment"></span> +00020 <span class="comment"> * You should have received a copy of the GNU General Public License</span> +00021 <span class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</span> +00022 <span class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</span> +00023 <span class="comment"> * MA 02111-1307, USA.</span> +00024 <span class="comment"> */</span> +00025 +00026 <span class="preprocessor">#include "<a class="code" href="a05021.html">stdmisc.h</a>"</span> +00027 +00028 <span class="preprocessor">#include "<a class="code" href="a04262.html">nel/misc/event_listener.h</a>"</span> +00029 <span class="preprocessor">#include "<a class="code" href="a04266.html">nel/misc/event_server.h</a>"</span> +00030 <span class="preprocessor">#include "<a class="code" href="a04268.html">nel/misc/events.h</a>"</span> +00031 +00032 +00033 <span class="keyword">namespace </span>NLMISC { +00034 +00035 +00036 <span class="comment">/*</span> +00037 <span class="comment"> * Constructor</span> +00038 <span class="comment"> */</span> +<a name="l00039"></a><a class="code" href="a02464.html#NLMISC_1_1IEventListenera0">00039</a> IEventListener::IEventListener() +00040 { +00041 } +00042 +00043 <span class="comment">// ***************************************************************************</span> +00044 <span class="comment">// ***************************************************************************</span> +00045 <span class="comment">// CEventListenerAsync</span> +00046 <span class="comment">// ***************************************************************************</span> +00047 <span class="comment">// ***************************************************************************</span> +00048 +00049 <span class="comment">// ***************************************************************************</span> +<a name="l00050"></a><a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsynca1">00050</a> CEventListenerAsync::CEventListenerAsync() +00051 { +00052 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp0">_KeyArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_5">resize</a> (<a class="code" href="a05378.html#a442a207">KeyCount</a>); +00053 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp1">_KeyDownArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_5">resize</a> (<a class="code" href="a05378.html#a442a207">KeyCount</a>); +00054 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp2">_KeyReleaseArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_5">resize</a> (<a class="code" href="a05378.html#a442a207">KeyCount</a>); +00055 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsynca5">reset</a> (); +00056 } +00057 <span class="comment">// ***************************************************************************</span> +<a name="l00058"></a><a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsynca0">00058</a> <span class="keywordtype">void</span> CEventListenerAsync::addToServer (<a class="code" href="a02479.html">CEventServer</a>& server) +00059 { +00060 server.<a class="code" href="a02479.html#NLMISC_1_1CEventServera1">addListener</a> (<a class="code" href="a05378.html#a47">EventKeyDownId</a>, <span class="keyword">this</span>); +00061 server.<a class="code" href="a02479.html#NLMISC_1_1CEventServera1">addListener</a> (<a class="code" href="a05378.html#a51">EventSetFocusId</a>, <span class="keyword">this</span>); +00062 server.<a class="code" href="a02479.html#NLMISC_1_1CEventServera1">addListener</a> (<a class="code" href="a05378.html#a48">EventKeyUpId</a>, <span class="keyword">this</span>); +00063 } +00064 <span class="comment">// ***************************************************************************</span> +<a name="l00065"></a><a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsynca4">00065</a> <span class="keywordtype">void</span> CEventListenerAsync::removeFromServer (<a class="code" href="a02479.html">CEventServer</a>& server) +00066 { +00067 server.<a class="code" href="a02479.html#NLMISC_1_1CEventServera5">removeListener</a> (<a class="code" href="a05378.html#a48">EventKeyUpId</a>, <span class="keyword">this</span>); +00068 server.<a class="code" href="a02479.html#NLMISC_1_1CEventServera5">removeListener</a> (<a class="code" href="a05378.html#a47">EventKeyDownId</a>, <span class="keyword">this</span>); +00069 server.<a class="code" href="a02479.html#NLMISC_1_1CEventServera5">removeListener</a> (<a class="code" href="a05378.html#a51">EventSetFocusId</a>, <span class="keyword">this</span>); +00070 } +00071 <span class="comment">// ***************************************************************************</span> +<a name="l00072"></a><a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsynca2">00072</a> <span class="keywordtype">bool</span> CEventListenerAsync::isKeyDown (TKey key)<span class="keyword"> const</span> +00073 <span class="keyword"></span>{ +00074 <span class="keywordflow">return</span> <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp0">_KeyArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_3">get</a>(key); +00075 } +00076 +00077 <span class="comment">// ***************************************************************************</span> +<a name="l00078"></a><a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsynca3">00078</a> <span class="keywordtype">bool</span> CEventListenerAsync::isKeyPushed (TKey key, <span class="keywordtype">bool</span> release) +00079 { +00080 <span class="keywordtype">bool</span> ret= <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp1">_KeyDownArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_3">get</a>(key) && !(<a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp2">_KeyReleaseArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_3">get</a>(key)); +00081 <span class="keywordflow">if</span>(ret && release) +00082 { +00083 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp2">_KeyReleaseArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_8">set</a>(key, <span class="keyword">true</span>); +00084 } +00085 <span class="keywordflow">return</span> ret; +00086 } +00087 +00088 <span class="comment">// ***************************************************************************</span> +<a name="l00089"></a><a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncb0">00089</a> <span class="keywordtype">void</span> CEventListenerAsync::operator ()(<span class="keyword">const</span> <a class="code" href="a02461.html">CEvent</a>& event) +00090 { +00091 <span class="comment">// Key down ?</span> +00092 <span class="keywordflow">if</span> (event==<a class="code" href="a05378.html#a47">EventKeyDownId</a>) +00093 { +00094 <a class="code" href="a02470.html">CEventKeyDown</a> *pEvent=(<a class="code" href="a02470.html">CEventKeyDown</a>*)&event; +00095 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp0">_KeyArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_8">set</a> (pEvent-><a class="code" href="a02470.html#NLMISC_1_1CEventKeyDowno3">Key</a>); +00096 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp1">_KeyDownArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_8">set</a> (pEvent-><a class="code" href="a02470.html#NLMISC_1_1CEventKeyDowno3">Key</a>); +00097 <span class="keywordflow">switch</span>(pEvent-><a class="code" href="a02470.html#NLMISC_1_1CEventKeyDowno3">Key</a>) +00098 { +00099 <span class="keywordflow">case</span> <a class="code" href="a05378.html#a442a183">KeyRCONTROL</a>: +00100 <span class="keywordflow">case</span> <a class="code" href="a05378.html#a442a182">KeyLCONTROL</a>: +00101 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp0">_KeyArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_8">set</a> (<a class="code" href="a05378.html#a442a103">KeyCONTROL</a>); +00102 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp1">_KeyDownArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_8">set</a> (<a class="code" href="a05378.html#a442a103">KeyCONTROL</a>); +00103 <span class="keywordflow">break</span>; +00104 <span class="keywordflow">case</span> <a class="code" href="a05378.html#a442a181">KeyRSHIFT</a>: +00105 <span class="keywordflow">case</span> <a class="code" href="a05378.html#a442a180">KeyLSHIFT</a>: +00106 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp0">_KeyArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_8">set</a> (<a class="code" href="a05378.html#a442a102">KeySHIFT</a>); +00107 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp1">_KeyDownArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_8">set</a> (<a class="code" href="a05378.html#a442a102">KeySHIFT</a>); +00108 <span class="keywordflow">break</span>; +00109 <span class="keywordflow">case</span> <a class="code" href="a05378.html#a442a185">KeyRMENU</a>: +00110 <span class="keywordflow">case</span> <a class="code" href="a05378.html#a442a184">KeyLMENU</a>: +00111 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp0">_KeyArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_8">set</a> (<a class="code" href="a05378.html#a442a104">KeyMENU</a>); +00112 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp1">_KeyDownArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_8">set</a> (<a class="code" href="a05378.html#a442a104">KeyMENU</a>); +00113 <span class="keywordflow">break</span>; +00114 <span class="keywordflow">default</span>: +00115 <span class="keywordflow">break</span>; +00116 } +00117 } +00118 <span class="comment">// Key up ?</span> +00119 <span class="keywordflow">if</span> (event==<a class="code" href="a05378.html#a48">EventKeyUpId</a>) +00120 { +00121 <a class="code" href="a02471.html">CEventKeyUp</a> *pEvent=(<a class="code" href="a02471.html">CEventKeyUp</a>*)&event; +00122 +00123 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp0">_KeyArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_1">clear</a> (pEvent-><a class="code" href="a02471.html#NLMISC_1_1CEventKeyUpo2">Key</a>); +00124 +00125 <span class="keywordflow">switch</span>(pEvent-><a class="code" href="a02471.html#NLMISC_1_1CEventKeyUpo2">Key</a>) +00126 { +00127 <span class="keywordflow">case</span> <a class="code" href="a05378.html#a442a183">KeyRCONTROL</a>: +00128 <span class="keywordflow">case</span> <a class="code" href="a05378.html#a442a182">KeyLCONTROL</a>: +00129 <span class="comment">// Do not "raise up" the key, until someone has get the state of this key. </span> +00130 <span class="keywordflow">if</span> (!<a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp0">_KeyArray</a>[<a class="code" href="a05378.html#a442a182">KeyLCONTROL</a>] && !<a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp0">_KeyArray</a>[<a class="code" href="a05378.html#a442a183">KeyRCONTROL</a>]) +00131 { +00132 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp0">_KeyArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_1">clear</a>(<a class="code" href="a05378.html#a442a103">KeyCONTROL</a>); +00133 +00134 <span class="keywordflow">if</span>(<a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp2">_KeyReleaseArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_3">get</a>(<a class="code" href="a05378.html#a442a103">KeyCONTROL</a>)) +00135 { +00136 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp1">_KeyDownArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_1">clear</a> (<a class="code" href="a05378.html#a442a103">KeyCONTROL</a>); +00137 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp2">_KeyReleaseArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_1">clear</a> (<a class="code" href="a05378.html#a442a103">KeyCONTROL</a>); +00138 } +00139 } +00140 <span class="keywordflow">break</span>; +00141 <span class="keywordflow">case</span> <a class="code" href="a05378.html#a442a181">KeyRSHIFT</a>: +00142 <span class="keywordflow">case</span> <a class="code" href="a05378.html#a442a180">KeyLSHIFT</a>: +00143 <span class="keywordflow">if</span> (!<a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp0">_KeyArray</a>[<a class="code" href="a05378.html#a442a180">KeyLSHIFT</a>] && !<a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp0">_KeyArray</a>[<a class="code" href="a05378.html#a442a181">KeyRSHIFT</a>]) +00144 { +00145 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp0">_KeyArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_1">clear</a>(<a class="code" href="a05378.html#a442a102">KeySHIFT</a>); +00146 +00147 <span class="keywordflow">if</span>(<a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp2">_KeyReleaseArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_3">get</a>(<a class="code" href="a05378.html#a442a102">KeySHIFT</a>)) +00148 { +00149 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp1">_KeyDownArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_1">clear</a> (<a class="code" href="a05378.html#a442a102">KeySHIFT</a>); +00150 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp2">_KeyReleaseArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_1">clear</a> (<a class="code" href="a05378.html#a442a102">KeySHIFT</a>); +00151 } +00152 } +00153 <span class="keywordflow">break</span>; +00154 <span class="keywordflow">case</span> <a class="code" href="a05378.html#a442a185">KeyRMENU</a>: +00155 <span class="keywordflow">case</span> <a class="code" href="a05378.html#a442a184">KeyLMENU</a>: +00156 <span class="keywordflow">if</span> (!<a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp0">_KeyArray</a>[<a class="code" href="a05378.html#a442a184">KeyLMENU</a>] && !<a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp0">_KeyArray</a>[<a class="code" href="a05378.html#a442a185">KeyRMENU</a>]) +00157 { +00158 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp0">_KeyArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_1">clear</a>(<a class="code" href="a05378.html#a442a104">KeyMENU</a>); +00159 +00160 <span class="keywordflow">if</span>(<a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp2">_KeyReleaseArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_3">get</a>(<a class="code" href="a05378.html#a442a104">KeyMENU</a>)) +00161 { +00162 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp1">_KeyDownArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_1">clear</a> (<a class="code" href="a05378.html#a442a104">KeyMENU</a>); +00163 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp2">_KeyReleaseArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_1">clear</a> (<a class="code" href="a05378.html#a442a104">KeyMENU</a>); +00164 } +00165 } +00166 <span class="keywordflow">break</span>; +00167 <span class="keywordflow">default</span>: <span class="keywordflow">break</span>; +00168 } +00169 +00170 +00171 <span class="comment">// Do not "raise up" the key, until someone has get the state of this key.</span> +00172 <span class="keywordflow">if</span>(<a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp2">_KeyReleaseArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_3">get</a>(pEvent-><a class="code" href="a02471.html#NLMISC_1_1CEventKeyUpo2">Key</a>)) +00173 { +00174 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp1">_KeyDownArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_1">clear</a> (pEvent-><a class="code" href="a02471.html#NLMISC_1_1CEventKeyUpo2">Key</a>); +00175 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp2">_KeyReleaseArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_1">clear</a> (pEvent-><a class="code" href="a02471.html#NLMISC_1_1CEventKeyUpo2">Key</a>); +00176 } +00177 +00178 } +00179 <span class="comment">// Activate false ?</span> +00180 <span class="keywordflow">if</span> (event==<a class="code" href="a05378.html#a51">EventSetFocusId</a>) +00181 { +00182 <a class="code" href="a02480.html">CEventSetFocus</a> *pEvent=(<a class="code" href="a02480.html">CEventSetFocus</a> *)&event; +00183 <span class="keywordflow">if</span> (!pEvent-><a class="code" href="a02480.html#NLMISC_1_1CEventSetFocuso1">Get</a>) +00184 { +00185 <span class="comment">// Disactive all keys</span> +00186 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp0">_KeyArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_2">clearAll</a> (); +00187 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp1">_KeyDownArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_2">clearAll</a> (); +00188 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp2">_KeyReleaseArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_2">clearAll</a> (); +00189 } +00190 } +00191 } +00192 +00193 +00194 <span class="comment">// ***************************************************************************</span> +<a name="l00195"></a><a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsynca5">00195</a> <span class="keywordtype">void</span> CEventListenerAsync::reset () +00196 { +00197 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp0">_KeyArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_2">clearAll</a> (); +00198 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp1">_KeyDownArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_2">clearAll</a> (); +00199 <a class="code" href="a02472.html#NLMISC_1_1CEventListenerAsyncp2">_KeyReleaseArray</a>.<a class="code" href="a02272.html#NLMISC_1_1CBitSetz1920_2">clearAll</a> (); +00200 } +00201 +00202 +00203 } <span class="comment">// NLMISC</span> +</pre></div><hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:24:52 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |