2 * Copyright 1999-2009 Jeremy Friesner
3 * Copyright 2009 Haiku, Inc. All rights reserved.
4 * Distributed under the terms of the MIT License.
9 #ifndef META_KEY_STATE_MAP_H
10 #define META_KEY_STATE_MAP_H
14 #include <SupportDefs.h>
20 // This class defines a set of possible chording states (e.g. "Left only",
21 // "Right only", "Both", "Either") for a meta-key (e.g. Shift), and the
22 // description strings and qualifier bit-chords that go with them.
23 class MetaKeyStateMap
{
25 // Note: You MUST call SetInfo() directly after using this ctor!
28 // Creates a MetaKeyStateMap with the give name
29 // (e.g. "Shift" or "Ctrl")
30 MetaKeyStateMap(const char* keyName
);
35 // For when you have to use the default ctor
36 void SetInfo(const char* keyName
);
38 // (tester) becomes property of this map!
39 void AddState(const char* desc
,
40 const BitFieldTester
* tester
);
42 // Returns the name of the meta-key (e.g. "Ctrl")
43 const char* GetName() const;
45 // Returns the number of possible states contained in this
47 int GetNumStates() const;
49 // Returns a BitFieldTester that tests for the nth state's
51 const BitFieldTester
* GetNthStateTester(int stateNum
) const;
53 // Returns a textual description of the nth state (e.g. "Left")
54 const char* GetNthStateDesc(int stateNum
) const;
57 // e.g. "Alt" or "Ctrl"
60 // list of strings e.g. "Left" or "Both"
63 // list of BitFieldTesters for testing bits of modifiers in state
68 #endif // META_KEY_STATE_MAP_H