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.7 6 // 7 // [original comment from Warwick] 8 // Unfortunately, this doesn't use Qt as well as I would like, 9 // primarily because NetHack is fundamentally a getkey-type 10 // program rather than being event driven (hence the ugly key 11 // and click buffer rather), but also because this is my first 12 // major application of Qt. 13 // 14 15 #ifndef qt_win_h 16 #define qt_win_h 17 18 namespace nethack_qt_ { 19 20 void centerOnMain(QWidget *); /* in the namespace but not in any class */ 21 22 class NetHackQtWindow { 23 public: 24 NetHackQtWindow(); 25 virtual ~NetHackQtWindow(); 26 27 virtual QWidget* Widget() = 0; 28 29 virtual void Clear(); 30 virtual void Display(bool block); 31 virtual bool Destroy(); 32 virtual void CursorTo(int x, int y); 33 virtual void PutStr(int attr, const QString& text); PutStr(int attr,const char * text)34 void PutStr(int attr, const char *text) 35 { 36 PutStr(attr, QString::fromUtf8(text).replace(QChar(0x200B), "")); 37 } 38 virtual void StartMenu(bool using_WIN_INVEN = false); 39 virtual void AddMenu(int glyph, const ANY_P* identifier, 40 char ch, char gch, int attr, 41 const QString& str, unsigned itemflags); 42 virtual void EndMenu(const QString& prompt); 43 virtual int SelectMenu(int how, MENU_ITEM_P **menu_list); 44 virtual void ClipAround(int x, int y); 45 virtual void PrintGlyph(int x, int y, const glyph_info *glyphinfo); 46 virtual void UseRIP(int how, time_t when); 47 48 int nhid; 49 }; 50 51 } // namespace nethack_qt_ 52 53 #endif 54