34 lines
756 B
C
34 lines
756 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"
|
|
|
|
#define TEXTMENU_SELECTION_COLOR ((pixel_t){.r=0xFF,.g=0xFF,.b=0xFF,.a=0x64})
|
|
|
|
typedef void textmenucallback_t(void *user, uint8_t i, char *text);
|
|
|
|
typedef struct {
|
|
float x, y;
|
|
float width, height;
|
|
} textmenulabelinfo_t;
|
|
|
|
typedef struct {
|
|
menu_t menu;
|
|
char *texts[GRID_CHILD_COUNT];
|
|
|
|
font_t *font;
|
|
label_t labels[GRID_CHILD_COUNT];
|
|
rectangle_t rectangle;
|
|
textmenulabelinfo_t labelInfo[GRID_CHILD_COUNT];
|
|
|
|
textmenucallback_t *onSelect;
|
|
void *user;
|
|
} textmenu_t; |