1 // Copyright (c) Warwick Allison, 1999. 2 // Qt4 conversion copyright (c) Ray Chason, 2012-2014. 3 // NetHack may be freely redistributed. See license for details. 4 5 // Qt Binding for NetHack 3.4 6 // 7 // Unfortunately, this doesn't use Qt as well as I would like, 8 // primarily because NetHack is fundamentally a getkey-type 9 // program rather than being event driven (hence the ugly key 10 // and click buffer rather), but also because this is my first 11 // major application of Qt. 12 // 13 14 #ifndef qt4win_h 15 #define qt4win_h 16 17 namespace nethack_qt4 { 18 19 class NetHackQtWindow { 20 public: 21 NetHackQtWindow(); 22 virtual ~NetHackQtWindow(); 23 24 virtual QWidget* Widget() =0; 25 26 virtual void Clear(); 27 virtual void Display(bool block); 28 virtual bool Destroy(); 29 virtual void CursorTo(int x,int y); 30 virtual void PutStr(int attr, const QString& text); PutStr(int attr,const char * text)31 void PutStr(int attr, const char *text) 32 { 33 PutStr(attr, QString::fromUtf8(text).replace(QChar(0x200B), "")); 34 } 35 virtual void StartMenu(); 36 virtual void AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, 37 const QString& str, bool presel); 38 virtual void EndMenu(const QString& prompt); 39 virtual int SelectMenu(int how, MENU_ITEM_P **menu_list); 40 virtual void ClipAround(int x,int y); 41 virtual void PrintGlyph(int x,int y,int glyph); 42 virtual void UseRIP(int how, time_t when); 43 44 int nhid; 45 }; 46 47 } // namespace nethack_qt4 48 49 #endif 50