amuse/Editor/CurveEditor.hpp

67 lines
1.6 KiB
C++
Raw Normal View History

2018-07-18 07:39:26 +00:00
#ifndef AMUSE_CURVE_EDITOR_HPP
#define AMUSE_CURVE_EDITOR_HPP
#include "EditorWidget.hpp"
2018-08-04 22:05:01 +00:00
#include <QFrame>
#include <QLabel>
#include <QStaticText>
#include <QLineEdit>
#include <QPushButton>
2018-08-19 20:05:39 +00:00
#include <QJSEngine>
2018-08-04 22:05:01 +00:00
class CurveEditor;
class CurveView : public QWidget
{
Q_OBJECT
friend class CurveControls;
amuse::ObjToken<ProjectModel::CurveNode> m_node;
QFont m_gridFont;
QStaticText m_percentTexts[11];
QStaticText m_percentTextsCenter[11];
CurveEditor* getEditor() const;
public:
explicit CurveView(QWidget* parent = Q_NULLPTR);
void loadData(ProjectModel::CurveNode* node);
void unloadData();
ProjectModel::INode* currentNode() const;
void paintEvent(QPaintEvent* ev);
void mousePressEvent(QMouseEvent* ev);
void mouseMoveEvent(QMouseEvent* ev);
};
class CurveControls : public QFrame
{
Q_OBJECT
friend class CurveView;
QLineEdit* m_lineEdit;
QLabel* m_errLabel;
QPushButton* m_setExpr;
2018-08-19 20:05:39 +00:00
QJSEngine m_engine;
2018-08-04 22:05:01 +00:00
CurveEditor* getEditor() const;
public:
explicit CurveControls(QWidget* parent = Q_NULLPTR);
void loadData();
void unloadData();
void resizeEvent(QResizeEvent* ev);
public slots:
void exprCommit();
};
2018-07-18 07:39:26 +00:00
class CurveEditor : public EditorWidget
{
Q_OBJECT
2018-08-04 22:05:01 +00:00
friend class CurveView;
friend class CurveControls;
CurveView* m_curveView;
CurveControls* m_controls;
2018-07-18 07:39:26 +00:00
public:
explicit CurveEditor(QWidget* parent = Q_NULLPTR);
bool loadData(ProjectModel::CurveNode* node);
2018-08-04 22:05:01 +00:00
void unloadData();
ProjectModel::INode* currentNode() const;
2018-07-18 07:39:26 +00:00
};
#endif //AMUSE_CURVE_EDITOR_HPP