📄 keyev.hpp
字号:
head 2.2;access;symbols;locks; strict;comment @// @;2.2date 95.10.27.20.07.27; author tsurace; state Release;branches;next 2.1;2.1date 95.10.24.15.52.51; author tsurace; state Exp;branches;next 1.1;1.1date 95.10.02.00.53.43; author tsurace; state Beta;branches;next ;desc@KeyEvent class header.@2.2log@Largely redid the KeyEvent class to handle accleerators.@text@#ifndef KEYEV_HPP
#define KEYEV_HPP
// $Id: keyev.hpp 2.1 1995/10/24 15:52:51 tsurace Exp tsurace $
// $Log: keyev.hpp $
// Revision 2.1 1995/10/24 15:52:51 tsurace
// Roll.
//
// Revision 1.1 1995/10/02 00:53:43 tsurace
// Initial revision
//
#define KeyEventALTMASK (1L << 29)
#define KeyEventEXTMASK (1L << 24)
// ------------------------------------------------------------------------
// KeyEvent base class - code to handle windows keyboard events
class KeyEvent
{
public:
KeyEvent() {;};
virtual ~KeyEvent() {;};
virtual char * AsString() const = 0; // Keycode for VaporTalk
};
// ------------------------------------------------------------------------
class CharKeyEvent
: public KeyEvent
{
public:
CharKeyEvent(WPARAM wParam);
virtual char * AsString() const; // Keycode for VaporTalk
private:
char _buffer[2];
};
// ------------------------------------------------------------------------
class AcceleratorKeyEvent
: protected KeyEvent
{
public:
AcceleratorKeyEvent(WPARAM id);
virtual char * AsString() const;
protected:
char _buffer[11]; // The result!
class _KeyMapEntry
{
public:
WPARAM id;
char string[11];
};
static _KeyMapEntry _map[];
public:
static const size_t _mapSize; // Must be public for initializer
protected:
};
// >>>>> Inlines <<<<< //
// ------------------------------------------------------------------------
// AsString - returns this event as a null-terminated string
//
// Do not modify the returned string. (No, really don't.)
// The returned string will cease to exist as soon as the key event is
// deleted or goes out of scope.
//
inline char * CharKeyEvent::AsString() const
{
return (char *)_buffer;
}
inline char * AcceleratorKeyEvent::AsString() const
{
return (char *)_buffer;
}
#endif // KEYEV_HPP
@2.1log@Roll.@text@d4 4a7 4// $Id: keyev.hpp 1.1 1995/10/02 00:53:43 tsurace Beta tsurace $// $Log: keyev.hpp $// Revision 1.1 1995/10/02 00:53:43 tsurace// Initial revisiond9 3d17 1a17 1// KeyEvent class - code to handle windows keyboard eventsd21 5a25 12 KeyEvent(WPARAM wParam, LPARAM lParam); static void KeyUp(WPARAM wParam, LPARAM lparam); int Alt() const; int Control() const; int Extended() const; int Shift() const; WPARAM VKeyCode() const; int Ascii() const; // Keycode as a real keystroke // These two functions are used to track keyboard state internally static void KeyDownEvent(WPARAM wParam, LPARAM lParam); static void KeyUpEvent(WPARAM wParam, LPARAM lParam);d27 7a33 5 protected: WPARAM _virtualKeyCode; LPARAM _lParam; // Other info static int _shiftKeyDown; // 0 or 1 static int _controlKeyDown; //d35 2d39 7a45 1// >>>>> Inline functions <<<<< //d47 16a62 4inline int KeyEvent::Alt() const{ return _lParam & KeyEventALTMASK;}d64 1a64 4inline int KeyEvent::Extended() const{ return _lParam & KeyEventEXTMASK;}d66 7a72 4inline int KeyEvent::Shift() const{ return _shiftKeyDown;}d74 1a74 1inline int KeyEvent::Control() constd76 1a76 1 return _controlKeyDown;d79 1a79 1inline WPARAM KeyEvent::VKeyCode() constd81 1a81 1 return _virtualKeyCode;a82 1@1.1log@Initial revision@text@d4 5a8 2// $Id$// $Log$@
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -