2018-07-14 06:06:33 +00:00
|
|
|
#ifndef AMUSE_EDITOR_WIDGET_HPP
|
|
|
|
#define AMUSE_EDITOR_WIDGET_HPP
|
|
|
|
|
|
|
|
#include <QWidget>
|
2018-07-26 03:41:48 +00:00
|
|
|
#include <QUndoCommand>
|
|
|
|
#include <QApplication>
|
2018-07-18 07:39:26 +00:00
|
|
|
#include "ProjectModel.hpp"
|
2018-07-14 06:06:33 +00:00
|
|
|
|
|
|
|
class EditorWidget : public QWidget
|
|
|
|
{
|
2018-07-26 03:41:48 +00:00
|
|
|
Q_OBJECT
|
2018-07-14 06:06:33 +00:00
|
|
|
public:
|
|
|
|
explicit EditorWidget(QWidget* parent = Q_NULLPTR);
|
2018-07-18 07:39:26 +00:00
|
|
|
virtual bool valid() const { return true; }
|
2018-07-26 03:41:48 +00:00
|
|
|
virtual void unloadData() {}
|
2018-07-28 04:34:29 +00:00
|
|
|
virtual ProjectModel::INode* currentNode() const { return nullptr; }
|
2018-07-14 06:06:33 +00:00
|
|
|
};
|
|
|
|
|
2018-07-26 03:41:48 +00:00
|
|
|
class EditorUndoCommand : public QUndoCommand
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
std::shared_ptr<ProjectModel::INode> m_node;
|
|
|
|
enum class Id
|
|
|
|
{
|
|
|
|
SMChangeVal,
|
|
|
|
};
|
|
|
|
public:
|
|
|
|
EditorUndoCommand(std::shared_ptr<ProjectModel::INode> node,
|
|
|
|
const QString& text, QUndoCommand* parent = nullptr)
|
|
|
|
: QUndoCommand(text, parent), m_node(node) {}
|
|
|
|
void undo();
|
|
|
|
void redo();
|
|
|
|
};
|
2018-07-14 06:06:33 +00:00
|
|
|
|
|
|
|
#endif //AMUSE_EDITOR_WIDGET_HPP
|