summaryrefslogtreecommitdiffstats
path: root/Project/MathOperation.cpp
diff options
context:
space:
mode:
authorThales Lima Oliveira <thaleslima.ufu@gmail.com>2020-06-13 00:01:53 -0300
committerThales Lima Oliveira <thaleslima.ufu@gmail.com>2020-06-13 00:01:53 -0300
commit6c0e98a2727d07e1fbb38b78c27d68e98ad09465 (patch)
tree12764ca986c9a1943bc2012b0cc751471773f6ee /Project/MathOperation.cpp
parent196389a70ef3a03aa8764b9532812a17dd55014b (diff)
downloadPSP.git-6c0e98a2727d07e1fbb38b78c27d68e98ad09465.tar.gz
PSP.git-6c0e98a2727d07e1fbb38b78c27d68e98ad09465.tar.xz
PSP.git-6c0e98a2727d07e1fbb38b78c27d68e98ad09465.zip
Device context implemented
Diffstat (limited to 'Project/MathOperation.cpp')
-rw-r--r--Project/MathOperation.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/Project/MathOperation.cpp b/Project/MathOperation.cpp
index c9128aa..0373c85 100644
--- a/Project/MathOperation.cpp
+++ b/Project/MathOperation.cpp
@@ -17,6 +17,8 @@
#include "MathOperation.h"
#include "ConnectionLine.h"
+#include <wx/pen.h>
+#include <wx/brush.h>
MathOperation::MathOperation(int id) : ControlElement(id)
{
@@ -54,6 +56,27 @@ void MathOperation::Draw(wxPoint2DDouble translation, double scale) const
DrawNodes();
}
+void MathOperation::DrawDC(wxPoint2DDouble translation, double scale, wxGraphicsContext* gc) const
+{
+ if (m_selected) {
+ gc->SetPen(*wxTRANSPARENT_PEN);
+ gc->SetBrush(wxBrush(m_selectionColour.GetDcRGBA()));
+ double borderSize = (m_borderSize * 2.0 + 1.0) / scale;
+ gc->DrawRectangle(m_position.m_x - m_width / 2 - borderSize / 2, m_position.m_y - m_height / 2 - borderSize / 2, m_width + borderSize, m_height + borderSize);
+ }
+ gc->SetPen(*wxBLACK_PEN);
+ gc->SetBrush(*wxWHITE_BRUSH);
+ DrawRectangle(m_position, m_width, m_height);
+ gc->DrawRectangle(m_position.m_x - m_width / 2, m_position.m_y - m_height / 2, m_width, m_height);
+
+ // Draw personalized element symbol.
+ DrawDCSymbol(gc);
+
+ gc->SetPen(*wxTRANSPARENT_PEN);
+ gc->SetBrush(*wxBLACK_BRUSH);
+ DrawDCNodes(gc);
+}
+
void MathOperation::Rotate(bool clockwise)
{
if(clockwise)