diff --git a/src/ui/event.cpp b/src/ui/event.cpp index 6f04e8da54b3583d89084abeec8e7db7103c7a26..a344a5a4dbe9482694a234f544335e1cb2b64b8a 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 d7ea9abc3dc75bc811f0f44dad6c25b0c024c8f4..e90e0664da02c347c2c78d0920f340b9328979ec 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 9bef61b1d571df4a41d63546d920e8a2f339d391..ce62f4b4faf2dc5553927fe0bf2f71ebd653e9c3 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 0c88bff3292598cc9fb1bb0964e4091242a24832..d4372d17426240789bd2b066a1c0359b3c03f875 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(); };