* Fixed some minor style issues. * fChars was allocated with new[] but deleted with free() in the Keymap destructor. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17686 a95241bf-73f2-0310-859d-f6bbb57e9c96
53 lines
1.3 KiB
C++
53 lines
1.3 KiB
C++
/*
|
|
* Copyright (c) 2004-2006, Haiku, Inc.
|
|
*
|
|
* This software is part of the Haiku distribution and is covered
|
|
* by the Haiku license.
|
|
*
|
|
* Author: Jérôme Duval
|
|
*/
|
|
#ifndef KEYMAP_H
|
|
#define KEYMAP_H
|
|
|
|
|
|
#include <InterfaceDefs.h>
|
|
#include <Entry.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
class Keymap {
|
|
public:
|
|
Keymap();
|
|
~Keymap();
|
|
|
|
status_t LoadCurrent();
|
|
status_t Load(entry_ref &ref);
|
|
status_t Save(entry_ref &ref);
|
|
status_t LoadSource(FILE *f);
|
|
status_t LoadSourceFromRef(entry_ref &ref);
|
|
void SaveAsCurrent();
|
|
void SaveAsHeader(entry_ref &ref);
|
|
status_t Use();
|
|
void Dump();
|
|
bool IsModifierKey(uint32 keyCode);
|
|
uint8 IsDeadKey(uint32 keyCode, uint32 modifiers);
|
|
bool IsDeadSecondKey(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey);
|
|
void GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey,
|
|
char** chars, int32* numBytes);
|
|
void RestoreSystemDefault();
|
|
static void GetKey(char *chars, int32 offset, char* string);
|
|
|
|
private:
|
|
void ComputeChars(const char *buffer, struct re_registers ®s, int i, int &offset);
|
|
void ComputeTables(const char *buffer, struct re_registers ®s, uint32 &table);
|
|
|
|
char *fChars;
|
|
key_map fKeys;
|
|
uint32 fCharsSize;
|
|
};
|
|
|
|
#define KEYMAP_ERROR_UNKNOWN_VERSION (B_ERRORS_END + 1)
|
|
|
|
#endif // KEYMAP_H
|