Skip to content
Snippets Groups Projects
Unverified Commit eedaa2ad authored by Leon Dietrich's avatar Leon Dietrich
Browse files

fix: virtual described constructor now implemented

parent c2f7f771
No related branches found
No related tags found
No related merge requests found
Pipeline #
#include "event.hpp" #include "ui/event.hpp"
namespace rmrf::ui { namespace rmrf::ui {
event::event(std::shared_ptr<ui_context> sender) { event::event(std::shared_ptr<ui_context> sender) {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include "ui_context.hpp" #include "ui/ui_context.hpp"
namespace rmrf::ui { namespace rmrf::ui {
......
#include "lib/ncurses/ncurses.hpp"
#include "ui/view.hpp" #include "ui/view.hpp"
namespace rmrf::ui { namespace rmrf::ui {
display::display() : m{} { view::view(std::shared_ptr<view> parent) {
initscr(); this->parent = parent;
} }
display::~display() { std::shared_ptr<view> view::get_parent() {
endwin(); return this->parent;
} }
} }
...@@ -43,6 +43,8 @@ public: ...@@ -43,6 +43,8 @@ public:
* This abstract class implements a view page. * This abstract class implements a view page.
*/ */
class view : ui_context { class view : ui_context {
private:
std::shared_ptr<view> parent;
public: public:
/** /**
* This method will be called when an operation is taking place. It may add * This method will be called when an operation is taking place. It may add
...@@ -63,12 +65,18 @@ public: ...@@ -63,12 +65,18 @@ public:
* @return True if rerendering is required or otherwise false. * @return True if rerendering is required or otherwise false.
*/ */
virtual bool update(std::shared_ptr<display> display, std::shared_ptr<event> event); 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. * 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. * @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(); virtual ~view();
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment