[FL-1092] Make View reusable outside of dispatcher (#396)

* View: replace direct View to ViewDispatcher link with callback. ViewDispatcher: update View usage. ViewHandler: update View usage, handle update signal.
This commit is contained in:
あく
2021-04-01 15:03:02 +03:00
committed by GitHub
parent 41c3b95f6d
commit 37131dbe12
7 changed files with 80 additions and 22 deletions

View File

@@ -1,7 +1,6 @@
#pragma once
#include "view.h"
#include "view_dispatcher_i.h"
#include <furi.h>
typedef struct {
@@ -10,21 +9,22 @@ typedef struct {
} ViewModelLocking;
struct View {
ViewDispatcher* dispatcher;
ViewDrawCallback draw_callback;
ViewInputCallback input_callback;
ViewModelType model_type;
ViewNavigationCallback previous_callback;
ViewNavigationCallback next_callback;
ViewCallback enter_callback;
ViewCallback exit_callback;
ViewUpdateCallback update_callback;
void* update_callback_context;
void* model;
void* context;
};
/* Set View dispatcher */
void view_set_dispatcher(View* view, ViewDispatcher* view_dispatcher);
/* Unlock model */
void view_unlock_model(View* view);