flipperzero-firmware/applications/gui/view_dispatcher_i.h
Skorpionm e17336498d
[FL-1756, FL-1769, FL-1776, FL-1759] Gui: input events complementary V3, refactoring. SubGhz: read/emulate fixes. Cleanup. (#684)
* Gui: move rotation logic to ViewPort, replace delayed View switch in ViewDispatcher with event filtering and redirection to previous view.
* SubGhz: add function description
* Gui, Input: add event id to input events.
* SubGhz: fix "crashing on ?"
* SubGhz: add icon scanning
* SubGhz: updated interface read scene,  updated interface config scene
* Assets: update subghz assets
* SubGhz:  replaced the picture in the read scene, changed the paths to additional files
* SubGhz: fix deadlock in timer callback
* SubGhz: fix icon read scene
* SubGhz: fix icon read scene
* SubGhz: fix duble text transmitter scene
* SubGhz: correct spelling. Gui: bigger queue for ViewDispatcher.
* SubGhz: fix creation and transmission of dynamic code without the presence of a manufactory key
* SubGhz: fix keelog, setting a name in the absence of a manufactory key
* SubGhz: fix load bad keelog key
* Format sources
* Furi: remove garbage from core. GpioTester: fix memory leak and cleanup
* Accessor: remove obsolete notification code
* MusicPlayer: remove input event injection
* Input: rename id to sequence

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-09-02 00:05:00 +03:00

64 lines
1.7 KiB
C

#pragma once
#include <furi.h>
#include <m-dict.h>
#include "view_dispatcher.h"
#include "view_i.h"
#include "gui_i.h"
DICT_DEF2(ViewDict, uint32_t, M_DEFAULT_OPLIST, View*, M_PTR_OPLIST)
struct ViewDispatcher {
osMessageQueueId_t queue;
Gui* gui;
ViewPort* view_port;
ViewDict_t views;
View* current_view;
View* ongoing_input_view;
uint8_t ongoing_input;
ViewDispatcherCustomEventCallback custom_event_callback;
ViewDispatcherNavigationEventCallback navigation_event_callback;
ViewDispatcherTickEventCallback tick_event_callback;
uint32_t tick_period;
void* event_context;
};
typedef enum {
ViewDispatcherMessageTypeInput,
ViewDispatcherMessageTypeCustomEvent,
ViewDispatcherMessageTypeStop,
} ViewDispatcherMessageType;
typedef struct {
ViewDispatcherMessageType type;
union {
InputEvent input;
uint32_t custom_event;
};
} ViewDispatcherMessage;
/* ViewPort Draw Callback */
void view_dispatcher_draw_callback(Canvas* canvas, void* context);
/* ViewPort Input Callback */
void view_dispatcher_input_callback(InputEvent* event, void* context);
/* Input handler */
void view_dispatcher_handle_input(ViewDispatcher* view_dispatcher, InputEvent* event);
/* Tick handler */
void view_dispatcher_handle_tick_event(ViewDispatcher* view_dispatcher);
/* Custom event handler */
void view_dispatcher_handle_custom_event(ViewDispatcher* view_dispatcher, uint32_t event);
/* Set current view, dispatches view enter and exit */
void view_dispatcher_set_current_view(ViewDispatcher* view_dispatcher, View* view);
/* ViewDispatcher update event */
void view_dispatcher_update(View* view, void* context);