Files
nethack/win/Qt/qt_yndlg.h
PatR 9bad6840f4 Qt ynaq/yn#aq dialogs
When 'popup_dialog' is set, the Qt interface uses a popup window
for yn_function() calls and the dialog has a list of buttons, one
per potential choice.  It has been handling "yn?" and "ynq?"
questions differently from general request-one-char prompts, using
buttons "Yes", "No, and "Cancel" instead of showing individual
letters.  This extends that to "ynaq" and "yn#aq" questions and
labels 'q' reply as "Stop" instead of "Cancel" for those.  Also,
when player uses keyboard instead of mouse to answer, allow 'c'
as well as 'q' for cancel ones, 's' as well as 'q' for stop ones.

Prompt  Buttons
yn      [Yes ][ No ]
ynq     [ Yes  ][  No  ][Cancel]
ynaq    [Yes ][ No ][All ][Stop]
yn#aq   [Yes ]Count:______[ No ][All ][Stop]
rl      [ Left ][Right ]    //unchanged; included for completeness

(For contrast, when something specifies "ny" as the acceptable
choices, the buttons will just be [n][y].  Prompts for choosing
from a list of inventory letters can't accidentally match these
special cases as long as they're specified in alphabetical order.)
2020-10-04 07:36:12 -07:00

41 lines
820 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_yndlg.h -- yes/no dialog
#ifndef QT4YNDLG_H
#define QT4YNDLG_H
namespace nethack_qt_ {
class NetHackQtYnDialog : QDialog {
Q_OBJECT
private:
QString question;
const char* choices;
char def;
char keypress;
bool allow_count;
QLineEdit *le;
// abritrary size; might need to be more sophisicated someday
char alt_answer[26 + 1], alt_result[26 + 1];
protected:
virtual void keyPressEvent(QKeyEvent*);
void AltChoice(char answer, char result);
private slots:
void doneItem(int);
public:
NetHackQtYnDialog(QWidget *,const QString&,const char*,char);
char Exec();
};
} // namespace nethack_qt_
#endif