_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

key.h
Go to the documentation of this file.
1 /* _______ __ __ __ ______ __ __ _______ __ __
2  * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
3  * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
4  * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
5  * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
6  * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
7  * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
8  *
9  * Copyright (c) 2004, 2005 darkbits Js_./
10  * Per Larsson a.k.a finalman _RqZ{a<^_aa
11  * Olof Naess�n a.k.a jansem/yakslem _asww7!uY`> )\a//
12  * _Qhm`] _f "'c 1!5m
13  * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[
14  * .)j(] .d_/ '-( P . S
15  * License: (BSD) <Td/Z <fP"5(\"??"\a. .L
16  * Redistribution and use in source and _dV>ws?a-?' ._/L #'
17  * binary forms, with or without )4d[#7r, . ' )d`)[
18  * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam'
19  * that the following conditions are met: j<<WP+k/);. _W=j f
20  * 1. Redistributions of source code must .$%w\/]Q . ."' . mj$
21  * retain the above copyright notice, ]E.pYY(Q]>. a J@\
22  * this list of conditions and the j(]1u<sE"L,. . ./^ ]{a
23  * following disclaimer. 4'_uomm\. )L);-4 (3=
24  * 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[
25  * reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m
26  * this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/
27  * following disclaimer in the <B!</]C)d_, '(<' .f. =C+m
28  * documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]'
29  * provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W"
30  * 3. Neither the name of Guichan nor the :$we` _! + _/ . j?
31  * names of its contributors may be used =3)= _f (_yQmWW$#( "
32  * to endorse or promote products derived - W, sQQQQmZQ#Wwa]..
33  * from this software without specific (js, \[QQW$QWW#?!V"".
34  * prior written permission. ]y:.<\.. .
35  * -]n w/ ' [.
36  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ !
37  * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , '
38  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- %
39  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r
40  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
41  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
42  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
43  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
44  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
45  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
46  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
47  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ^
48  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
49  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
50  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
51  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
52  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53  */
54 
55 #ifndef GCN_KEY_HPP
56 #define GCN_KEY_HPP
57 
58 #include <string>
59 
60 #include "guichan/platform.h"
61 
62 namespace gcn
63 {
68  {
69  public:
73  Key();
74 
80  Key(int value);
81 
87  bool isCharacter() const;
88 
94  bool isNumber() const;
95 
101  bool isLetter() const;
102 
108  bool isShiftPressed() const;
109 
115  void setShiftPressed(bool pressed);
116 
121  bool isControlPressed() const;
122 
128  void setControlPressed(bool pressed);
129 
135  bool isAltPressed() const;
136 
142  void setAltPressed(bool pressed);
143 
149  bool isMetaPressed() const;
150 
156  void setMetaPressed(bool pressed);
157 
163  bool isNumericPad() const;
164 
170  void setNumericPad(bool numpad);
171 
178  int getValue() const;
179 
185  void setValue(int value);
186 
190  std::string toString() const;
191 
195  enum
196  {
197  K_SPACE = ' ',
198  K_TAB = '\t',
199  K_ENTER = '\n',
200  K_LEFT_ALT = 1000,
242  K_DOWN
243  };
244 
245  protected:
246  int mValue;
252  };
253 }
254 
255 #endif // end GCN_KEY_HPP
gcn::Key::K_PAUSE
@ K_PAUSE
Definition: key.h:236
gcn::Key::K_F9
@ K_F9
Definition: key.h:227
gcn::Key::K_F1
@ K_F1
Definition: key.h:219
gcn::Key::K_F10
@ K_F10
Definition: key.h:228
gcn::Key::K_F7
@ K_F7
Definition: key.h:225
GCN_CORE_DECLSPEC
#define GCN_CORE_DECLSPEC
Definition: platform.h:59
gcn::Key::mMetaPressed
bool mMetaPressed
Definition: key.h:250
gcn::Key::K_LEFT
@ K_LEFT
Definition: key.h:239
gcn::Key::K_PRINT_SCREEN
@ K_PRINT_SCREEN
Definition: key.h:234
gcn::Key::K_F13
@ K_F13
Definition: key.h:231
gcn::Key::K_F3
@ K_F3
Definition: key.h:221
gcn::Key::K_F4
@ K_F4
Definition: key.h:222
gcn::Key::K_LEFT_SUPER
@ K_LEFT_SUPER
Definition: key.h:208
gcn::Key::mAltPressed
bool mAltPressed
Definition: key.h:249
gcn::Key::mValue
int mValue
Definition: key.h:246
gcn::Key::K_F8
@ K_F8
Definition: key.h:226
gcn::Key::K_BACKSPACE
@ K_BACKSPACE
Definition: key.h:218
gcn::Key::K_RIGHT_SHIFT
@ K_RIGHT_SHIFT
Definition: key.h:203
gcn::Key::K_PAGE_UP
@ K_PAGE_UP
Definition: key.h:212
gcn::Key::K_INSERT
@ K_INSERT
Definition: key.h:210
gcn::Key::K_F11
@ K_F11
Definition: key.h:229
gcn::Key::K_HOME
@ K_HOME
Definition: key.h:211
gcn::Key::K_DELETE
@ K_DELETE
Definition: key.h:213
gcn::Key::K_RIGHT
@ K_RIGHT
Definition: key.h:240
gcn
Definition: cliprectangle.cpp:61
gcn::Key::mNumericPad
bool mNumericPad
Definition: key.h:251
gcn::Key::mControlPressed
bool mControlPressed
Definition: key.h:248
gcn::Key::K_ALT_GR
@ K_ALT_GR
Definition: key.h:238
gcn::Key::K_F12
@ K_F12
Definition: key.h:230
gcn::Key::K_NUM_LOCK
@ K_NUM_LOCK
Definition: key.h:237
gcn::Key::K_SCROLL_LOCK
@ K_SCROLL_LOCK
Definition: key.h:235
gcn::Key::K_F15
@ K_F15
Definition: key.h:233
gcn::Key::mShiftPressed
bool mShiftPressed
Definition: key.h:247
gcn::Key::K_ESCAPE
@ K_ESCAPE
Definition: key.h:216
platform.h
gcn::Key::K_RIGHT_META
@ K_RIGHT_META
Definition: key.h:207
gcn::Key::K_F5
@ K_F5
Definition: key.h:223
gcn::Key
Definition: key.h:67
gcn::Key::K_RIGHT_SUPER
@ K_RIGHT_SUPER
Definition: key.h:209
gcn::Key::K_END
@ K_END
Definition: key.h:214
gcn::Key::K_CAPS_LOCK
@ K_CAPS_LOCK
Definition: key.h:217
gcn::Key::K_PAGE_DOWN
@ K_PAGE_DOWN
Definition: key.h:215
gcn::Key::K_LEFT_META
@ K_LEFT_META
Definition: key.h:206
gcn::Key::K_LEFT_SHIFT
@ K_LEFT_SHIFT
Definition: key.h:202
gcn::Key::K_RIGHT_CONTROL
@ K_RIGHT_CONTROL
Definition: key.h:205
gcn::Key::K_F2
@ K_F2
Definition: key.h:220
gcn::Key::K_F6
@ K_F6
Definition: key.h:224
gcn::Key::K_RIGHT_ALT
@ K_RIGHT_ALT
Definition: key.h:201
gcn::Key::K_UP
@ K_UP
Definition: key.h:241
gcn::Key::K_F14
@ K_F14
Definition: key.h:232
gcn::Key::K_LEFT_CONTROL
@ K_LEFT_CONTROL
Definition: key.h:204
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.