From eedaa2adf25bd91e14d373c0c31e522dcebde303 Mon Sep 17 00:00:00 2001
From: Doralitze <doralitze@chaotikum.org>
Date: Sun, 10 Mar 2019 12:22:15 +0100
Subject: [PATCH] fix: virtual described constructor now implemented

---
 src/ui/event.cpp |  2 +-
 src/ui/event.hpp |  2 +-
 src/ui/view.cpp  | 10 ++++------
 src/ui/view.hpp  | 10 +++++++++-
 4 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/ui/event.cpp b/src/ui/event.cpp
index 6f04e8d..a344a5a 100644
--- a/src/ui/event.cpp
+++ b/src/ui/event.cpp
@@ -1,4 +1,4 @@
-#include "event.hpp"
+#include "ui/event.hpp"
 
 namespace rmrf::ui {
 	event::event(std::shared_ptr<ui_context> sender) {
diff --git a/src/ui/event.hpp b/src/ui/event.hpp
index d7ea9ab..e90e066 100644
--- a/src/ui/event.hpp
+++ b/src/ui/event.hpp
@@ -3,7 +3,7 @@
 #include <memory>
 #include <string>
 
-#include "ui_context.hpp"
+#include "ui/ui_context.hpp"
 
 namespace rmrf::ui {
 
diff --git a/src/ui/view.cpp b/src/ui/view.cpp
index 9bef61b..ce62f4b 100644
--- a/src/ui/view.cpp
+++ b/src/ui/view.cpp
@@ -1,15 +1,13 @@
-#include "lib/ncurses/ncurses.hpp"
-
 #include "ui/view.hpp"
 
 namespace rmrf::ui {
 
-display::display() : m{} {
-    initscr();
+view::view(std::shared_ptr<view> parent) {
+	this->parent = parent;
 }
 
-display::~display() {
-    endwin();
+std::shared_ptr<view> view::get_parent() {
+	return this->parent;
 }
 
 }
diff --git a/src/ui/view.hpp b/src/ui/view.hpp
index 0c88bff..d4372d1 100644
--- a/src/ui/view.hpp
+++ b/src/ui/view.hpp
@@ -43,6 +43,8 @@ public:
  * This abstract class implements a view page.
  */
 class view : ui_context {
+private:
+    std::shared_ptr<view> parent;
 public:
     /**
      * This method will be called when an operation is taking place. It may add
@@ -63,12 +65,18 @@ public:
      * @return True if rerendering is required or otherwise false.
      */
     virtual bool update(std::shared_ptr<display> display, std::shared_ptr<event> event);
+    /**
+     * Use this method in order to retrieve the parent of this view.
+     * @warn Keep in mind that this might be null.
+     * @return The parent
+     */
+    std::shared_ptr<view> get_parent();
     /**
      * This constructor shall be capable of creating the view.
      *
      * @param parent The parent view of this view. This may be null if there is none.
      */
-    virtual view(std::shared_ptr<view> parent);
+    view(std::shared_ptr<view> parent);
     virtual ~view();
 };
 
-- 
GitLab