2022-09-15 21:00:51 +03:00
|
|
|
#pragma once
|
|
|
|
|
2022-10-06 00:55:26 +03:00
|
|
|
#include <furi.h>
|
2022-09-15 21:00:51 +03:00
|
|
|
#include <m-array.h>
|
|
|
|
|
|
|
|
typedef struct {
|
2022-10-05 21:27:13 +03:00
|
|
|
FuriString* text;
|
2022-09-15 21:00:51 +03:00
|
|
|
uint32_t event;
|
|
|
|
} ArchiveContextMenuItem_t;
|
|
|
|
|
|
|
|
static void ArchiveContextMenuItem_t_init(ArchiveContextMenuItem_t* obj) {
|
2022-10-05 21:27:13 +03:00
|
|
|
obj->text = furi_string_alloc();
|
2022-09-15 21:00:51 +03:00
|
|
|
obj->event = 0; // ArchiveBrowserEventFileMenuNone
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ArchiveContextMenuItem_t_init_set(
|
|
|
|
ArchiveContextMenuItem_t* obj,
|
|
|
|
const ArchiveContextMenuItem_t* src) {
|
2022-10-05 21:27:13 +03:00
|
|
|
obj->text = furi_string_alloc_set(src->text);
|
2022-09-15 21:00:51 +03:00
|
|
|
obj->event = src->event;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ArchiveContextMenuItem_t_set(
|
|
|
|
ArchiveContextMenuItem_t* obj,
|
|
|
|
const ArchiveContextMenuItem_t* src) {
|
2022-10-06 00:55:26 +03:00
|
|
|
furi_string_set(obj->text, src->text);
|
2022-09-15 21:00:51 +03:00
|
|
|
obj->event = src->event;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ArchiveContextMenuItem_t_clear(ArchiveContextMenuItem_t* obj) {
|
2022-10-05 21:27:13 +03:00
|
|
|
furi_string_free(obj->text);
|
2022-09-15 21:00:51 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ARRAY_DEF(
|
|
|
|
menu_array,
|
|
|
|
ArchiveContextMenuItem_t,
|
|
|
|
(INIT(API_2(ArchiveContextMenuItem_t_init)),
|
|
|
|
SET(API_6(ArchiveContextMenuItem_t_set)),
|
|
|
|
INIT_SET(API_6(ArchiveContextMenuItem_t_init_set)),
|
|
|
|
CLEAR(API_2(ArchiveContextMenuItem_t_clear))))
|
|
|
|
|
|
|
|
#pragma GCC diagnostic push
|
|
|
|
#pragma GCC diagnostic ignored "-Wunused-function"
|
|
|
|
// Using in applications/archive/views/archive_browser_view.c
|
2022-10-05 21:27:13 +03:00
|
|
|
static void
|
2023-07-16 20:28:15 +03:00
|
|
|
archive_menu_add_item(ArchiveContextMenuItem_t* obj, const char* text, uint32_t event) {
|
2022-10-06 00:55:26 +03:00
|
|
|
obj->text = furi_string_alloc_set(text);
|
2022-09-15 21:00:51 +03:00
|
|
|
obj->event = event;
|
|
|
|
}
|
|
|
|
#pragma GCC diagnostic pop
|