summaryrefslogtreecommitdiffstats
path: root/Project/Element.cpp
diff options
context:
space:
mode:
authorThales Lima Oliveira <thaleslima.ufu@gmail.com>2017-01-05 19:37:42 -0200
committerGitHub <noreply@github.com>2017-01-05 19:37:42 -0200
commit9df133274802731220546d1f9383c213193c8413 (patch)
tree9c6e2fa2a45d6c6c4c14d8711b2b89066bfb37d7 /Project/Element.cpp
parentc5343c718cf80620c2fc7452a4315f7ddb9e5826 (diff)
parentb6f96ca48bc156898df79deba63d270b393fb150 (diff)
downloadPSP.git-9df133274802731220546d1f9383c213193c8413.tar.gz
PSP.git-9df133274802731220546d1f9383c213193c8413.tar.xz
PSP.git-9df133274802731220546d1f9383c213193c8413.zip
Merge pull request #5 from Thales1330/opt/element-parent-search
Opt element parent search
Diffstat (limited to 'Project/Element.cpp')
-rw-r--r--Project/Element.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/Project/Element.cpp b/Project/Element.cpp
index 4de5ebd..53eaa26 100644
--- a/Project/Element.cpp
+++ b/Project/Element.cpp
@@ -300,15 +300,15 @@ void Element::SetOnline(bool online)
void Element::GeneralMenuItens(wxMenu& menu)
{
wxMenuItem* clockItem = new wxMenuItem(&menu, ID_ROTATE_CLOCK, _("Rotate clockwise"));
- clockItem->SetBitmap(wxImage("data\\images\\menu\\rotateClock16.png"));
+ clockItem->SetBitmap(wxImage("..\\data\\images\\menu\\rotateClock16.png"));
menu.Append(clockItem);
wxMenuItem* counterClockItem = new wxMenuItem(&menu, ID_ROTATE_COUNTERCLOCK, _("Rotate counter-clockwise"));
- counterClockItem->SetBitmap(wxImage("data\\images\\menu\\rotateCounterClock16.png"));
+ counterClockItem->SetBitmap(wxImage("..\\data\\images\\menu\\rotateCounterClock16.png"));
menu.Append(counterClockItem);
wxMenuItem* deleteItem = new wxMenuItem(&menu, ID_DELETE, _("Delete"));
- deleteItem->SetBitmap(wxImage("data\\images\\menu\\delete16.png"));
+ deleteItem->SetBitmap(wxImage("..\\data\\images\\menu\\delete16.png"));
menu.Append(deleteItem);
}
@@ -456,6 +456,23 @@ void Element::ReplaceParent(Element* oldParent, Element* newParent)
}
}
+void Element::AddChild(Element* child) { m_childList.push_back(child); }
+
+void Element::RemoveChild(Element* child)
+{
+ for(auto it = m_childList.begin(); it != m_childList.end(); ++it) {
+ Element* element = *it;
+ if(element == child) m_childList.erase(it--);
+ }
+}
+
+void Element::ReplaceChild(Element* oldChild, Element* newChild)
+{
+ for(int i = 0; i < (int)m_childList.size(); i++) {
+ if(m_childList[i] == oldChild) m_childList[i] = newChild;
+ }
+}
+
void OpenGLColour::SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
{
rgba[0] = red;