aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/di__keyboard__device_8cpp-source.html
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
committerneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
commit0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch)
tree2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/di__keyboard__device_8cpp-source.html
downloadnevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz
nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip
Initial commit
Diffstat (limited to 'docs/doxygen/nel/di__keyboard__device_8cpp-source.html')
-rw-r--r--docs/doxygen/nel/di__keyboard__device_8cpp-source.html698
1 files changed, 698 insertions, 0 deletions
diff --git a/docs/doxygen/nel/di__keyboard__device_8cpp-source.html b/docs/doxygen/nel/di__keyboard__device_8cpp-source.html
new file mode 100644
index 00000000..ca578d45
--- /dev/null
+++ b/docs/doxygen/nel/di__keyboard__device_8cpp-source.html
@@ -0,0 +1,698 @@
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<HTML>
+<HEAD>
+ <TITLE>nevrax.org : docs</TITLE>
+ <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css">
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+</HEAD>
+<BODY MARGINHEIGHT="0" MARGINWIDTH="0">
+
+<!-- uplinks -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ </TR>
+</TABLE>
+
+<!-- banner Nevrax -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%>
+ <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
+</TABLE>
+
+<!-- main table -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+ <!------ Begin Box ------>
+ <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
+ <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF>
+ <TABLE cellspacing=0 cellpadding=1 border=0>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr>
+ </TABLE>
+ </TD></TR></TABLE></TD></TR></TABLE>
+ <!------ End Box ------>
+
+ </TD>
+ <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+<!-- title -->
+<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td>
+<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
+</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
+</td></tr></table>
+&nbsp;
+
+<!-- block -->
+<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD>
+ <TD><B>Documentation</B></TD>
+ <TD ALIGN=RIGHT>&nbsp;</td>
+</tr></table>
+<!-- Generated by Doxygen 1.2.14 -->
+<center>
+<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
+<hr><h1>di_keyboard_device.cpp</h1><a href="di__keyboard__device_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
+00007 <font class="comment">/* Copyright, 2000-2002 Nevrax Ltd.</font>
+00008 <font class="comment"> *</font>
+00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
+00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
+00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
+00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
+00013 <font class="comment"> * any later version.</font>
+00014 <font class="comment"></font>
+00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
+00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
+00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
+00018 <font class="comment"> * General Public License for more details.</font>
+00019 <font class="comment"></font>
+00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
+00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
+00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
+00023 <font class="comment"> * MA 02111-1307, USA.</font>
+00024 <font class="comment"> */</font>
+00025
+00026
+00027
+00028 <font class="preprocessor">#include "<a class="code" href="stdmisc_8h.html">stdmisc.h</a>"</font>
+00029 <font class="preprocessor">#include "<a class="code" href="di__keyboard__device_8h.html">misc/di_keyboard_device.h</a>"</font>
+00030
+00031 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
+00032 <font class="preprocessor"></font>
+00033 <font class="preprocessor">#include "<a class="code" href="win__event__emitter_8h.html">nel/misc/win_event_emitter.h</a>"</font>
+00034 <font class="preprocessor">#include &lt;memory&gt;</font>
+00035 <font class="preprocessor">#include &lt;dinput.h&gt;</font>
+00036 <font class="preprocessor">#include &lt;Winuser.h&gt;</font>
+00037
+00038 <font class="preprocessor">#include "Mmsystem.h"</font>
+00039
+00040
+00041 <font class="preprocessor">#ifdef min</font>
+00042 <font class="preprocessor"></font><font class="preprocessor">#undef min</font>
+00043 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
+00044 <font class="preprocessor"></font>
+00045 <font class="preprocessor">#ifdef max</font>
+00046 <font class="preprocessor"></font><font class="preprocessor">#undef max</font>
+00047 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
+00048 <font class="preprocessor"></font>
+00049 <font class="keyword">namespace </font>NLMISC
+00050 {
+00051
+00052 <font class="comment">// used to do a conversion from DX key code to Nel keys enums</font>
+00053 <font class="keyword">struct </font>CKeyConv
+00054 {
+00055 <a class="code" href="types__nl_8h.html#a14">uint</a> DIKey;
+00056 <a class="code" href="namespaceNLMISC.html#a296">TKey</a> NelKey;
+00057 <font class="keyword">const</font> <font class="keywordtype">char</font> *KeyName;
+00058 <font class="keywordtype">bool</font> Repeatable;
+00059 };
+00060
+00061 <font class="comment">// this is used to build a conversion table</font>
+00062 <font class="keyword">static</font> <font class="keyword">const</font> CKeyConv DIToNel[] =
+00063 {
+00064 <font class="comment">//</font>
+00065 {DIK_F1, <a class="code" href="namespaceNLMISC.html#a296a113">KeyF1</a>, <font class="stringliteral">"F1"</font>, <font class="keyword">true</font>},
+00066 {DIK_F2, <a class="code" href="namespaceNLMISC.html#a296a114">KeyF2</a>, <font class="stringliteral">"F2"</font>, <font class="keyword">true</font>},
+00067 {DIK_F3, <a class="code" href="namespaceNLMISC.html#a296a115">KeyF3</a>, <font class="stringliteral">"F3"</font>, <font class="keyword">true</font>},
+00068 {DIK_F4, <a class="code" href="namespaceNLMISC.html#a296a116">KeyF4</a>, <font class="stringliteral">"F4"</font>, <font class="keyword">true</font>},
+00069 {DIK_F5, <a class="code" href="namespaceNLMISC.html#a296a117">KeyF5</a>, <font class="stringliteral">"F5"</font>, <font class="keyword">true</font>},
+00070 {DIK_F6, <a class="code" href="namespaceNLMISC.html#a296a118">KeyF6</a>, <font class="stringliteral">"F6"</font>, <font class="keyword">true</font>},
+00071 {DIK_F7, <a class="code" href="namespaceNLMISC.html#a296a119">KeyF7</a>, <font class="stringliteral">"F7"</font>, <font class="keyword">true</font>},
+00072 {DIK_F8, <a class="code" href="namespaceNLMISC.html#a296a120">KeyF8</a>, <font class="stringliteral">"F8"</font>, <font class="keyword">true</font>},
+00073 {DIK_F9, <a class="code" href="namespaceNLMISC.html#a296a121">KeyF9</a>, <font class="stringliteral">"F9"</font>, <font class="keyword">true</font>},
+00074 {DIK_F10, <a class="code" href="namespaceNLMISC.html#a296a122">KeyF10</a>, <font class="stringliteral">"F10"</font>, <font class="keyword">true</font>},
+00075 {DIK_F11, <a class="code" href="namespaceNLMISC.html#a296a123">KeyF11</a>, <font class="stringliteral">"F11"</font>, <font class="keyword">true</font>},
+00076 {DIK_F12, <a class="code" href="namespaceNLMISC.html#a296a124">KeyF12</a>, <font class="stringliteral">"F12"</font>, <font class="keyword">true</font>},
+00077 {DIK_F13, <a class="code" href="namespaceNLMISC.html#a296a125">KeyF13</a>, <font class="stringliteral">"F13"</font>, <font class="keyword">true</font>},
+00078 {DIK_F14, <a class="code" href="namespaceNLMISC.html#a296a126">KeyF14</a>, <font class="stringliteral">"F14"</font>, <font class="keyword">true</font>},
+00079 {DIK_F15, <a class="code" href="namespaceNLMISC.html#a296a127">KeyF15</a>, <font class="stringliteral">"F15"</font>, <font class="keyword">true</font>},
+00080 <font class="comment">//</font>
+00081 {DIK_NUMPAD0, <a class="code" href="namespaceNLMISC.html#a296a97">KeyNUMPAD0</a>, <font class="stringliteral">"NUMPAD0"</font>, <font class="keyword">true</font>},
+00082 {DIK_NUMPAD1, <a class="code" href="namespaceNLMISC.html#a296a98">KeyNUMPAD1</a>, <font class="stringliteral">"NUMPAD1"</font>, <font class="keyword">true</font>},
+00083 {DIK_NUMPAD2, <a class="code" href="namespaceNLMISC.html#a296a99">KeyNUMPAD2</a>, <font class="stringliteral">"NUMPAD2"</font>, <font class="keyword">true</font>},
+00084 {DIK_NUMPAD3, <a class="code" href="namespaceNLMISC.html#a296a100">KeyNUMPAD3</a>, <font class="stringliteral">"NUMPAD3"</font>, <font class="keyword">true</font>},
+00085 {DIK_NUMPAD4, <a class="code" href="namespaceNLMISC.html#a296a101">KeyNUMPAD4</a>, <font class="stringliteral">"NUMPAD4"</font>, <font class="keyword">true</font>},
+00086 {DIK_NUMPAD5, <a class="code" href="namespaceNLMISC.html#a296a102">KeyNUMPAD5</a>, <font class="stringliteral">"NUMPAD5"</font>, <font class="keyword">true</font>},
+00087 {DIK_NUMPAD6, <a class="code" href="namespaceNLMISC.html#a296a103">KeyNUMPAD6</a>, <font class="stringliteral">"NUMPAD6"</font>, <font class="keyword">true</font>},
+00088 {DIK_NUMPAD7, <a class="code" href="namespaceNLMISC.html#a296a104">KeyNUMPAD7</a>, <font class="stringliteral">"NUMPAD7"</font>, <font class="keyword">true</font>},
+00089 {DIK_NUMPAD8, <a class="code" href="namespaceNLMISC.html#a296a105">KeyNUMPAD8</a>, <font class="stringliteral">"NUMPAD8"</font>, <font class="keyword">true</font>},
+00090 {DIK_NUMPAD9, <a class="code" href="namespaceNLMISC.html#a296a106">KeyNUMPAD9</a>, <font class="stringliteral">"NUMPAD9"</font>, <font class="keyword">true</font>},
+00091 <font class="comment">//</font>
+00092 {DIK_DIVIDE, <a class="code" href="namespaceNLMISC.html#a296a112">KeyDIVIDE</a>, <font class="stringliteral">"/"</font>, <font class="keyword">true</font>},
+00093 {DIK_DECIMAL, <a class="code" href="namespaceNLMISC.html#a296a111">KeyDECIMAL</a>, <font class="stringliteral">"NUMPAD ."</font>, <font class="keyword">true</font>},
+00094 <font class="comment">//</font>
+00095 {DIK_LSHIFT, <a class="code" href="namespaceNLMISC.html#a296a139">KeyLSHIFT</a>, <font class="stringliteral">"LEFT SHIFT"</font>, <font class="keyword">false</font>},
+00096 {DIK_RSHIFT, <a class="code" href="namespaceNLMISC.html#a296a140">KeyRSHIFT</a>, <font class="stringliteral">"RIGHT SHIFT"</font>, <font class="keyword">false</font>},
+00097 <font class="comment">//</font>
+00098 {DIK_LCONTROL, <a class="code" href="namespaceNLMISC.html#a296a141">KeyLCONTROL</a>, <font class="stringliteral">"LEFT CONTROL"</font>, <font class="keyword">false</font>},
+00099 {DIK_RCONTROL, <a class="code" href="namespaceNLMISC.html#a296a142">KeyRCONTROL</a>, <font class="stringliteral">"RIGHT CONTROL"</font>, <font class="keyword">false</font>},
+00100 <font class="comment">//</font>
+00101 {DIK_LMENU, <a class="code" href="namespaceNLMISC.html#a296a143">KeyLMENU</a>, <font class="stringliteral">"ALT"</font>, <font class="keyword">false</font>},
+00102 {DIK_RMENU, <a class="code" href="namespaceNLMISC.html#a296a144">KeyRMENU</a>, <font class="stringliteral">"ALT GR"</font>, <font class="keyword">false</font>},
+00103 <font class="comment">//</font>
+00104 {DIK_UP, <a class="code" href="namespaceNLMISC.html#a296a84">KeyUP</a>, <font class="stringliteral">"UP"</font>, <font class="keyword">true</font>},
+00105 {DIK_PRIOR, <a class="code" href="namespaceNLMISC.html#a296a79">KeyPRIOR</a>, <font class="stringliteral">"PRIOR"</font>, <font class="keyword">true</font>},
+00106 {DIK_LEFT, <a class="code" href="namespaceNLMISC.html#a296a83">KeyLEFT</a>, <font class="stringliteral">"LEFT"</font>, <font class="keyword">true</font>},
+00107 {DIK_RIGHT, <a class="code" href="namespaceNLMISC.html#a296a85">KeyRIGHT</a>, <font class="stringliteral">"RIGHT"</font>, <font class="keyword">true</font>},
+00108 {DIK_END, <a class="code" href="namespaceNLMISC.html#a296a81">KeyEND</a>, <font class="stringliteral">"END"</font>, <font class="keyword">true</font>},
+00109 {DIK_DOWN, <a class="code" href="namespaceNLMISC.html#a296a86">KeyDOWN</a>, <font class="stringliteral">"DOWN"</font>, <font class="keyword">true</font>},
+00110 {DIK_NEXT, <a class="code" href="namespaceNLMISC.html#a296a80">KeyNEXT</a>, <font class="stringliteral">"NEXT"</font>, <font class="keyword">true</font>},
+00111 {DIK_INSERT, <a class="code" href="namespaceNLMISC.html#a296a91">KeyINSERT</a>, <font class="stringliteral">"INSERT"</font>, <font class="keyword">true</font>},
+00112 {DIK_DELETE, <a class="code" href="namespaceNLMISC.html#a296a92">KeyDELETE</a>, <font class="stringliteral">"DELETE"</font>, <font class="keyword">true</font>},
+00113 {DIK_HOME, <a class="code" href="namespaceNLMISC.html#a296a82">KeyHOME</a>, <font class="stringliteral">"HOME"</font>, <font class="keyword">true</font>},
+00114 {DIK_LWIN, <a class="code" href="namespaceNLMISC.html#a296a94">KeyLWIN</a>, <font class="stringliteral">"LEFT WIN"</font>, <font class="keyword">false</font>},
+00115 {DIK_RWIN, <a class="code" href="namespaceNLMISC.html#a296a95">KeyRWIN</a>, <font class="stringliteral">"RIGHT WIN"</font>, <font class="keyword">false</font>},
+00116 {DIK_APPS, <a class="code" href="namespaceNLMISC.html#a296a96">KeyAPPS</a>, <font class="stringliteral">"APPS"</font>, <font class="keyword">false</font>},
+00117 <font class="comment">//</font>
+00118 {DIK_SYSRQ, <a class="code" href="namespaceNLMISC.html#a296a90">KeySNAPSHOT</a>, <font class="stringliteral">"SNAPSHOT"</font>, <font class="keyword">false</font>},
+00119 {DIK_SCROLL, <a class="code" href="namespaceNLMISC.html#a296a138">KeySCROLL</a>, <font class="stringliteral">"SCROLL"</font>, <font class="keyword">false</font>},
+00120 {DIK_PAUSE, <a class="code" href="namespaceNLMISC.html#a296a64">KeyPAUSE</a>, <font class="stringliteral">"PAUSE"</font>, <font class="keyword">false</font>},
+00121 <font class="comment">// </font>
+00122 {DIK_NUMLOCK, <a class="code" href="namespaceNLMISC.html#a296a137">KeyNUMLOCK</a>, <font class="stringliteral">"NUMLOCK"</font>, <font class="keyword">false</font>},
+00123 <font class="comment">//</font>
+00124 <font class="comment">//{DIK_NUMPADENTER, KeyRETURN, "ENTER", true},</font>
+00125 <font class="comment">//</font>
+00126 {DIK_CONVERT, <a class="code" href="namespaceNLMISC.html#a296a74">KeyCONVERT</a>, <font class="stringliteral">"CONVERT"</font>, <font class="keyword">false</font>},
+00127 {DIK_NOCONVERT, <a class="code" href="namespaceNLMISC.html#a296a75">KeyNONCONVERT</a>, <font class="stringliteral">"NOCONVERT"</font>, <font class="keyword">true</font>},
+00128 <font class="comment">//</font>
+00129 {DIK_KANA, <a class="code" href="namespaceNLMISC.html#a296a66">KeyKANA</a>, <font class="keyword">false</font>},
+00130 {DIK_KANJI, <a class="code" href="namespaceNLMISC.html#a296a72">KeyKANJI</a>, <font class="keyword">false</font>},
+00131 };
+00132
+00133
+00135 <font class="keyword">const</font> CKeyConv *CDIKeyboard::DIKeyToNelKeyTab[CDIKeyboard::NumKeys];
+00136
+00138 CDIKeyboard::CDIKeyboard(CWinEventEmitter *we, HWND hwnd)
+00139 : _Keyboard(NULL),
+00140 _WE(we),
+00141 ShiftPressed(false),
+00142 CtrlPressed(false),
+00143 AltPressed(false),
+00144 _CapsLockToggle(true),
+00145 _hWnd(hwnd),
+00146 _RepeatDelay(250),
+00147 _RepeatPeriod(200),
+00148 _FirstPressDate(-1),
+00149 _LastDIKeyPressed(0)
+00150 {
+00151 <font class="keywordflow">if</font> (::GetKeyboardState((PBYTE) _VKKeyState) == FALSE)
+00152 {
+00153 std::fill(_VKKeyState, _VKKeyState + NumKeys, 0);
+00154 }
+00155 <font class="comment">// test wether the user toggle its keyboard with shift or not..</font>
+00156 HKEY hKey;
+00157 <font class="keywordflow">if</font> (::RegOpenKeyEx(HKEY_CURRENT_USER, <font class="stringliteral">"Keyboard Layout"</font>, 0, KEY_READ, &amp;hKey) == ERROR_SUCCESS)
+00158 {
+00159 DWORD <a class="code" href="driver__opengl__extension__def_8h.html#a251">type</a> = REG_DWORD;
+00160 DWORD value;
+00161 DWORD size = <font class="keyword">sizeof</font>(DWORD);
+00162 <font class="keywordflow">if</font> (::RegQueryValueEx(hKey, <font class="stringliteral">"Attributes"</font>, NULL, &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a251">type</a>, (LPBYTE) &amp;value, &amp;size) == ERROR_SUCCESS)
+00163 {
+00164 _CapsLockToggle = (value &amp; (1 &lt;&lt; 16)) == 0;
+00165 }
+00166 ::RegCloseKey(hKey);
+00167 }
+00168 <font class="comment">// get repeat delay and period</font>
+00169 <font class="keywordtype">int</font> keybDelay;
+00170 <font class="keywordflow">if</font> (::SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &amp;keybDelay, 0) != 0)
+00171 {
+00172 _RepeatDelay = 250 + 250 * keybDelay;
+00173 }
+00174 DWORD keybSpeed;
+00175 <font class="keywordflow">if</font> (::SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &amp;keybSpeed, 0) != 0)
+00176 {
+00177 _RepeatPeriod = (uint) (1000.f / (keybSpeed * (27.5f / 31.f) + 2.5f));
+00178 }
+00179 <font class="comment">// get keyboard layout</font>
+00180 _KBLayout = ::GetKeyboardLayout(NULL);
+00181
+00182 _RepetitionDisabled.resize(NumKeys);
+00183 _RepetitionDisabled.clearAll();
+00184 }
+00185
+00187 <font class="keywordtype">void</font> CDIKeyboard::updateVKKeyState(<a class="code" href="types__nl_8h.html#a14">uint</a> diKey, <font class="keywordtype">bool</font> pressed, <a class="code" href="namespaceNLMISC.html#a296">TKey</a> &amp;keyValue, <a class="code" href="namespaceNLMISC.html#a296">TKey</a> &amp;charValue)
+00188 {
+00189 <font class="keywordtype">bool</font> extKey;
+00190 <font class="keywordtype">bool</font> repeatable;
+00191 keyValue = DIKeyToNelKey(diKey, extKey, repeatable);
+00192 <font class="comment">//</font>
+00193 <font class="keywordflow">if</font> (keyValue == 0)
+00194 {
+00195 charValue = keyValue;
+00196 <font class="keywordflow">return</font>;
+00197 }
+00198 <font class="comment">//</font>
+00199 <font class="keywordflow">if</font> (pressed)
+00200 {
+00201 <font class="comment">// check for toggle key </font>
+00202 <font class="keywordflow">switch</font> (keyValue)
+00203 {
+00204 <font class="keywordflow">case</font> <a class="code" href="namespaceNLMISC.html#a296a64">KeyPAUSE</a>:
+00205 <font class="keywordflow">case</font> <a class="code" href="namespaceNLMISC.html#a296a66">KeyKANA</a>:
+00206 <font class="keywordflow">case</font> <a class="code" href="namespaceNLMISC.html#a296a72">KeyKANJI</a>:
+00207 _VKKeyState[keyValue] ^= 0x01; <font class="comment">// toggle first bit </font>
+00208 <font class="keywordflow">break</font>;
+00209 <font class="keywordflow">case</font> <a class="code" href="namespaceNLMISC.html#a296a65">KeyCAPITAL</a>:
+00210 <font class="keywordflow">if</font> (_CapsLockToggle)
+00211 {
+00212 _VKKeyState[keyValue] ^= 0x01;
+00213 <font class="comment">//toggleCapsLock(false);</font>
+00214 }
+00215 <font class="keywordflow">else</font>
+00216 {
+00217 <font class="keywordflow">if</font> ((_VKKeyState[keyValue] &amp; 0x01) == 0)
+00218 {
+00219 _VKKeyState[keyValue] |= 0x01;
+00220 <font class="comment">//toggleCapsLock(false);</font>
+00221 }
+00222 }
+00223 <font class="keywordflow">break</font>;
+00224 <font class="keywordflow">case</font> <a class="code" href="namespaceNLMISC.html#a296a137">KeyNUMLOCK</a>:
+00225 _VKKeyState[keyValue] ^= 0x01;
+00226 <font class="comment">//setNumLock((_VKKeyState[keyValue] &amp; 0x01) != 0);</font>
+00227 <font class="keywordflow">break</font>;
+00228 <font class="keywordflow">case</font> <a class="code" href="namespaceNLMISC.html#a296a138">KeySCROLL</a>:
+00229 _VKKeyState[keyValue] ^= 0x01;
+00230 <font class="comment">//toggleScrollLock();</font>
+00231 <font class="keywordflow">break</font>;
+00232
+00233 }
+00234
+00235 _VKKeyState[keyValue] |= 0x80;
+00236 }
+00237 <font class="keywordflow">else</font>
+00238 {
+00239 _VKKeyState[keyValue] &amp;= ~0x80;
+00240 }
+00241 <font class="comment">//</font>
+00242 <font class="keywordflow">switch</font> (keyValue)
+00243 {
+00244 <font class="keywordflow">case</font> <a class="code" href="namespaceNLMISC.html#a296a139">KeyLSHIFT</a>: charValue = <a class="code" href="namespaceNLMISC.html#a296a61">KeySHIFT</a>; <font class="keywordflow">break</font>;
+00245 <font class="keywordflow">case</font> <a class="code" href="namespaceNLMISC.html#a296a140">KeyRSHIFT</a>: charValue = <a class="code" href="namespaceNLMISC.html#a296a61">KeySHIFT</a>; <font class="keywordflow">break</font>;
+00246 <font class="keywordflow">case</font> <a class="code" href="namespaceNLMISC.html#a296a141">KeyLCONTROL</a>: charValue = <a class="code" href="namespaceNLMISC.html#a296a62">KeyCONTROL</a>; <font class="keywordflow">break</font>;
+00247 <font class="keywordflow">case</font> <a class="code" href="namespaceNLMISC.html#a296a142">KeyRCONTROL</a>: charValue = <a class="code" href="namespaceNLMISC.html#a296a62">KeyCONTROL</a>; <font class="keywordflow">break</font>;
+00248 <font class="keywordflow">case</font> <a class="code" href="namespaceNLMISC.html#a296a143">KeyLMENU</a>: charValue = <a class="code" href="namespaceNLMISC.html#a296a63">KeyMENU</a>; <font class="keywordflow">break</font>;
+00249 <font class="keywordflow">case</font> <a class="code" href="namespaceNLMISC.html#a296a144">KeyRMENU</a>: charValue = <a class="code" href="namespaceNLMISC.html#a296a63">KeyMENU</a>; <font class="keywordflow">break</font>;
+00250 <font class="keywordflow">default</font>: charValue = keyValue; <font class="keywordflow">break</font>;
+00251 }
+00252 <font class="comment">//</font>
+00253 <font class="keywordflow">if</font> (charValue == <a class="code" href="namespaceNLMISC.html#a296a61">KeySHIFT</a> &amp;&amp; !_CapsLockToggle)
+00254 {
+00255 <font class="keywordflow">if</font> (_VKKeyState[<a class="code" href="namespaceNLMISC.html#a296a65">KeyCAPITAL</a>] &amp; 0x01)
+00256 {
+00257 _VKKeyState[<a class="code" href="namespaceNLMISC.html#a296a65">KeyCAPITAL</a>] &amp;= ~0x01;
+00258 <font class="comment">//toggleCapsLock(true);</font>
+00259 }
+00260 }
+00261 <font class="comment">//</font>
+00262 <font class="keywordflow">if</font> (charValue != keyValue)
+00263 {
+00264 _VKKeyState[charValue] = _VKKeyState[keyValue];
+00265 }
+00266 <font class="comment">//</font>
+00267 updateCtrlAltShiftValues();
+00268 }
+00269
+00271 <font class="keywordtype">void</font> CDIKeyboard::updateCtrlAltShiftValues()
+00272 {
+00273 ShiftPressed = (_VKKeyState[<a class="code" href="namespaceNLMISC.html#a296a61">KeySHIFT</a>] &amp; 0x80) != 0;
+00274 CtrlPressed = (_VKKeyState[<a class="code" href="namespaceNLMISC.html#a296a62">KeyCONTROL</a>] &amp; 0x80) != 0;
+00275 AltPressed = (_VKKeyState[<a class="code" href="namespaceNLMISC.html#a296a63">KeyMENU</a>] &amp; 0x80) != 0;
+00276 }
+00277
+00279 CDIKeyboard::~CDIKeyboard()
+00280 {
+00281 <font class="keywordflow">if</font> (_Keyboard)
+00282 {
+00283 _Keyboard-&gt;Unacquire();
+00284 _Keyboard-&gt;Release();
+00285 }
+00286 }
+00287
+00289 CDIKeyboard *CDIKeyboard::createKeyboardDevice(IDirectInput8 *di8,
+00290 HWND hwnd,
+00291 CDIEventEmitter *diEventEmitter,
+00292 CWinEventEmitter *we
+00293 ) <font class="keywordflow">throw</font>(EDirectInput)
+00294 {
+00295 std::auto_ptr&lt;CDIKeyboard&gt; kb(<font class="keyword">new</font> CDIKeyboard(we, hwnd));
+00296 kb-&gt;_DIEventEmitter = diEventEmitter;
+00297 HRESULT result = di8-&gt;CreateDevice(GUID_SysKeyboard, &amp;kb-&gt;_Keyboard, NULL);
+00298 <font class="keywordflow">if</font> (result != DI_OK) <font class="keywordflow">throw</font> EDirectInputNoKeyboard();
+00299 result = kb-&gt;_Keyboard-&gt;SetCooperativeLevel(hwnd, DISCL_FOREGROUND | DISCL_EXCLUSIVE);
+00300 <font class="keywordflow">if</font> (result != DI_OK) <font class="keywordflow">throw</font> EDirectInputCooperativeLevelFailed();
+00301 result = kb-&gt;_Keyboard-&gt;SetDataFormat(&amp;c_dfDIKeyboard);
+00302 kb-&gt;setBufferSize(16);
+00303 kb-&gt;_Keyboard-&gt;Acquire();
+00304 <font class="keywordflow">return</font> kb.release();
+00305 }
+00306
+00308 <font class="keywordtype">void</font> CDIKeyboard::poll(CInputDeviceServer *dev)
+00309 {
+00310 <a class="code" href="debug_8h.html#a6">nlassert</a>(_Keyboard);
+00311 <a class="code" href="debug_8h.html#a6">nlassert</a>(_KeyboardBufferSize &gt; 0);
+00312 <font class="keyword">static</font> std::vector&lt;DIDEVICEOBJECTDATA&gt; datas;
+00313 datas.resize(_KeyboardBufferSize);
+00314 DWORD numElements = _KeyboardBufferSize;
+00315 HRESULT result = _Keyboard-&gt;GetDeviceData(<font class="keyword">sizeof</font>(DIDEVICEOBJECTDATA), &amp;datas[0], &amp;numElements, 0);
+00316 <font class="keywordflow">if</font> (result == DIERR_NOTACQUIRED || result == DIERR_INPUTLOST)
+00317 {
+00318 result = _Keyboard-&gt;Acquire();
+00319 <font class="keywordflow">if</font> (result != DI_OK) <font class="keywordflow">return</font>;
+00320 <font class="comment">// get device state</font>
+00321 ::GetKeyboardState((<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *) _VKKeyState);
+00322 _LastDIKeyPressed = 0;
+00323 updateCtrlAltShiftValues();
+00324 result = _Keyboard-&gt;GetDeviceData(<font class="keyword">sizeof</font>(DIDEVICEOBJECTDATA), &amp;datas[0], &amp;numElements, 0);
+00325 <font class="keywordflow">if</font> (result != DI_OK) <font class="keywordflow">return</font>;
+00326 }
+00327 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (result != DI_OK)
+00328 {
+00329 <font class="keywordflow">return</font>;
+00330 }
+00331
+00332 _PollTime = (uint32) CTime::getLocalTime();
+00333
+00334
+00335 <font class="comment">// process each message in the list</font>
+00336 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a14">uint</a> k = 0; k &lt; numElements; ++k)
+00337 {
+00338 CDIEvent *die = <font class="keyword">new</font> CDIEvent;
+00339 die-&gt;Emitter = <font class="keyword">this</font>;
+00340 die-&gt;Datas = datas[k];
+00341 dev-&gt;submitEvent(die);
+00342 }
+00343 }
+00344
+00346 <font class="keywordtype">void</font> CDIKeyboard::transitionOccured(CEventServer *server, <font class="keyword">const</font> IInputDeviceEvent *nextMessage)
+00347 {
+00348 repeatKey(buildDateFromEvent(nextMessage), server);
+00349 }
+00350
+00352 <a class="code" href="namespaceNLMISC.html#a298">TKeyButton</a> CDIKeyboard::buildKeyButtonsFlags()<font class="keyword"> const</font>
+00353 <font class="keyword"></font>{
+00354 <font class="keywordflow">return</font> (TKeyButton) ( (ShiftPressed ? <a class="code" href="namespaceNLMISC.html#a298a165">shiftKeyButton</a> : 0)
+00355 | (CtrlPressed ? <a class="code" href="namespaceNLMISC.html#a298a166">altKeyButton</a> : 0)
+00356 | (AltPressed ? <a class="code" href="namespaceNLMISC.html#a298a164">ctrlKeyButton</a> : 0)
+00357 );
+00358 }
+00359
+00361 <font class="keywordtype">void</font> CDIKeyboard::keyTriggered(<font class="keywordtype">bool</font> pressed, <a class="code" href="types__nl_8h.html#a14">uint</a> dikey, CEventServer *server, <a class="code" href="types__nl_8h.html#a10">uint32</a> date)
+00362 {
+00363 <font class="preprocessor"> #if 0 </font>
+00364 <font class="preprocessor"></font> <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a14">uint</a> numPairs = <font class="keyword">sizeof</font>(DIToNel) / <font class="keyword">sizeof</font>(CKeyConv);
+00365 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a14">uint</a> k = 0; k &lt; numPairs; ++k)
+00366 {
+00367 <font class="keywordflow">if</font> (DIToNel[k].DIKey == key)
+00368 {
+00369 <a class="code" href="debug_8h.html#a1">nlinfo</a>(DIToNel[k].KeyName);
+00370 }
+00371 }
+00372 <font class="preprocessor"> #endif</font>
+00373 <font class="preprocessor"></font>
+00374
+00375 <a class="code" href="namespaceNLMISC.html#a296">TKey</a> keyValue, charValue;
+00376 updateVKKeyState(dikey, pressed, keyValue, charValue);
+00377 <font class="keywordflow">if</font> (keyValue == 0) <font class="keywordflow">return</font>;
+00378
+00379 CEventKey *ek;
+00380 <font class="keywordflow">if</font> (pressed ) ek = <font class="keyword">new</font> CEventKeyDown(keyValue, buildKeyButtonsFlags(), <font class="keyword">false</font>, _DIEventEmitter);
+00381 <font class="keywordflow">else</font> ek = <font class="keyword">new</font> CEventKeyUp(keyValue, buildKeyButtonsFlags(), _DIEventEmitter);
+00382 server-&gt;postEvent(ek);
+00383
+00384 <font class="keywordflow">if</font> (pressed)
+00385 {
+00386 <font class="keywordflow">if</font> (_RepetitionDisabled[(uint) keyValue] == <font class="keyword">false</font>)
+00387 {
+00388 _LastEmitDate = _FirstPressDate = date;
+00389 _LastDIKeyPressed = dikey;
+00390 }
+00391 <font class="keywordflow">else</font> <font class="comment">// not a repeatable key</font>
+00392 {
+00393 _LastDIKeyPressed = 0;
+00394 <font class="keywordflow">return</font>;
+00395 }
+00396 }
+00397 <font class="keywordflow">else</font>
+00398 {
+00399 <font class="comment">// key released ?</font>
+00400 <font class="keywordflow">if</font> (dikey == _LastDIKeyPressed)
+00401 {
+00402 _LastDIKeyPressed = 0;
+00403 }
+00404
+00405 <font class="keywordflow">if</font> (_RepetitionDisabled[(uint) keyValue] == <font class="keyword">true</font>)
+00406 {
+00407 <font class="keywordflow">return</font>;
+00408 }
+00409 }
+00410
+00411 <font class="comment">// first char event (if repetition not disabled) </font>
+00412 <font class="keywordflow">if</font> (keyValue &gt;= <a class="code" href="namespaceNLMISC.html#a296a97">KeyNUMPAD0</a> &amp;&amp; keyValue &lt;= <a class="code" href="namespaceNLMISC.html#a296a106">KeyNUMPAD9</a> || keyValue == <a class="code" href="namespaceNLMISC.html#a296a111">KeyDECIMAL</a>)
+00413 {
+00414 <font class="keywordflow">if</font> ((_VKKeyState[<a class="code" href="namespaceNLMISC.html#a296a137">KeyNUMLOCK</a>] &amp; 0x01) != 0)
+00415 {
+00416 sendUnicode(charValue, dikey, server, pressed);
+00417 }
+00418 }
+00419 <font class="keywordflow">else</font>
+00420 {
+00421 sendUnicode(charValue, dikey, server, pressed);
+00422 }
+00423
+00424 _FirstPressDate = date;
+00425 }
+00426
+00428 <font class="keywordtype">void</font> CDIKeyboard::submit(IInputDeviceEvent *deviceEvent, CEventServer *server)
+00429 {
+00430 CDIEvent *die = safe_cast&lt;CDIEvent *&gt;(deviceEvent);
+00431 <font class="keywordtype">bool</font> pressed = (die-&gt;Datas.dwData &amp; 0x80) != 0;
+00432 keyTriggered(pressed, (<a class="code" href="types__nl_8h.html#a14">uint</a>) die-&gt;Datas.dwOfs, server, die-&gt;Datas.dwTimeStamp);
+00433 }
+00434
+00436 <a class="code" href="namespaceNLMISC.html#a297">TMouseButton</a> CDIKeyboard::buildKeyboardButtonFlags()<font class="keyword"> const</font>
+00437 <font class="keyword"></font>{
+00438 <a class="code" href="debug_8h.html#a6">nlassert</a>(_Keyboard);
+00439 <font class="keywordflow">return</font> _DIEventEmitter-&gt;buildKeyboardButtonFlags();
+00440 }
+00441
+00443 <font class="keywordtype">bool</font> CDIKeyboard::setBufferSize(<a class="code" href="types__nl_8h.html#a14">uint</a> size)
+00444 {
+00445 <a class="code" href="debug_8h.html#a6">nlassert</a>(size &gt; 0);
+00446 <a class="code" href="debug_8h.html#a6">nlassert</a>(_Keyboard);
+00447 _Keyboard-&gt;Unacquire();
+00448 DIPROPDWORD dipdw;
+00449 dipdw.diph.dwSize = <font class="keyword">sizeof</font>(DIPROPDWORD);
+00450 dipdw.diph.dwHeaderSize = <font class="keyword">sizeof</font>(DIPROPHEADER);
+00451 dipdw.diph.dwObj = 0;
+00452 dipdw.diph.dwHow = DIPH_DEVICE;
+00453 dipdw.dwData = size;
+00454 HRESULT <a class="code" href="driver__opengl__extension__def_8h.html#a262">r</a> = _Keyboard-&gt;SetProperty( DIPROP_BUFFERSIZE, &amp;dipdw.diph );
+00455 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a262">r</a> != DI_OK) <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00456 _KeyboardBufferSize = size;
+00457 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00458 }
+00459
+00461 <a class="code" href="types__nl_8h.html#a14">uint</a> CDIKeyboard::getBufferSize()<font class="keyword"> const</font>
+00462 <font class="keyword"></font>{
+00463 <font class="keywordflow">return</font> _KeyboardBufferSize;
+00464 }
+00465
+00467 <a class="code" href="namespaceNLMISC.html#a296">TKey</a> CDIKeyboard::DIKeyToNelKey(<a class="code" href="types__nl_8h.html#a14">uint</a> diKey, <font class="keywordtype">bool</font> &amp;extKey, <font class="keywordtype">bool</font> &amp;repeatable)
+00468 {
+00469 <font class="comment">// some key are not handled by MapVirtualKeyEx so we need to convert them ourselves</font>
+00470 <font class="keyword">static</font> tableBuilt = <font class="keyword">false</font>;
+00471
+00472 <font class="keywordflow">if</font> (!tableBuilt)
+00473 {
+00474 <a class="code" href="types__nl_8h.html#a14">uint</a> k;
+00475 <font class="keywordflow">for</font> (k = 0; k &lt; NumKeys; ++k)
+00476 {
+00477 DIKeyToNelKeyTab[k] = NULL; <font class="comment">// set as not a valid key by default</font>
+00478 }
+00479 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a14">uint</a> numPairs = <font class="keyword">sizeof</font>(DIToNel) / <font class="keyword">sizeof</font>(CKeyConv);
+00480 <font class="keywordflow">for</font> (k = 0; k &lt; numPairs; ++k)
+00481 {
+00482 DIKeyToNelKeyTab[DIToNel[k].DIKey] = &amp;DIToNel[k];
+00483 }
+00484 tableBuilt = <font class="keyword">true</font>;
+00485 }
+00486
+00487
+00488 <font class="comment">//</font>
+00489 <font class="keywordflow">if</font> (DIKeyToNelKeyTab[diKey] != NULL)
+00490 {
+00491 <font class="keyword">const</font> CKeyConv &amp;keyConv = *DIKeyToNelKeyTab[diKey];
+00492 extKey = <font class="keyword">true</font>;
+00493 repeatable = keyConv.Repeatable;
+00494 <font class="keywordflow">return</font> keyConv.NelKey;
+00495 }
+00496
+00497
+00498
+00499 <font class="comment">// try doing the conversion using MapVirtualKey </font>
+00500 <a class="code" href="namespaceNLMISC.html#a296">TKey</a> key = (TKey) ::MapVirtualKeyEx(diKey, 1, _KBLayout);
+00501 extKey = <font class="keyword">false</font>;
+00502 <font class="keywordflow">return</font> key;
+00503 }
+00504
+00506 <font class="keywordtype">void</font> CDIKeyboard::sendUnicode(<a class="code" href="namespaceNLMISC.html#a296">TKey</a> vkey, <a class="code" href="types__nl_8h.html#a14">uint</a> dikey, CEventServer *server, <font class="keywordtype">bool</font> pressed)
+00507 {
+00508 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a14">uint</a> maxNumKeys = 8;
+00509 WCHAR keyUnicodes[maxNumKeys];
+00510 <a class="code" href="types__nl_8h.html#a6">uint8</a> oldShift = _VKKeyState[<a class="code" href="namespaceNLMISC.html#a296a61">KeySHIFT</a>];
+00512 <font class="keywordflow">if</font> (!_CapsLockToggle &amp;&amp; _VKKeyState[<a class="code" href="namespaceNLMISC.html#a296a65">KeyCAPITAL</a>] &amp; 0x01)
+00513 {
+00514 _VKKeyState[<a class="code" href="namespaceNLMISC.html#a296a61">KeySHIFT</a>] = 0;
+00515 }
+00516 <font class="comment">//</font>
+00517 <font class="keywordtype">int</font> res = ::ToUnicodeEx(vkey, dikey | (pressed ? 0 : (1 &lt;&lt; 15)), (<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *) _VKKeyState, keyUnicodes, maxNumKeys, 0, _KBLayout);
+00518 <font class="comment">//</font>
+00519 _VKKeyState[<a class="code" href="namespaceNLMISC.html#a296a61">KeySHIFT</a>] = oldShift;
+00520 <font class="comment">//</font>
+00521 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a13">sint</a> k = 0; k &lt; res; ++k)
+00522 {
+00523 CEventChar *evc = <font class="keyword">new</font> CEventChar((<a class="code" href="types__nl_8h.html#a15">ucchar</a>) keyUnicodes[k], buildKeyButtonsFlags(), _DIEventEmitter);
+00524 server-&gt;postEvent(evc);
+00525 }
+00526 }
+00527
+00529 <font class="keywordtype">void</font> CDIKeyboard::repeatKey(<a class="code" href="types__nl_8h.html#a10">uint32</a> currentDate, CEventServer *server)
+00530 {
+00531 <font class="keywordflow">if</font> (_LastDIKeyPressed == 0 || _LastDIKeyPressed == DIK_INSERT) <font class="keywordflow">return</font>;
+00532 <font class="keywordtype">bool</font> extKey;
+00533 <font class="keywordtype">bool</font> repeatable;
+00534 <a class="code" href="namespaceNLMISC.html#a296">TKey</a> vkey = DIKeyToNelKey(_LastDIKeyPressed, extKey, repeatable);
+00535 <font class="keywordflow">if</font> (vkey == 0) <font class="keywordflow">return</font>;
+00536 <font class="keywordflow">if</font> (currentDate - _FirstPressDate &lt; _RepeatDelay) <font class="keywordflow">return</font>;
+00537
+00538 <a class="code" href="types__nl_8h.html#a9">sint32</a> firstDate = _LastEmitDate - (_FirstPressDate + _RepeatDelay);
+00539 <a class="code" href="types__nl_8h.html#a9">sint32</a> lastDate = currentDate - (_FirstPressDate + _RepeatDelay);
+00540 <font class="keywordflow">if</font> (firstDate &lt; 0) firstDate = 0;
+00541
+00542 <font class="keywordflow">if</font> (lastDate &lt; firstDate) <font class="keywordflow">return</font>;
+00543
+00544 <a class="code" href="types__nl_8h.html#a14">uint</a> numRep = (uint) ((lastDate + _RepeatPeriod - 1) / _RepeatPeriod - (firstDate + _RepeatPeriod - 1) / _RepeatPeriod);
+00545 numRep = <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(16u, numRep); <font class="comment">// too much repetitions don't make sense...</font>
+00546 <font class="keywordflow">if</font> ((sint) numRep &lt; 0) <font class="keywordflow">return</font>; <font class="comment">// 50 days loop..</font>
+00547
+00548
+00549 <font class="comment">// numpad case</font>
+00550 <font class="keywordflow">if</font> (vkey &gt;= <a class="code" href="namespaceNLMISC.html#a296a97">KeyNUMPAD0</a> &amp;&amp; vkey &lt;= <a class="code" href="namespaceNLMISC.html#a296a106">KeyNUMPAD9</a> || vkey == <a class="code" href="namespaceNLMISC.html#a296a111">KeyDECIMAL</a>)
+00551 {
+00552 <font class="comment">// check wether numlock is activated</font>
+00553 <font class="keywordflow">if</font> ((_VKKeyState[<a class="code" href="namespaceNLMISC.html#a296a137">KeyNUMLOCK</a>] &amp; 0x01) != 0)
+00554 {
+00555 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a14">uint</a> k = 0; k &lt; numRep; ++k)
+00556 {
+00557 sendUnicode(vkey, _LastDIKeyPressed, server, <font class="keyword">true</font>);
+00558 }
+00559 }
+00560 <font class="keywordflow">else</font>
+00561 {
+00562 <font class="comment">// arrow, home, end.. events</font>
+00563 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a14">uint</a> k = 0; k &lt; numRep; ++k)
+00564 {
+00565 CEventKey *ek = <font class="keyword">new</font> CEventKeyDown(vkey, buildKeyButtonsFlags(), <font class="keyword">true</font>, _DIEventEmitter);
+00566 server-&gt;postEvent(ek);
+00567 }
+00568 }
+00569 }
+00570 <font class="keywordflow">else</font>
+00571 {
+00572 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a14">uint</a> k = 0; k &lt; numRep; ++k)
+00573 {
+00574 <font class="comment">// if it is an extended key, repetition won't be managed by sendUnicode</font>
+00575 <font class="keywordflow">if</font> (extKey &amp;&amp; repeatable)
+00576 {
+00577 CEventKey *ek = <font class="keyword">new</font> CEventKeyDown(vkey, buildKeyButtonsFlags(), <font class="keyword">true</font>, _DIEventEmitter);
+00578 server-&gt;postEvent(ek);
+00579 }
+00580 <font class="keywordflow">else</font>
+00581 {
+00582 sendUnicode(vkey, _LastDIKeyPressed, server, <font class="keyword">true</font>);
+00583 }
+00584 }
+00585 }
+00586
+00587 _LastEmitDate = currentDate;
+00588 }
+00589
+00591 <a class="code" href="types__nl_8h.html#a10">uint32</a> CDIKeyboard::buildDateFromEvent(<font class="keyword">const</font> IInputDeviceEvent *deviceEvent)
+00592 {
+00593 <font class="keywordflow">if</font> (deviceEvent)
+00594 {
+00595 <font class="keyword">const</font> CDIEvent *die = safe_cast&lt;const CDIEvent *&gt;(deviceEvent);
+00596 <font class="keywordflow">return</font> (uint32) die-&gt;Datas.dwData;
+00597 }
+00598 <font class="keywordflow">else</font>
+00599 {
+00600 <font class="keywordflow">return</font> _PollTime;
+00601 }
+00602 }
+00603
+00605 <font class="keywordtype">void</font> CDIKeyboard::disableRepetition(<font class="keyword">const</font> <a class="code" href="namespaceNLMISC.html#a296">TKey</a> *keyTab, <a class="code" href="types__nl_8h.html#a14">uint</a> numKey)
+00606 {
+00607 _RepetitionDisabled.clearAll();
+00608 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a14">uint</a> k = 0; k &lt; numKey; ++k)
+00609 {
+00610 _RepetitionDisabled.set((<a class="code" href="types__nl_8h.html#a13">sint</a>) keyTab[k]);
+00611 }
+00612
+00613 <font class="keywordflow">if</font> (_LastDIKeyPressed != 0)
+00614 {
+00615 <font class="keywordtype">bool</font> extKey;
+00616 <font class="keywordtype">bool</font> repeatable;
+00617 <a class="code" href="namespaceNLMISC.html#a296">TKey</a> key = DIKeyToNelKey(_LastDIKeyPressed, extKey, repeatable);
+00618 <font class="keywordflow">if</font> (_RepetitionDisabled[(uint) key])
+00619 {
+00620 <font class="comment">// disable this key repetition</font>
+00621 _LastDIKeyPressed = 0;
+00622 }
+00623 }
+00624 }
+00625
+00627 <a class="code" href="types__nl_8h.html#a14">uint</a> CDIKeyboard::getNumDisabledRepetition()<font class="keyword"> const</font>
+00628 <font class="keyword"></font>{
+00629 <a class="code" href="types__nl_8h.html#a14">uint</a> numKey = 0;
+00630 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a14">uint</a> k = 0; k &lt; NumKeys; ++k)
+00631 {
+00632 <font class="keywordflow">if</font> (_RepetitionDisabled[k]) ++numKey;
+00633 }
+00634 <font class="keywordflow">return</font> numKey;
+00635 }
+00636
+00638 <font class="keywordtype">void</font> CDIKeyboard::getDisabledRepetitions(<a class="code" href="namespaceNLMISC.html#a296">TKey</a> *destTab)<font class="keyword"> const</font>
+00639 <font class="keyword"></font>{
+00640 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a14">uint</a> k = 0; k &lt; NumKeys; ++k)
+00641 {
+00642 <font class="keywordflow">if</font> (_RepetitionDisabled[k]) *destTab++ = (TKey) k;
+00643 }
+00644 }
+00645
+00646
+00647
+00648 } <font class="comment">// NLMISC</font>
+00649
+00650
+00651 <font class="preprocessor">#endif NL_OS_WINDOWS</font>
+</pre></div>
+
+<!-- footer -->
+<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
+</TD>
+<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
+</TR>
+</TABLE>
+</BODY>
+</HTML>