⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 keyev.hpp

📁 使用BorlandC++4.5编译的一个MUD客户端程序
💻 HPP
字号:
#ifndef KEYEV_HPP
#define KEYEV_HPP

// $Id: keyev.hpp 2.2 1995/10/27 20:07:27 tsurace Beta $
// $Log: keyev.hpp $// Revision 2.2  1995/10/27  20:07:27  tsurace// Largely redid the KeyEvent class to handle accleerators.//
// 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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -