Files
nethack/win/Qt/qt_key.h
PatR 2c02d5daac Qt key handling
Fix the popup versions of qt_yn_function() to handle control
characters by using the same key press event decoding routine
and menus and extended commands.  Moves 'keyValue()' to
qt_key.cpp and its declaration to qt_key.h, requring several
files to start using #include "qt_key.h".

'make depend' update to follow.
2021-01-08 13:47:34 -08:00

46 lines
894 B
C++

// Copyright (c) Warwick Allison, 1999.
// Qt4 conversion copyright (c) Ray Chason, 2012-2014.
// NetHack may be freely redistributed. See license for details.
// qt_key.h -- a key buffer
#ifndef QT4KEY_H
#define QT4KEY_H
namespace nethack_qt_ {
// not part of any class; used in qt_menu.cpp, qt_xcmd.cpp, qt_yndlg.cpp
extern uchar keyValue(QKeyEvent *key_event);
class NetHackQtKeyBuffer {
public:
NetHackQtKeyBuffer();
bool Empty() const;
bool Full() const;
void Put(int k, int ascii, uint state);
void Put(char a);
void Put(const char* str);
int GetKey();
int GetAscii();
Qt::KeyboardModifiers GetState();
int TopKey() const;
int TopAscii() const;
Qt::KeyboardModifiers TopState() const;
void Drain();
private:
enum { maxkey=64 };
int key[maxkey];
int ascii[maxkey];
Qt::KeyboardModifiers state[maxkey];
int in,out;
};
} // namespace nethack_qt_
#endif