Added RFC 2190 H.263 code as created by Guilhem Tardy and AliceStreet
[pwlib.git] / include / pwlib / keycode.h
blob95b9d0d13d6149f95b6becca39745dfe9121fd87
1 /*
2 * keycode.h
4 * Windows keyboard input code.
6 * Portable Windows Library
8 * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
10 * The contents of this file are subject to the Mozilla Public License
11 * Version 1.0 (the "License"); you may not use this file except in
12 * compliance with the License. You may obtain a copy of the License at
13 * http://www.mozilla.org/MPL/
15 * Software distributed under the License is distributed on an "AS IS"
16 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 * the License for the specific language governing rights and limitations
18 * under the License.
20 * The Original Code is Portable Windows Library.
22 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24 * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25 * All Rights Reserved.
27 * Contributor(s): ______________________________________.
29 * $Log$
30 * Revision 1.16 2001/05/22 12:49:33 robertj
31 * Did some seriously wierd rewrite of platform headers to eliminate the
32 * stupid GNU compiler warning about braces not matching.
34 * Revision 1.15 1999/03/10 03:49:52 robertj
35 * More documentation adjustments.
37 * Revision 1.14 1999/03/09 08:01:48 robertj
38 * Changed comments for doc++ support (more to come).
40 * Revision 1.13 1999/02/16 08:08:45 robertj
41 * MSVC 6.0 compatibility changes.
43 * Revision 1.12 1998/09/23 06:24:03 robertj
44 * Added open source copyright license.
46 * Revision 1.11 1995/11/20 11:03:10 robertj
47 * Fixed compatibility the resource compiler and editor.
49 * Revision 1.10 1995/03/14 12:41:39 robertj
50 * Updated documentation to use HTML codes.
52 * Revision 1.9 1994/12/15 12:47:15 robertj
53 * Documentation.
55 * Revision 1.8 1994/08/23 11:32:52 robertj
56 * Oops
58 * Revision 1.7 1994/08/22 00:46:48 robertj
59 * Added pragma fro GNU C++ compiler.
61 * Revision 1.6 1994/06/25 11:55:15 robertj
62 * Unix version synchronisation.
64 * Revision 1.5 1994/03/07 07:38:19 robertj
65 * Major enhancementsacross the board.
67 * Revision 1.4 1994/01/03 04:42:23 robertj
68 * Mass changes to common container classes and interactors etc etc etc.
70 * Revision 1.3 1993/12/16 03:30:24 robertj
71 * Removed usage of enum as bitmask, GCC doesn't like it.
73 * Revision 1.2 1993/07/14 12:49:16 robertj
74 * Fixed RCS keywords.
79 #ifdef __GNUC__
80 #pragma interface
81 #endif
84 /**A class representing a key from the keyboard. This virtualises the key into
85 a platform independent form that removes as far as possible the variations
86 in keyboards and layouts.
88 Note that not all key values and modifiers may be generated by all target
89 platforms.
91 class PKeyCode : public PObject
93 PCLASSINFO(PKeyCode, PObject);
95 public:
96 /**All possible keyboard values (codes representing each key on a
97 "normalised" keyboard).
99 enum Value {
100 NullValue, // No value
101 LeftButton, // Left mouse button
102 RightButton, // Right mouse button
103 MiddleButton, // Middle mouse button
104 A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,
105 // Standard keyboard keys for alphabetic characters.
106 KB0, KB1, KB2, KB3, KB4, KB5, KB6, KB7, KB8, KB9,
107 // Standard number keys in main part of the keyboard.
108 KP0, KP1, KP2, KP3, KP4, KP5, KP6, KP7, KP8, KP9,
109 // Keypad number keys.
110 Add, // Add key on the keypad.
111 Subtract, // Subtract key on the keypad.
112 Multiply, // Multiply key on the keypad.
113 Divide, // Divide key on the keypad.
114 Separator, // Separator key on the keypad, typically a comma.
115 Decimal, // Decimal point key on the keypad, typically a dot.
116 F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,
117 F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24,
118 // Function keys.
119 Up, Down, Left, Right, // Arrow keys.
120 PageUp, PageDown, Home, End, // Standard movement keys.
121 Insert, Delete, Undo, Cut, Copy, Paste, Clear, Cancel, Help, Quit,
122 // Special function keys.
123 BackSpace, Tab, Return, Escape, Space,
124 // Miscellaneous keys.
125 CapsLockKey, ShiftKey, ControlKey, Altkey,
126 CommandKey, OptionKey, MetaKey,
127 // Modifier keys.
128 Oem1, Oem2, Oem3, Oem4, Oem5, Oem6, Oem7, Oem8, Oem9, Oem10,
129 Oem11, Oem12, Oem13, Oem14, Oem15, Oem16, Oem17, Oem18, Oem19, Oem20,
130 Oem21, Oem22, Oem23, Oem24, Oem25, Oem26, Oem27, Oem28, Oem29, Oem30,
131 Oem31, Oem32, Oem33, Oem34, Oem35, Oem36, Oem37, Oem38, Oem39,
132 // Arbitrary keys, not normalised.
133 LastCode
136 /**All the possible modifiers to the key values specified above. The
137 modifiers Accelerator1 and Accelerator2 are normalised menu bar
138 accelerators for the different platforms, e.g. for the Macintosh
139 Accelerator1 if the Command key, which does not exist on the IBM-PC so
140 it has Accelerator1 set to Control. An application can thus use
141 Accelerator1 for its menu accelerator code and get the "correct" code
142 for the platform used.
144 enum Modifiers {
145 /// No modifers present.
146 NoModifier = 0x0000,
147 /// Either shift key.
148 Shift = 0x0001,
149 /// The control key.
150 Control = 0x0002,
151 /// The Alt or Extend key.
152 Alt = 0x0004,
153 /// The quadraphogly key on the Macintosh.
154 Command = 0x0008,
155 /// The option key on the Macintosh.
156 Option = 0x0010,
157 /// The CAPS LOCK key.
158 CapsLock = 0x0020,
159 /// The primary accelerator key.
160 Accelerator1 = 0x0040,
161 /// The secondary accelerator key.
162 Accelerator2 = 0x0080,
164 /// The left mouse button.
165 LeftMouseButton = 0x1000,
166 /// The right mouse button.
167 RightMouseButton = 0x2000,
168 /// The middle mouse button.
169 MiddleMouseButton = 0x4000
172 /** Create a new key code representation. */
173 PKeyCode(
174 Value theValue = NullValue, /// Value of key code.
175 int theMods = NoModifier /// Modifiers present for key code.
179 /**@name Overrides from class PObject */
180 /** Create a copy of the key code. */
181 virtual PObject * Clone() const;
183 /**Determine the relative rank of the key codes.
185 @return
186 #EqualTo# if the key value and modifiers are the same,
187 #LessThan# if the key codes are the same but the modifier is
188 different and #GreaterThan# if they are both different.
190 virtual Comparison Compare(
191 const PObject & obj /// Other key code to compare against.
192 ) const;
194 /**Get the value part of the key code.
196 @return
197 value of key code.
199 Value GetValue() const;
201 /**Get the modifiers part of the key code.
203 @return
204 modifiers of key code.
206 int GetModifiers() const;
208 /**Determine if any of the the specified modifier(s) are set. This would
209 usually be used with a single modifier, but is not limited to it.
211 @return
212 TRUE if any of the modifiers in the #modmask# are set.
214 BOOL IsModifier(
215 int modmask /// Mask of modifiers to check for.
216 ) const;
219 protected:
220 Value value;
221 int modifiers;
224 // Include platform dependent part of class
225 #include <pwlib/keycode.h>
229 // End Of File ///////////////////////////////////////////////////////////////