31 lines
741 B
C
31 lines
741 B
C
// Copyright (c) 2021 Dominic Masters
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
#pragma once
|
|
#include "../libs.h"
|
|
#include "../display/font.h"
|
|
#include "menu.h"
|
|
#include "grid.h"
|
|
#include "label.h"
|
|
#include "rectangle.h"
|
|
|
|
/** Colour of the selection box for the text menu */
|
|
#define TEXTMENU_SELECTION_COLOR ((pixel_t){.r=0xFF,.g=0xFF,.b=0xFF,.a=0x64})
|
|
|
|
/** Callback type for when an item is selected */
|
|
typedef void textmenucallback_t(void *user, uint8_t i, char *text);
|
|
|
|
typedef struct {
|
|
menu_t menu;
|
|
grid_t grid;
|
|
font_t *font;
|
|
rectangle_t rectangle;
|
|
|
|
char *texts[MENU_ITEMS_MAX];
|
|
label_t labels[MENU_ITEMS_MAX];
|
|
|
|
textmenucallback_t *onSelect;
|
|
void *user;
|
|
} textmenu_t; |