1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00
OpenMW/apps/opencs/view/world/scriptedit.hpp

78 lines
1.7 KiB
C++
Raw Normal View History

2014-02-15 17:55:18 +01:00
#ifndef SCRIPTEDIT_H
#define SCRIPTEDIT_H
#include <QTextEdit>
#include <QVector>
#include <QTimer>
#include "../../model/world/universalid.hpp"
class QWidget;
2014-02-17 08:58:55 +01:00
class QRegExp;
2014-02-15 17:55:18 +01:00
namespace CSMDoc
{
class Document;
}
2014-02-15 17:55:18 +01:00
namespace CSVWorld
{
class ScriptHighlighter;
2014-02-15 17:55:18 +01:00
class ScriptEdit : public QTextEdit
{
Q_OBJECT
public:
class ChangeLock
{
ScriptEdit& mEdit;
ChangeLock (const ChangeLock&);
ChangeLock& operator= (const ChangeLock&);
public:
ChangeLock (ScriptEdit& edit);
~ChangeLock();
};
friend class ChangeLock;
private:
int mChangeLocked;
ScriptHighlighter *mHighlighter;
QTimer mUpdateTimer;
public:
2014-08-22 13:18:47 +02:00
ScriptEdit (const CSMDoc::Document& document, QWidget* parent);
/// Should changes to the data be ignored (i.e. not cause updated)?
///
/// \note This mechanism is used to avoid infinite update recursions
bool isChangeLocked() const;
private:
QVector<CSMWorld::UniversalId::Type> mAllowedTypes;
const CSMDoc::Document& mDocument;
2014-02-17 08:58:55 +01:00
const QRegExp mWhiteListQoutes;
2014-02-15 17:55:18 +01:00
void dragEnterEvent (QDragEnterEvent* event);
void dropEvent (QDropEvent* event);
void dragMoveEvent (QDragMoveEvent* event);
2014-02-16 18:41:42 +01:00
2014-02-17 08:58:55 +01:00
bool stringNeedsQuote(const std::string& id) const;
private slots:
void idListChanged();
void updateHighlighting();
2014-02-15 17:55:18 +01:00
};
}
2014-02-15 22:14:27 +01:00
#endif // SCRIPTEDIT_H