GUI: view enter, exit callbacks. (#326)

This commit is contained in:
あく
2021-02-04 15:05:46 +03:00
committed by GitHub
parent cb4fb8e4ae
commit 2187dc7117
6 changed files with 72 additions and 6 deletions

View File

@@ -40,6 +40,16 @@ void view_set_next_callback(View* view, ViewNavigationCallback callback) {
view->next_callback = callback;
}
void view_set_enter_callback(View* view, ViewCallback callback) {
furi_assert(view);
view->enter_callback = callback;
}
void view_set_exit_callback(View* view, ViewCallback callback) {
furi_assert(view);
view->exit_callback = callback;
}
void view_set_context(View* view, void* context) {
furi_assert(view);
furi_assert(context);
@@ -143,3 +153,13 @@ uint32_t view_next(View* view) {
return VIEW_IGNORE;
}
}
void view_enter(View* view) {
furi_assert(view);
if(view->enter_callback) view->enter_callback(view->context);
}
void view_exit(View* view) {
furi_assert(view);
if(view->exit_callback) view->exit_callback(view->context);
}