flipperzero-firmware/applications/gui/gui_i.h
Anna Prosvetova e9e76e144c
RPC: Implement storage_stat_request (#800)
* RPC: Update protobuf sources
* RPC: Implement storage_stat_request
* RPC: Test storage_stat_request
* FuriRecord: fix use after free in destroy method.
* Furi: refactor PubSub and it's usage. Fix allocation in RPC.
* FuriCore: fix memory leak in pubsub
* FuriCore: update unsubscribe method signature in pubsub, make subscription structure lighter.
* FuriCore: remove dead code

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-11-01 23:35:54 +03:00

78 lines
1.6 KiB
C

/**
* @file gui_i.h
* GUI: main API internals
*/
#pragma once
#include "gui.h"
#include <furi.h>
#include <m-array.h>
#include <stdio.h>
#include <cli/cli.h>
#include "canvas.h"
#include "canvas_i.h"
#include "view_port.h"
#include "view_port_i.h"
#define GUI_DISPLAY_WIDTH 128
#define GUI_DISPLAY_HEIGHT 64
#define GUI_STATUS_BAR_X 0
#define GUI_STATUS_BAR_Y 0
#define GUI_STATUS_BAR_WIDTH GUI_DISPLAY_WIDTH
#define GUI_STATUS_BAR_HEIGHT 13
#define GUI_MAIN_X 0
#define GUI_MAIN_Y 9
#define GUI_MAIN_WIDTH GUI_DISPLAY_WIDTH
#define GUI_MAIN_HEIGHT (GUI_DISPLAY_HEIGHT - GUI_MAIN_Y)
#define GUI_THREAD_FLAG_DRAW (1 << 0)
#define GUI_THREAD_FLAG_INPUT (1 << 1)
#define GUI_THREAD_FLAG_ALL (GUI_THREAD_FLAG_DRAW | GUI_THREAD_FLAG_INPUT)
ARRAY_DEF(ViewPortArray, ViewPort*, M_PTR_OPLIST);
/** Gui structure */
struct Gui {
// Thread and lock
osThreadId_t thread;
osMutexId_t mutex;
// Layers and Canvas
ViewPortArray_t layers[GuiLayerMAX];
Canvas* canvas;
GuiCanvasCommitCallback canvas_callback;
void* canvas_callback_context;
// Input
osMessageQueueId_t input_queue;
FuriPubSub* input_events;
uint8_t ongoing_input;
ViewPort* ongoing_input_view_port;
// Cli
Cli* cli;
};
ViewPort* gui_view_port_find_enabled(ViewPortArray_t array);
/** Update GUI, request redraw
*
* @param gui Gui instance
*/
void gui_update(Gui* gui);
void gui_input_events_callback(const void* value, void* ctx);
void gui_lock(Gui* gui);
void gui_unlock(Gui* gui);
void gui_cli_screen_stream_callback(uint8_t* data, size_t size, void* context);
void gui_cli_screen_stream(Cli* cli, string_t args, void* context);