summaryrefslogtreecommitdiffstats
path: root/Project/ControlElement.h
diff options
context:
space:
mode:
authorThales1330 <thaleslima.ufu@gmail.com>2017-01-27 19:57:18 -0200
committerThales1330 <thaleslima.ufu@gmail.com>2017-01-27 19:57:18 -0200
commit10bb7105946bc0a892a9daf42ec5181ad9994fcf (patch)
tree5b27234c7b0c9ababde2a1dcca2d95c5149770cc /Project/ControlElement.h
parent15df77aa461ecea7344cce5e736ebee9fb943a9b (diff)
downloadPSP.git-10bb7105946bc0a892a9daf42ec5181ad9994fcf.tar.gz
PSP.git-10bb7105946bc0a892a9daf42ec5181ad9994fcf.tar.xz
PSP.git-10bb7105946bc0a892a9daf42ec5181ad9994fcf.zip
several control elements methods implemented
Node position buggy
Diffstat (limited to 'Project/ControlElement.h')
-rw-r--r--Project/ControlElement.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/Project/ControlElement.h b/Project/ControlElement.h
index 69f9d83..9414d38 100644
--- a/Project/ControlElement.h
+++ b/Project/ControlElement.h
@@ -3,12 +3,58 @@
#include "Element.h"
+class Node
+{
+public:
+ enum NodeType { NODE_IN = 0, NODE_OUT };
+
+ Node(wxPoint2DDouble position = wxPoint2DDouble(0, 0), NodeType nodeType = NODE_IN, double borderSize = 0.0);
+ ~Node();
+
+ wxRect2DDouble GetRect() const { return m_rect; }
+ void SetRect(wxRect2DDouble rect) { m_rect = rect; }
+
+ wxPoint2DDouble GetPosition() const { return m_rect.GetPosition(); }
+ void SetPosition(wxPoint2DDouble position);
+
+ NodeType GetNodeType() const { return m_nodeType; }
+ void SetNodeType(NodeType nodeType) { m_nodeType = nodeType; }
+
+ double GetRadius() const { return m_radius; }
+ std::vector<wxPoint2DDouble> GetInTrianglePts() const { return m_triPts; }
+
+ void StartMove(wxPoint2DDouble position);
+ void Move(wxPoint2DDouble position);
+ bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
+
+protected:
+ wxRect2DDouble m_rect;
+ NodeType m_nodeType;
+
+ wxPoint2DDouble m_moveStartPt;
+ wxPoint2DDouble m_movePos;
+
+ double m_radius = 3.0;
+ std::vector<wxPoint2DDouble> m_triPts;
+ std::vector<wxPoint2DDouble> m_triPtsMovePos;
+};
+
class ControlElement : public Element
{
public:
ControlElement();
~ControlElement();
+ virtual void StartMove(wxPoint2DDouble position);
+ virtual void Move(wxPoint2DDouble position);
+
+ void SetNodeList(std::vector<Node> nodeList) { m_nodeList = nodeList; }
+ std::vector<Node> GetNodeList() const { return m_nodeList; }
+
+ virtual void DrawNodes() const;
+
+protected:
+ std::vector<Node> m_nodeList;
};
#endif // CONTROLELEMENT_H