Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef SCRIPTCONSOLE_H
Toshihiro Shimizu 890ddd
#define SCRIPTCONSOLE_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tcommon.h"
Toshihiro Shimizu 890ddd
#include <qtextedit></qtextedit>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class ScriptEngine;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TOONZQT_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI ScriptConsole : public QTextEdit
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	Q_OBJECT
Toshihiro Shimizu 890ddd
	ScriptEngine *m_engine;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	QList<qstring> m_commands;</qstring>
Toshihiro Shimizu 890ddd
	int m_commandIndex;
Toshihiro Shimizu 890ddd
	QString m_currentCommand;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	QString m_prompt;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	ScriptConsole(QWidget *parent = 0);
Toshihiro Shimizu 890ddd
	~ScriptConsole();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void executeCommand(const QString &cmd);
Toshihiro Shimizu 890ddd
	ScriptEngine *getEngine() const { return m_engine; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	void keyPressEvent(QKeyEvent *e);
Toshihiro Shimizu 890ddd
	void onReturnKeyPress();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool canInsertFromMimeData(const QMimeData *source) const;
Toshihiro Shimizu 890ddd
	void insertFromMimeData(const QMimeData *source);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public slots:
Toshihiro Shimizu 890ddd
	void onEvaluationDone();
Toshihiro Shimizu 890ddd
	void output(int, const QString &msg);
Toshihiro Shimizu 890ddd
	void onCursorPositionChanged();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif // SCRIPTCONSOLE_H