unleashed-firmware/applications/gui/view_dispatcher_i.h
Skorpionm 6f7bcdf9a7
[FL-1755, FL-1756] added LL_DeInit timers, removed Analyze scene, redesigned astomatic frequency change mechanism, updated subghz read scene interface (#677)
* SubGhz: Fix Timer hopping
* SubGhz: add display of received packages and their maximum number. redesigned interface, the maximum number of received packages increased to 50
* SubGhz: add clearing history on exit read scene, jump after saving the key into the history of received signals
* SubGhz: Fix honoring the width of the icon for transmitter scene
* RFID: Fix [FL-1755] freeze after key emulation
* SubGhz: drop analyze scene and views
* SubGhz: fix save scene
* Input, GUI: new event delivery scheme that groups event for complementarity.
* Gui: update View Dispatcher documentation
* Gui: remove dead code, wait till all input events are delivered in ViewDispatcher in queue mode.
* Gui: update comment in ViewDispatcher
* FuriHal: fix incorrect clock disable invocation
* FuriHal: proper include
* SubGhz: properly reset history in receiver view
* Gui: correct view switch order and non-complementary events discarding

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

63 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* delayed_next_view;
uint8_t ongoing_input_events_count;
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);