Cleaned up CrazyhouseMove.
[tagua/yd.git] / src / console.h
blob48b092000376b2f6eb4b18cd8877b30fae3582a0
1 /*
2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@sns.it>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 */
11 #ifndef CONSOLE_H
12 #define CONSOLE_H
14 #include <QWidget>
15 #include <QRegExp>
16 #include <boost/shared_ptr.hpp>
17 #include "histlineedit.h"
18 #include "console_p.h"
20 class QLabel;
21 class QTextEdit;
22 class TextNotifier;
24 class Console : public QWidget {
25 Q_OBJECT
26 HistLineEdit* edit;
27 QTextEdit* display;
28 QLabel* prompt;
29 static QRegExp promptRegexp;
30 boost::shared_ptr<TextNotifier> m_notifier;
31 LuaConsoleHighlighter m_highlighter;
32 public:
33 Console(QWidget* parent, const QString& caption);
34 inline QLineEdit* commandLine() const { return edit; }
35 void clear();
36 void setNotifier(const boost::shared_ptr<TextNotifier>& notifier) { m_notifier = notifier; }
37 public slots:
38 void displayText(QString, int offset);
39 void echo(const QString&);
40 protected slots:
41 void input(const QString&);
42 signals:
43 void receivedInput(const QString&);
44 void notify();
47 class TextNotifier {
48 public:
49 virtual ~TextNotifier() { }
50 virtual void textNotify(const QString& text) = 0;
53 #endif // CONSOLE_H