Source:SLASH'EM 0.0.7E7F2/qt win.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to qt_win.h from the source code of SLASH'EM 0.0.7E7F2. To link to a particular line, write [[Source:SLASH'EM 0.0.7E7F2/qt_win.h#line123]], for example.

Source code for vanilla NetHack is at Source code.


The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

1.    //	SCCS Id: @(#)qt_win.h	3.4	1999/11/19
2.    // Copyright (c) Warwick Allison, 1999.
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 qt_win_h
15.   #define qt_win_h
16.   
17.   #define QT_CLEAN_NAMESPACE
18.   
19.   /* Qt never uses NetHack's yn() macro and it can conflict with the
20.    * XOpen bessel function of the same name.
21.    */
22.   #undef yn
23.   
24.   #include <qdialog.h>
25.   #include <qpushbutton.h>
26.   #include <qbuttongroup.h>
27.   #include <qlabel.h>
28.   #include <qlineedit.h> 
29.   #if defined(QWS)
30.   #include <qpe/qpeapplication.h> 
31.   #else
32.   #include <qapplication.h> 
33.   #endif
34.   #include <qspinbox.h>
35.   #include <qcheckbox.h>
36.   #include <qfile.h> 
37.   #include <qlistbox.h> 
38.   #include <qlistview.h> 
39.   #include <qmessagebox.h>
40.   #include <qpixmap.h>
41.   #include <qimage.h>
42.   #include <qarray.h>
43.   #include <qcombobox.h>
44.   #include <qscrollview.h>
45.   #if QT_VERSION >= 300
46.   #include <qttableview.h>
47.   // Should stop using QTableView
48.   #define QTableView QtTableView
49.   #else
50.   #include <qtableview.h>
51.   #endif
52.   #include <qmainwindow.h>
53.   #include <qwidgetstack.h>
54.   
55.   #ifdef KDE
56.   #include <kapp.h>
57.   #include <ktopwidget.h>
58.   #endif 
59.   
60.   #include "qt_clust.h"
61.   
62.   class QVBox;
63.   class QMenuBar;
64.   class QRadioButton;
65.   class NhPSListView;
66.   
67.   //////////////////////////////////////////////////////////////
68.   //
69.   //  The beautiful, abstracted and well-modelled classes...
70.   //
71.   //////////////////////////////////////////////////////////////
72.   
73.   class NetHackQtGlyphs;
74.   
75.   class NetHackQtLineEdit : public QLineEdit {
76.   public:
77.   	NetHackQtLineEdit();
78.   	NetHackQtLineEdit(QWidget* parent, const char* name);
79.   
80.   	void fakeEvent(int key, int ascii, int state);
81.   };
82.   
83.   class NetHackQtSettings : public QDialog {
84.   	Q_OBJECT
85.   public:
86.   	// Size of window - used to decide default sizes
87.   	NetHackQtSettings(int width, int height);
88.   
89.   	NetHackQtGlyphs& glyphs();
90.   	void updateTiles();
91.   	const QFont& normalFont();
92.   	const QFont& normalFixedFont();
93.   	const QFont& largeFont();
94.   
95.   	bool ynInMessages();
96.   
97.   signals:
98.   	void fontChanged();
99.   	void tilesChanged();
100.  
101.  public slots:
102.  	void toggleGlyphSize();
103.  	void setGlyphSize(bool);
104.  
105.  private:
106.  	QSpinBox tilewidth;
107.  	QSpinBox tileheight;
108.  	QLabel widthlbl;
109.  	QLabel heightlbl;
110.  	QCheckBox whichsize;
111.  	QSize othersize;
112.  
113.  	QComboBox fontsize;
114.  
115.  	QFont normal, normalfixed, large;
116.  
117.  	NetHackQtGlyphs* theglyphs;
118.  
119.  private slots:
120.  	void resizeTiles();
121.  };
122.  
123.  class NetHackQtKeyBuffer {
124.  public:
125.  	NetHackQtKeyBuffer();
126.  
127.  	bool Empty() const;
128.  	bool Full() const;
129.  
130.  	void Put(int k, int ascii, int state);
131.  	void Put(char a);
132.  	void Put(const char* str);
133.  	int GetKey();
134.  	int GetAscii();
135.  	int GetState();
136.  
137.  	int TopKey() const;
138.  	int TopAscii() const;
139.  	int TopState() const;
140.  
141.  private:
142.  	enum { maxkey=64 };
143.  	int key[maxkey];
144.  	int ascii[maxkey];
145.  	int state[maxkey];
146.  	int in,out;
147.  };
148.  
149.  class NetHackQtClickBuffer {
150.  public:
151.  	NetHackQtClickBuffer();
152.  
153.  	bool Empty() const;
154.  	bool Full() const;
155.  
156.  	void Put(int x, int y, int mod);
157.  
158.  	int NextX() const;
159.  	int NextY() const;
160.  	int NextMod() const;
161.  
162.  	void Get();
163.  
164.  private:
165.  	enum { maxclick=64 };
166.  	struct ClickRec {
167.  		int x,y,mod;
168.  	} click[maxclick];
169.  	int in,out;
170.  };
171.  
172.  
173.  class NetHackQtSavedGameSelector : public QDialog {
174.  public:
175.  	NetHackQtSavedGameSelector(const char** saved);
176.  
177.  	int choose();
178.  };
179.  
180.  class NetHackQtPlayerSelector : private QDialog {
181.  	Q_OBJECT
182.  public:
183.  	enum { R_None=-1, R_Quit=-2, R_Rand=-3 };
184.  
185.  	NetHackQtPlayerSelector(NetHackQtKeyBuffer&);
186.  
187.  protected:
188.  	virtual void done(int);
189.  
190.  public slots:
191.  	void Quit();
192.  	void Random();
193.  
194.  	void selectName(const QString& n);
195.  	void selectRole();
196.  	void selectRace();
197.  	void setupOthers();
198.  	void selectGender(int);
199.  	void selectAlignment(int);
200.  
201.  public:
202.  	bool Choose();
203.  
204.  private:
205.  	NetHackQtKeyBuffer& keysource;
206.  	NhPSListView* role;
207.  	NhPSListView* race;
208.  	QRadioButton **gender;
209.  	QRadioButton **alignment;
210.  	bool fully_specified_role;
211.  };
212.  
213.  class NetHackQtStringRequestor : QDialog {
214.  private:
215.  	QLabel prompt;
216.  	NetHackQtLineEdit input;
217.  	QPushButton* okay;
218.  	QPushButton* cancel;
219.  	NetHackQtKeyBuffer& keysource;
220.  
221.  	virtual void done(int);
222.  
223.  public:
224.  	NetHackQtStringRequestor(NetHackQtKeyBuffer&, const char* p,const char* cancelstr="Cancel");
225.  	void SetDefault(const char*);
226.  	bool Get(char* buffer, int maxchar=80);
227.  	virtual void resizeEvent(QResizeEvent*);
228.  };
229.  
230.  class NetHackQtExtCmdRequestor : public QDialog {
231.      Q_OBJECT
232.  
233.      NetHackQtKeyBuffer& keysource;
234.  
235.  public:
236.      NetHackQtExtCmdRequestor(NetHackQtKeyBuffer& ks);
237.      int get();
238.  
239.  private slots:
240.      void cancel();
241.      void done(int i);
242.  };
243.  
244.  
245.  class NetHackQtWindow {
246.  public:
247.  	NetHackQtWindow();
248.  	virtual ~NetHackQtWindow();
249.  
250.  	virtual QWidget* Widget() =0;
251.  
252.  	virtual void Clear();
253.  	virtual void Display(bool block);
254.  	virtual bool Destroy();
255.  	virtual void CursorTo(int x,int y);
256.  	virtual void PutStr(int attr, const char* text);
257.  	virtual void StartMenu();
258.  	virtual void AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr,
259.  			const char* str, bool presel);
260.  	virtual void EndMenu(const char* prompt);
261.  	virtual int SelectMenu(int how, MENU_ITEM_P **menu_list);
262.  	virtual void ClipAround(int x,int y);
263.  	virtual void PrintGlyph(int x,int y,int glyph);
264.  	virtual void UseRIP(int how);
265.  
266.  	int nhid;
267.  };
268.  
269.  class NetHackQtGlyphs {
270.  public:
271.  	NetHackQtGlyphs();
272.  
273.  	int width() const { return size.width(); }
274.  	int height() const { return size.height(); }
275.  	char *tileSet() const { return tilesets[tileset_index].name; }
276.  	void toggleSize();
277.  	void setSize(int w, int h);
278.  
279.  	void drawGlyph(QPainter&, int glyph, int pixelx, int pixely);
280.  	void drawCell(QPainter&, int glyph, int cellx, int celly);
281.  
282.  private:
283.  	QImage img;
284.  	QPixmap pm,pm1, pm2;
285.  	QSize size;
286.  	int tileset_index;
287.  
288.  	int loadTiles(const char *file);
289.  };
290.  
291.  class BlackScrollView : public QScrollView {
292.  public:
293.      BlackScrollView()
294.      {
295.  	viewport()->setBackgroundColor(black);
296.      }
297.  };
298.  
299.  class NetHackQtMapWindow : public QWidget, public NetHackQtWindow {
300.  	Q_OBJECT
301.  private:
302.  	NetHackQtClickBuffer& clicksink;
303.  	unsigned short glyph[ROWNO][COLNO];
304.  	unsigned short& Glyph(int x, int y) { return glyph[y][x]; }
305.  	QPoint cursor;
306.  	BlackScrollView viewport;
307.  	QPixmap pet_annotation;
308.  	Clusterizer change;
309.  	QFont *rogue_font;
310.  	QString messages;
311.  	QRect messages_rect;
312.  
313.  	void Changed(int x,int y);
314.  
315.  signals:
316.  	void resized();
317.  
318.  private slots:
319.  	void updateTiles();
320.  	void moveMessages(int x, int y);
321.  
322.  protected:
323.  	virtual void paintEvent(QPaintEvent*);
324.  	virtual void mousePressEvent(QMouseEvent*);
325.  
326.  public:
327.  	NetHackQtMapWindow(NetHackQtClickBuffer& click_sink);
328.  	~NetHackQtMapWindow();
329.  
330.  	virtual QWidget* Widget();
331.  	virtual bool Destroy();
332.  
333.  	virtual void Clear();
334.  	virtual void Display(bool block);
335.  	virtual void CursorTo(int x,int y);
336.  	virtual void PutStr(int attr, const char* text);
337.  	virtual void ClipAround(int x,int y);
338.  	virtual void PrintGlyph(int x,int y,int glyph);
339.  
340.  	void Scroll(int dx, int dy);
341.  
342.  	// For messages
343.  	void displayMessages(bool block);
344.  	void putMessage(int attr, const char* text);
345.  	void clearMessages();
346.  
347.  	void clickCursor();
348.  };
349.  
350.  class NetHackQtScrollText;
351.  class NetHackQtMessageWindow : QObject, public NetHackQtWindow {
352.  	Q_OBJECT
353.  public:
354.  	NetHackQtMessageWindow();
355.  	~NetHackQtMessageWindow();
356.  
357.  	virtual QWidget* Widget();
358.  	virtual void Clear();
359.  	virtual void Display(bool block);
360.  	virtual void PutStr(int attr, const char* text);
361.  
362.  	void Scroll(int dx, int dy);
363.  
364.  	void setMap(NetHackQtMapWindow*);
365.  
366.  private:
367.  	NetHackQtScrollText* list;
368.  	bool changed;
369.  	NetHackQtMapWindow* map;
370.  
371.  private slots:
372.  	void updateFont();
373.  };
374.  
375.  class NetHackQtLabelledIcon : public QWidget {
376.  public:
377.  	NetHackQtLabelledIcon(QWidget* parent, const char* label);
378.  	NetHackQtLabelledIcon(QWidget* parent, const char* label, const QPixmap& icon);
379.  
380.  	enum { NoNum=-99999 };
381.  	void setLabel(const char*, bool lower=TRUE); // a string
382.  	void setLabel(const char*, long, const char* tail=""); // a number
383.  	void setLabel(const char*, long show_value, long comparative_value, const char* tail="");
384.  	void setIcon(const QPixmap&);
385.  	virtual void setFont(const QFont&);
386.  
387.  	void highlightWhenChanging();
388.  	void lowIsGood();
389.  	void dissipateHighlight();
390.  
391.  	virtual void show();
392.  
393.  protected:
394.  	void resizeEvent(QResizeEvent*);
395.  
396.  private:
397.  	void initHighlight();
398.  	void setAlignments();
399.  	void highlight(const QPalette& highlight);
400.  	void unhighlight();
401.  
402.  	bool low_is_good;
403.  	int prev_value;
404.  	int turn_count;		/* last time the value changed */
405.  	QPalette hl_good;
406.  	QPalette hl_bad;
407.  
408.  	QLabel* label;
409.  	QLabel* icon;
410.  };
411.  
412.  class NetHackQtStatusWindow : QWidget, public NetHackQtWindow {
413.  	Q_OBJECT
414.  public:
415.  	NetHackQtStatusWindow();
416.  
417.  	virtual QWidget* Widget();
418.  
419.  	virtual void Clear();
420.  	virtual void Display(bool block);
421.  	virtual void CursorTo(int x,int y);
422.  	virtual void PutStr(int attr, const char* text);
423.  
424.  	void fadeHighlighting();
425.  
426.  protected:
427.  	void resizeEvent(QResizeEvent*);
428.  
429.  private slots:
430.  	void doUpdate();
431.  
432.  private:
433.  	enum { hilight_time=1 };
434.  
435.  	QPixmap p_str;
436.  	QPixmap p_dex;
437.  	QPixmap p_con;
438.  	QPixmap p_int;
439.  	QPixmap p_wis;
440.  	QPixmap p_cha;
441.  
442.  	QPixmap p_chaotic;
443.  	QPixmap p_neutral;
444.  	QPixmap p_lawful;
445.  
446.  	QPixmap p_satiated;
447.  	QPixmap p_hungry;
448.  
449.  	QPixmap p_confused;
450.  	QPixmap p_sick_fp;
451.  	QPixmap p_sick_il;
452.  	QPixmap p_blind;
453.  	QPixmap p_stunned;
454.  	QPixmap p_hallu;
455.  
456.  	QPixmap p_encumber[5];
457.  
458.  	NetHackQtLabelledIcon name;
459.  	NetHackQtLabelledIcon dlevel;
460.  
461.  	NetHackQtLabelledIcon str;
462.  	NetHackQtLabelledIcon dex;
463.  	NetHackQtLabelledIcon con;
464.  	NetHackQtLabelledIcon intel;
465.  	NetHackQtLabelledIcon wis;
466.  	NetHackQtLabelledIcon cha;
467.  
468.  	NetHackQtLabelledIcon gold;
469.  	NetHackQtLabelledIcon hp;
470.  	NetHackQtLabelledIcon power;
471.  	NetHackQtLabelledIcon ac;
472.  	NetHackQtLabelledIcon level;
473.  	NetHackQtLabelledIcon exp;
474.  	NetHackQtLabelledIcon align;
475.  
476.  	NetHackQtLabelledIcon time;
477.  	NetHackQtLabelledIcon score;
478.  	NetHackQtLabelledIcon weight;
479.  
480.  	NetHackQtLabelledIcon hunger;
481.  	NetHackQtLabelledIcon confused;
482.  	NetHackQtLabelledIcon sick_fp;
483.  	NetHackQtLabelledIcon sick_il;
484.  	NetHackQtLabelledIcon blind;
485.  	NetHackQtLabelledIcon stunned;
486.  	NetHackQtLabelledIcon hallu;
487.  	NetHackQtLabelledIcon encumber;
488.  
489.  	QFrame hline1;
490.  	QFrame hline2;
491.  	QFrame hline3;
492.  
493.  	int cursy;
494.  
495.  	bool first_set;
496.  
497.  	void nullOut();
498.  	void updateStats();
499.  	void checkTurnEvents();
500.  };
501.  
502.  class NetHackQtMenuDialog : public QDialog {
503.  	Q_OBJECT
504.  public:
505.  	NetHackQtMenuDialog();
506.  
507.  	void Accept();
508.  	void Reject();
509.  	void SetResult(int);
510.  
511.  	virtual void done(int);
512.  
513.  protected:
514.  	void resizeEvent(QResizeEvent*);
515.  
516.  signals:
517.  	void Resized();
518.  };
519.  
520.  
521.  class NetHackQtMenuWindow : public QTableView, public NetHackQtWindow {
522.  	Q_OBJECT
523.  public:
524.  	NetHackQtMenuWindow(NetHackQtKeyBuffer&);
525.  	~NetHackQtMenuWindow();
526.  
527.  	virtual QWidget* Widget();
528.  
529.  	virtual void StartMenu();
530.  	virtual void AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr,
531.  			const char* str, bool presel);
532.  	virtual void EndMenu(const char* prompt);
533.  	virtual int SelectMenu(int how, MENU_ITEM_P **menu_list);
534.  
535.  public slots:
536.  	void All();
537.  	void ChooseNone();
538.  	void Invert();
539.  	void Search();
540.  
541.  	void Layout();
542.  	void ToggleSelect(int);
543.  
544.  protected:
545.  	virtual void keyPressEvent(QKeyEvent*);
546.  	//virtual void mouseDoubleClickEvent(QMouseEvent*);
547.  	virtual void mousePressEvent(QMouseEvent*);
548.  	virtual void mouseReleaseEvent(QMouseEvent*);
549.  	virtual void mouseMoveEvent(QMouseEvent*);
550.  	virtual void focusOutEvent(QFocusEvent*);
551.  	virtual void focusInEvent(QFocusEvent*);
552.  
553.  	virtual void paintCell(QPainter*, int, int);
554.  	virtual int cellWidth(int col);
555.  
556.  private:
557.  	struct MenuItem {
558.  		MenuItem();
559.  		~MenuItem();
560.  
561.  		int glyph;
562.  		ANY_P identifier;
563.  		int attr;
564.  		const char* str;
565.  		int count;
566.  		char ch;
567.  		bool selected;
568.  
569.  		bool Selectable() const { return identifier.a_void!=0; }
570.  	};
571.  
572.  	QArray<MenuItem> item;
573.  
574.  	int itemcount;
575.  	int str_width;
576.  	bool str_fixed;
577.  	int next_accel;
578.  
579.  	NetHackQtKeyBuffer& keysource;
580.  
581.  	NetHackQtMenuDialog* dialog;
582.  
583.  	QPushButton* ok;
584.  	QPushButton* cancel;
585.  	QPushButton* all;
586.  	QPushButton* none;
587.  	QPushButton* invert;
588.  	QPushButton* search;
589.  	QLabel prompt;
590.  
591.  	int how;
592.  
593.  	bool has_glyphs;
594.  
595.  	int pressed;
596.  	bool was_sel;
597.  };
598.  
599.  class NetHackQtTextListBox;
600.  
601.  class NetHackQtRIP : public QWidget {
602.  private:
603.  	static QPixmap* pixmap;
604.  	char** line;
605.  	int riplines;
606.  
607.  public:
608.  	NetHackQtRIP(QWidget* parent);
609.  
610.  	void setLines(char** l, int n);
611.  
612.  protected:
613.  	virtual void paintEvent(QPaintEvent* event);
614.  	QSize sizeHint() const;
615.  };
616.  
617.  
618.  class NetHackQtTextWindow : public QDialog, public NetHackQtWindow {
619.  	Q_OBJECT
620.  public:
621.  	NetHackQtTextWindow(NetHackQtKeyBuffer&);
622.  	~NetHackQtTextWindow();
623.  
624.  	virtual QWidget* Widget();
625.  
626.  	virtual void Clear();
627.  	virtual bool Destroy();
628.  	virtual void Display(bool block);
629.  	virtual void PutStr(int attr, const char* text);
630.  	virtual void UseRIP(int how);
631.  
632.  public slots:
633.  	void Search();
634.  
635.  protected:
636.  	virtual void done(int);
637.  	virtual void keyPressEvent(QKeyEvent*);
638.  
639.  private slots:
640.  	void doUpdate();
641.  
642.  private:
643.  	NetHackQtKeyBuffer& keysource;
644.  
645.  	bool use_rip;
646.  	bool str_fixed;
647.  
648.  	QPushButton ok;
649.  	QPushButton search;
650.  	NetHackQtTextListBox* lines;
651.  
652.  	NetHackQtRIP rip;
653.  };
654.  
655.  class NetHackQtMenuOrTextWindow : public NetHackQtWindow {
656.  private:
657.  	NetHackQtWindow* actual;
658.  	NetHackQtKeyBuffer& keysource;
659.  
660.  public:
661.  	NetHackQtMenuOrTextWindow(NetHackQtKeyBuffer&);
662.  
663.  	virtual QWidget* Widget();
664.  
665.  	// Text
666.  	virtual void Clear();
667.  	virtual bool Destroy();
668.  	virtual void Display(bool block);
669.  	virtual void PutStr(int attr, const char* text);
670.  
671.  	// Menu
672.  	virtual void StartMenu();
673.  	virtual void AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr,
674.  			const char* str, bool presel);
675.  	virtual void EndMenu(const char* prompt);
676.  	virtual int SelectMenu(int how, MENU_ITEM_P **menu_list);
677.  
678.  };
679.  
680.  class NetHackQtDelay : QObject {
681.  private:
682.  	int msec;
683.  
684.  public:
685.  	NetHackQtDelay(int ms);
686.  	void wait();
687.  	virtual void timerEvent(QTimerEvent* timer);
688.  };
689.  
690.  
691.  class NetHackQtInvUsageWindow : public QWidget {
692.  public:
693.  	NetHackQtInvUsageWindow(QWidget* parent);
694.  	virtual void paintEvent(QPaintEvent*);
695.  private:
696.  	void drawWorn(QPainter& painter, obj*, int x, int y, bool canbe=TRUE);
697.  };
698.  
699.  // This class is the main widget for NetHack
700.  //
701.  // It is a collection of Message, Map, and Status windows.  In the current
702.  // version of nethack there is only one of each, and this class makes this
703.  // assumption, not showing itself until all are inserted.
704.  //
705.  // This class simply knows how to layout such children sensibly.
706.  //
707.  // Since it is only responsible for layout, the class does not
708.  // note the actual class of the windows.
709.  //
710.  #ifndef KDE
711.  #include "qt_kde0.h"
712.  #endif
713.  
714.  class NetHackQtMainWindow : public KTopLevelWidget {
715.  	Q_OBJECT
716.  public:
717.  	NetHackQtMainWindow(NetHackQtKeyBuffer&);
718.  
719.  	void AddMessageWindow(NetHackQtMessageWindow* window);
720.  	void AddMapWindow(NetHackQtMapWindow* window);
721.  	void AddStatusWindow(NetHackQtStatusWindow* window);
722.  	void RemoveWindow(NetHackQtWindow* window);
723.  	void updateInventory();
724.  
725.  	void fadeHighlighting();
726.  
727.  public slots:
728.  	void doMenuItem(int);
729.  	void doKeys(const QString&);
730.  
731.  protected:
732.  	virtual void resizeEvent(QResizeEvent*);
733.  	virtual void keyPressEvent(QKeyEvent*);
734.  	virtual void keyReleaseEvent(QKeyEvent* event);
735.  	virtual void closeEvent(QCloseEvent*);
736.  
737.  private slots:
738.  	void layout();
739.  	void raiseMap();
740.  	void zoomMap();
741.  	void raiseMessages();
742.  	void raiseStatus();
743.  
744.  private:
745.  	void ShowIfReady();
746.  
747.  #ifdef KDE
748.  	KMenuBar* menubar;
749.  #else
750.  	QMenuBar* menubar;
751.  #endif
752.  	NetHackQtMessageWindow* message;
753.  	NetHackQtMapWindow* map;
754.  	NetHackQtStatusWindow* status;
755.  	NetHackQtInvUsageWindow* invusage;
756.  
757.  	NetHackQtKeyBuffer& keysink;
758.  	QWidgetStack* stack;
759.  	int dirkey;
760.  
761.  	const char* *macro;
762.  };
763.  
764.  class NetHackQtYnDialog : QDialog {
765.  	Q_OBJECT
766.  private:
767.  	const char* question;
768.  	const char* choices;
769.  	char def;
770.  	NetHackQtKeyBuffer& keysource;
771.  
772.  protected:
773.  	virtual void keyPressEvent(QKeyEvent*);
774.  	virtual void done(int);
775.  
776.  private slots:
777.  	void doneItem(int);
778.  
779.  public:
780.  	NetHackQtYnDialog(NetHackQtKeyBuffer& keysource,const char*,const char*,char);
781.  
782.  	char Exec();
783.  };
784.  
785.  #ifdef KDE
786.  #define NetHackQtBindBase KApplication
787.  #elif defined(QWS)
788.  #define NetHackQtBindBase QPEApplication
789.  #else
790.  #define NetHackQtBindBase QApplication
791.  #endif
792.  
793.  class NetHackQtBind : NetHackQtBindBase {
794.  private:
795.  	// Single-instance preservation...
796.  	NetHackQtBind(int& argc, char** argv);
797.  
798.  	static NetHackQtBind* instance;
799.  
800.  	static NetHackQtKeyBuffer keybuffer;
801.  	static NetHackQtClickBuffer clickbuffer;
802.  
803.  	static QWidget* splash;
804.  	static NetHackQtMainWindow* main;
805.  
806.  public:
807.  	static void qt_init_nhwindows(int* argc, char** argv);
808.  	static void qt_player_selection();
809.  	static void qt_askname();
810.  	static void qt_get_nh_event();
811.  	static void qt_exit_nhwindows(const char *);
812.  	static void qt_suspend_nhwindows(const char *);
813.  	static void qt_resume_nhwindows();
814.  	static winid qt_create_nhwindow(int type);
815.  	static void qt_clear_nhwindow(winid wid);
816.  	static void qt_display_nhwindow(winid wid, BOOLEAN_P block);
817.  	static void qt_destroy_nhwindow(winid wid);
818.  	static void qt_curs(winid wid, int x, int y);
819.  	static void qt_putstr(winid wid, int attr, const char *text);
820.  #ifdef FILE_AREAS
821.  	static void qt_display_file(const char *filearea, const char *filename, BOOLEAN_P must_exist);
822.  #else
823.  	static void qt_display_file(const char *filename, BOOLEAN_P must_exist);
824.  #endif
825.  	static void qt_start_menu(winid wid);
826.  	static void qt_add_menu(winid wid, int glyph,
827.  		const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr,
828.  		const char *str, BOOLEAN_P presel);
829.  	static void qt_end_menu(winid wid, const char *prompt);
830.  	static int qt_select_menu(winid wid, int how, MENU_ITEM_P **menu_list);
831.  	static void qt_update_inventory();
832.  	static void qt_mark_synch();
833.  	static void qt_wait_synch();
834.  
835.  	static void qt_cliparound(int x, int y);
836.  	static void qt_cliparound_window(winid wid, int x, int y);
837.  	static void qt_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph);
838.  	static void qt_raw_print(const char *str);
839.  	static void qt_raw_print_bold(const char *str);
840.  	static int qt_nhgetch();
841.  	static int qt_nh_poskey(int *x, int *y, int *mod);
842.  	static void qt_nhbell();
843.  	static int qt_doprev_message();
844.  	static char qt_yn_function(const char *question, const char *choices, CHAR_P def);
845.  	static void qt_getlin(const char *prompt, char *line);
846.  	static int qt_get_ext_cmd();
847.  	static void qt_number_pad(int);
848.  	static void qt_delay_output();
849.  	static void qt_start_screen();
850.  	static void qt_end_screen();
851.  
852.  	static void qt_outrip(winid wid, int how);
853.  	static int qt_kbhit();
854.  
855.  private:
856.  	virtual bool notify(QObject *receiver, QEvent *event);
857.  };
858.  
859.  #endif