usb_ecm: Use the current configuration instead of a fixed one.
[haiku.git] / src / preferences / shortcuts / MetaKeyStateMap.h
blob0e57488a672228fc333a9da8d338982e767c7fe9
1 /*
2 * Copyright 1999-2009 Jeremy Friesner
3 * Copyright 2009 Haiku, Inc. All rights reserved.
4 * Distributed under the terms of the MIT License.
6 * Authors:
7 * Jeremy Friesner
8 */
9 #ifndef META_KEY_STATE_MAP_H
10 #define META_KEY_STATE_MAP_H
13 #include <List.h>
14 #include <SupportDefs.h>
17 class BitFieldTester;
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 {
24 public:
25 // Note: You MUST call SetInfo() directly after using this ctor!
26 MetaKeyStateMap();
28 // Creates a MetaKeyStateMap with the give name
29 // (e.g. "Shift" or "Ctrl")
30 MetaKeyStateMap(const char* keyName);
33 ~MetaKeyStateMap();
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
46 // MetaKeyStateMap.
47 int GetNumStates() const;
49 // Returns a BitFieldTester that tests for the nth state's
50 // presence.
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;
56 private:
57 // e.g. "Alt" or "Ctrl"
58 char* fKeyName;
60 // list of strings e.g. "Left" or "Both"
61 BList fStateDescs;
63 // list of BitFieldTesters for testing bits of modifiers in state
64 BList fStateTesters;
68 #endif // META_KEY_STATE_MAP_H