00001
00032 #ifndef LL_LLVIEWERKEYBOARD_H
00033 #define LL_LLVIEWERKEYBOARD_H
00034
00035 #include "llkeyboard.h"
00036
00037 const S32 MAX_NAMED_FUNCTIONS = 100;
00038 const S32 MAX_KEY_BINDINGS = 128;
00039
00040 class LLNamedFunction
00041 {
00042 public:
00043 const char *mName;
00044 LLKeyFunc mFunction;
00045 };
00046
00047 typedef enum e_keyboard_mode
00048 {
00049 MODE_FIRST_PERSON,
00050 MODE_THIRD_PERSON,
00051 MODE_EDIT,
00052 MODE_EDIT_AVATAR,
00053 MODE_SITTING,
00054 MODE_COUNT
00055 } EKeyboardMode;
00056
00057
00058 void bind_keyboard_functions();
00059
00060
00061 class LLViewerKeyboard
00062 {
00063 public:
00064 LLViewerKeyboard();
00065
00066 BOOL handleKey(KEY key, MASK mask, BOOL repeated);
00067
00068 void bindNamedFunction(const char *name, LLKeyFunc func);
00069
00070 S32 loadBindings(const char *filename);
00071 EKeyboardMode getMode();
00072
00073 BOOL modeFromString(const char *string, S32 *mode);
00074
00075 void scanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level);
00076 protected:
00077 BOOL bindKey(const S32 mode, const KEY key, const MASK mask, const char *function_name);
00078 S32 mNamedFunctionCount;
00079 LLNamedFunction mNamedFunctions[MAX_NAMED_FUNCTIONS];
00080
00081
00082 S32 mBindingCount[MODE_COUNT];
00083 LLKeyBinding mBindings[MODE_COUNT][MAX_KEY_BINDINGS];
00084
00085 typedef std::map<U32, U32> key_remap_t;
00086 key_remap_t mRemapKeys[MODE_COUNT];
00087 std::set<KEY> mKeysSkippedByUI;
00088 BOOL mKeyHandledByUI[KEY_COUNT];
00089 };
00090
00091 extern LLViewerKeyboard gViewerKeyboard;
00092
00093 #endif // LL_LLVIEWERKEYBOARD_H